[Lldb-commits] [PATCH] D72855: Make LLVM_APPEND_VC_REV=OFF affect clang, lld, and lldb as well.

Nico Weber via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 16 08:38:17 PST 2020


thakis created this revision.
thakis added a reviewer: rnk.
Herald added a subscriber: mgorny.
Herald added a project: LLVM.
thakis added a comment.

A very late follow-up to my question in D37272 <https://reviews.llvm.org/D37272> :)


When LLVM_APPEND_VC_REV=OFF is set, the current git hash is no
longer embedded into binaries (mostly for --version output).
Without it, most binaries need to relink after every single
commit, even if they didn't change otherwise (due to, say,
a documentation-only commit).

LLVM_APPEND_VC_REV is ON by default, so this doesn't change the
default behavior of anything.

With this, all clients of GenerateVersionFromVCS.cmake honor
LLVM_APPEND_VC_REV.


https://reviews.llvm.org/D72855

Files:
  clang/lib/Basic/CMakeLists.txt
  lld/Common/CMakeLists.txt
  lldb/source/CMakeLists.txt
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/docs/CMake.rst


Index: llvm/docs/CMake.rst
===================================================================
--- llvm/docs/CMake.rst
+++ llvm/docs/CMake.rst
@@ -272,7 +272,7 @@
   Generate build targets for the LLVM benchmarks. Defaults to ON.
 
 **LLVM_APPEND_VC_REV**:BOOL
-  Embed version control revision info (svn revision number or Git revision id).
+  Embed version control revision info (Git revision id).
   The version info is provided by the ``LLVM_REVISION`` macro in
   ``llvm/include/llvm/Support/VCSRevision.h``. Developers using git who don't
   need revision info can disable this option to avoid re-linking most binaries
Index: llvm/cmake/modules/LLVMConfig.cmake.in
===================================================================
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -78,6 +78,8 @@
 set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@")
 set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
 
+set(LLVM_APPEND_VC_REV "@LLVM_APPEND_VC_REV@")
+
 # These variables are duplicated for install tree but they have different
 # values for build tree.  LLVM_INCLUDE_DIRS contains both source
 # and generated include directories while the following variables have
Index: lldb/source/CMakeLists.txt
===================================================================
--- lldb/source/CMakeLists.txt
+++ lldb/source/CMakeLists.txt
@@ -18,14 +18,14 @@
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
 set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(lldb_vc)
+if(lldb_vc AND LLVM_APPEND_VC_REV)
   set(lldb_source_dir ${LLDB_SOURCE_DIR})
 endif()
 
 add_custom_command(OUTPUT "${version_inc}"
   DEPENDS "${lldb_vc}" "${generate_vcs_version_script}"
   COMMAND ${CMAKE_COMMAND} "-DNAMES=LLDB"
-                           "-DLLDB_SOURCE_DIR=${LLDB_SOURCE_DIR}"
+                           "-DLLDB_SOURCE_DIR=${lldb_source_dir}"
                            "-DHEADER_FILE=${version_inc}"
                            -P "${generate_vcs_version_script}")
 
Index: lld/Common/CMakeLists.txt
===================================================================
--- lld/Common/CMakeLists.txt
+++ lld/Common/CMakeLists.txt
@@ -8,14 +8,14 @@
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
 set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(lld_vc)
+if(lld_vc AND LLVM_APPEND_VC_REV)
   set(lld_source_dir ${LLD_SOURCE_DIR})
 endif()
 
 add_custom_command(OUTPUT "${version_inc}"
   DEPENDS "${lld_vc}" "${generate_vcs_version_script}"
   COMMAND ${CMAKE_COMMAND} "-DNAMES=LLD"
-  "-DLLD_SOURCE_DIR=${LLD_SOURCE_DIR}"
+  "-DLLD_SOURCE_DIR=${lld_source_dir}"
   "-DHEADER_FILE=${version_inc}"
   -P "${generate_vcs_version_script}")
 
Index: clang/lib/Basic/CMakeLists.txt
===================================================================
--- clang/lib/Basic/CMakeLists.txt
+++ clang/lib/Basic/CMakeLists.txt
@@ -12,10 +12,10 @@
 
 set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
 
-if(llvm_vc)
+if(llvm_vc AND LLVM_APPEND_VC_REV)
   set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
 endif()
-if(clang_vc)
+if(clang_vc AND LLVM_APPEND_VC_REV)
   set(clang_source_dir ${CLANG_SOURCE_DIR})
 endif()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72855.238512.patch
Type: text/x-patch
Size: 3273 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200116/8f4b7a19/attachment.bin>


More information about the lldb-commits mailing list