[PATCH] D35377: [CMAKE] Speedup developer builds when passing LLVM_APPEND_VC_REV = OFF
don hinton via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 17 14:54:26 PDT 2017
hintonda updated this revision to Diff 106961.
hintonda edited the summary of this revision.
hintonda added a comment.
Simplify VCRevision.h creation when LLVM_APPEN_VC_REV = OFF.
https://reviews.llvm.org/D35377
Files:
cmake/modules/GenerateVersionFromCVS.cmake
include/llvm/Support/CMakeLists.txt
Index: include/llvm/Support/CMakeLists.txt
===================================================================
--- include/llvm/Support/CMakeLists.txt
+++ include/llvm/Support/CMakeLists.txt
@@ -9,7 +9,6 @@
endfunction()
macro(find_first_existing_vc_file out_var path)
- if ( LLVM_APPEND_VC_REV )
find_program(git_executable NAMES git git.exe git.cmd)
# Run from a subdirectory to force git to print an absolute path.
execute_process(COMMAND ${git_executable} rev-parse --git-dir
@@ -30,7 +29,6 @@
"${path}/.svn/entries" # SVN 1.6
)
endif()
- endif()
endmacro()
find_first_existing_vc_file(llvm_vc "${LLVM_MAIN_SRC_DIR}")
@@ -40,22 +38,21 @@
set(get_svn_script "${LLVM_CMAKE_PATH}/GenerateVersionFromCVS.cmake")
-if(DEFINED llvm_vc)
- # Create custom target to generate the VC revision include.
- add_custom_command(OUTPUT "${version_inc}"
- DEPENDS "${llvm_vc}" "${get_svn_script}"
- COMMAND
- ${CMAKE_COMMAND} "-DSOURCE_DIR=${LLVM_MAIN_SRC_DIR}"
- "-DNAME=LLVM_REVISION"
- "-DHEADER_FILE=${version_inc}"
- -P "${get_svn_script}")
-
- # Mark the generated header as being generated.
- set_source_files_properties("${version_inc}"
- PROPERTIES GENERATED TRUE
- HEADER_FILE_ONLY TRUE)
-else()
- file(WRITE "${version_inc}" "")
-endif()
+add_custom_command(OUTPUT force_version_inc_check COMMAND ${CMAKE_COMMAND} -E echo_append)
+
+# Create custom target to generate the VC revision include.
+add_custom_command(OUTPUT "${version_inc}"
+ DEPENDS force_version_inc_check "${llvm_vc}" "${get_svn_script}"
+ COMMAND
+ ${CMAKE_COMMAND} "-DSOURCE_DIR=${LLVM_MAIN_SRC_DIR}"
+ "-DLLVM_APPEND_VC_REV=${LLVM_APPEND_VC_REV}"
+ "-DNAME=LLVM_REVISION"
+ "-DHEADER_FILE=${version_inc}"
+ -P "${get_svn_script}")
+
+# Mark the generated header as being generated.
+set_source_files_properties("${version_inc}"
+ PROPERTIES GENERATED TRUE
+ HEADER_FILE_ONLY TRUE)
add_custom_target(llvm_vcsrevision_h DEPENDS "${version_inc}")
Index: cmake/modules/GenerateVersionFromCVS.cmake
===================================================================
--- cmake/modules/GenerateVersionFromCVS.cmake
+++ cmake/modules/GenerateVersionFromCVS.cmake
@@ -8,7 +8,7 @@
# and SECOND_REPOSITORY and SECOND_REVISION if requested, where "FIRST" and
# "SECOND" are substituted with the names specified in the input variables.
-
+if (LLVM_APPEND_VC_REV)
# Chop off cmake/modules/GetSVN.cmake
get_filename_component(LLVM_DIR "${CMAKE_SCRIPT_MODE_FILE}" PATH)
@@ -32,6 +32,11 @@
append_info(${NAME} "${SOURCE_DIR}")
+else()
+ file(WRITE "${HEADER_FILE}.txt" "")
+endif()
+
+
# Copy the file only if it has changed.
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${HEADER_FILE}.txt" "${HEADER_FILE}")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35377.106961.patch
Type: text/x-patch
Size: 2929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170717/8e82c971/attachment.bin>
More information about the llvm-commits
mailing list