1unset(PNACL_LLVM) 2# Define PNACL_LLVM for LLVM_VERSION <= 3.7 3if((NOT LLVM_VERSION_MAJOR GREATER 3) AND (NOT LLVM_VERSION_MINOR GREATER 7)) 4 set(PNACL_LLVM 1) 5endif() 6 7if(PNACL_LLVM) 8 add_definitions( 9 -DPNACL_LLVM 10 ) 11 set(PNACL_EXTRA_COMPONENTS NaClBitReader NaClBitTestUtils) 12else() 13 include_directories(pnacl-llvm/include) 14 file(GLOB pnacl_llvm_SRCS "pnacl-llvm/*.cpp") 15endif() 16 17set(LLVM_LINK_COMPONENTS 18 ${LLVM_TARGETS_TO_BUILD} 19 Core 20 IRReader 21 Support 22 ${PNACL_EXTRA_COMPONENTS} 23 ) 24 25file(GLOB pnacl_sz_SRCS "src/*.cpp") 26add_llvm_tool(pnacl-sz ${pnacl_sz_SRCS} ${pnacl_llvm_SRCS}) 27 28if(PNACL_BROWSER_TRANSLATOR) 29 add_definitions( 30 -DALLOW_DUMP=0 31 -DALLOW_LLVM_CL=0 32 -DALLOW_LLVM_IR=0 33 -DALLOW_LLVM_IR_AS_INPUT=0 34 -DALLOW_TIMERS=0 35 -DALLOW_MINIMAL_BUILD=1 36 -DALLOW_WASM=0 37 -DPNACL_BROWSER_TRANSLATOR=1 38 ) 39else() 40 add_definitions( 41 -DALLOW_DUMP=1 42 -DALLOW_LLVM_CL=1 43 -DALLOW_LLVM_IR=1 44 -DALLOW_LLVM_IR_AS_INPUT=1 45 -DALLOW_TIMERS=1 46 -DALLOW_MINIMAL_BUILD=0 47 -DALLOW_WASM=0 48 -DPNACL_BROWSER_TRANSLATOR=0 49 ) 50 add_compile_options(-Wno-undefined-var-template) 51endif() 52 53execute_process(COMMAND git rev-parse HEAD 54 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 55 OUTPUT_VARIABLE SZ_GIT_HASH 56 OUTPUT_STRIP_TRAILING_WHITESPACE 57 ) 58execute_process(COMMAND git rev-list --count HEAD 59 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 60 OUTPUT_VARIABLE SZ_COMMIT_COUNT 61 OUTPUT_STRIP_TRAILING_WHITESPACE 62 ) 63add_definitions(-DSUBZERO_REVISION=${SZ_COMMIT_COUNT}_${SZ_GIT_HASH}) 64 65target_link_libraries(pnacl-sz pthread) 66