comparison lib/LTO/CMakeLists.txt @ 120:1172e4bd9c6f

update 4.0.0
author mir3636
date Fri, 25 Nov 2016 19:14:25 +0900
parents 60c9769439b8
children 803732b1fca8
comparison
equal deleted inserted replaced
101:34baf5011add 120:1172e4bd9c6f
1 # Figure out if we can track VC revisions.
2 function(find_first_existing_file out_var)
3 foreach(file ${ARGN})
4 if(EXISTS "${file}")
5 set(${out_var} "${file}" PARENT_SCOPE)
6 return()
7 endif()
8 endforeach()
9 endfunction()
10
11 macro(find_first_existing_vc_file out_var path)
12 find_first_existing_file(${out_var}
13 "${path}/.git/logs/HEAD" # Git
14 "${path}/.svn/wc.db" # SVN 1.7
15 "${path}/.svn/entries" # SVN 1.6
16 )
17 endmacro()
18
19 find_first_existing_vc_file(llvm_vc "${LLVM_MAIN_SRC_DIR}")
20
21 # The VC revision include that we want to generate.
22 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/LLVMLTORevision.h")
23
24 set(get_svn_script "${LLVM_CMAKE_PATH}/GenerateVersionFromCVS.cmake")
25
26 if(DEFINED llvm_vc)
27 # Create custom target to generate the VC revision include.
28 add_custom_command(OUTPUT "${version_inc}"
29 DEPENDS "${llvm_vc}" "${get_svn_script}"
30 COMMAND
31 ${CMAKE_COMMAND} "-DSOURCE_DIR=${LLVM_MAIN_SRC_DIR}"
32 "-DNAME=LLVM_REVISION"
33 "-DHEADER_FILE=${version_inc}"
34 -P "${get_svn_script}")
35
36 # Mark the generated header as being generated.
37 set_source_files_properties("${version_inc}"
38 PROPERTIES GENERATED TRUE
39 HEADER_FILE_ONLY TRUE)
40
41 # Tell Version.cpp that it needs to build with -DHAVE_SVN_VERSION_INC.
42 set_source_files_properties(Version.cpp
43 PROPERTIES COMPILE_DEFINITIONS "HAVE_SVN_VERSION_INC")
44 else()
45 # Not producing a VC revision include.
46 set(version_inc)
47 endif()
48
49
1 add_llvm_library(LLVMLTO 50 add_llvm_library(LLVMLTO
51 Caching.cpp
52 LTO.cpp
53 LTOBackend.cpp
2 LTOModule.cpp 54 LTOModule.cpp
3 LTOCodeGenerator.cpp 55 LTOCodeGenerator.cpp
56 UpdateCompilerUsed.cpp
57 ThinLTOCodeGenerator.cpp
58 ${version_inc}
4 59
5 ADDITIONAL_HEADER_DIRS 60 ADDITIONAL_HEADER_DIRS
6 ${LLVM_MAIN_INCLUDE_DIR}/llvm/LTO 61 ${LLVM_MAIN_INCLUDE_DIR}/llvm/LTO
7 )
8 62
9 add_dependencies(LLVMLTO intrinsics_gen) 63 DEPENDS
64 intrinsics_gen
65 )