Mehdi Amini | 1d30fca | 2016-04-16 07:33:14 +0000 | [diff] [blame] | 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_MAIN_SRC_DIR}/cmake/modules/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 | |
Peter Collingbourne | 4ccf0f1 | 2013-09-24 23:52:22 +0000 | [diff] [blame] | 50 | add_llvm_library(LLVMLTO |
Mehdi Amini | adc0e26 | 2016-08-23 21:30:12 +0000 | [diff] [blame^] | 51 | Caching.cpp |
Teresa Johnson | df6edc5 | 2016-05-23 22:54:06 +0000 | [diff] [blame] | 52 | LTO.cpp |
Teresa Johnson | 9ba95f9 | 2016-08-11 14:58:12 +0000 | [diff] [blame] | 53 | LTOBackend.cpp |
Peter Collingbourne | 4ccf0f1 | 2013-09-24 23:52:22 +0000 | [diff] [blame] | 54 | LTOModule.cpp |
| 55 | LTOCodeGenerator.cpp |
Mehdi Amini | ce23e97 | 2016-04-13 06:32:46 +0000 | [diff] [blame] | 56 | UpdateCompilerUsed.cpp |
Mehdi Amini | 7c4a1a8 | 2016-03-09 01:37:22 +0000 | [diff] [blame] | 57 | ThinLTOCodeGenerator.cpp |
Mehdi Amini | 1d30fca | 2016-04-16 07:33:14 +0000 | [diff] [blame] | 58 | ${version_inc} |
Zachary Turner | 3bd47ce | 2015-02-11 03:28:02 +0000 | [diff] [blame] | 59 | |
| 60 | ADDITIONAL_HEADER_DIRS |
| 61 | ${LLVM_MAIN_INCLUDE_DIR}/llvm/LTO |
Mehdi Amini | 7c4a1a8 | 2016-03-09 01:37:22 +0000 | [diff] [blame] | 62 | ) |
NAKAMURA Takumi | 7ae226d | 2015-02-01 00:55:43 +0000 | [diff] [blame] | 63 | |
| 64 | add_dependencies(LLVMLTO intrinsics_gen) |