[PATCH] D41580: CMAKE: Add flags to skip building NATIVE tools

Martell Malone via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 26 03:09:50 PST 2017


martell created this revision.
martell added reviewers: compnerd, rnk, pcc.
Herald added a subscriber: mgorny.

When cross compiling llvm and clang there is a native step where we build 
llvm-config llvm-tblgen and clang-tblgen for the host compiler.

When someone in doing this in a stage process they may already have these tool and wish to opt to use the existing ones instead.
This adds support for 3 new optional cmake flags to disable building of the native steps with the expectation of having them on the PATH already.

HAVE_NATIVE_LLVM_CONFIG
HAVE_NATIVE_LLVM_TABLEGEN
HAVE_NATIVE_CLANG_TABLEGEN


Repository:
  rL LLVM

https://reviews.llvm.org/D41580

Files:
  cmake/modules/TableGen.cmake
  tools/llvm-config/CMakeLists.txt


Index: tools/llvm-config/CMakeLists.txt
===================================================================
--- tools/llvm-config/CMakeLists.txt
+++ tools/llvm-config/CMakeLists.txt
@@ -64,7 +64,7 @@
 # Add the dependency on the generation step.
 add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.cpp ${BUILDVARIABLES_OBJPATH})
 
-if(CMAKE_CROSSCOMPILING)
+if(CMAKE_CROSSCOMPILING AND NOT HAVE_NATIVE_LLVM_CONFIG)
   set(${project}_LLVM_CONFIG_EXE "${LLVM_NATIVE_BUILD}/bin/llvm-config")
   set(${project}_LLVM_CONFIG_EXE ${${project}_LLVM_CONFIG_EXE} PARENT_SCOPE)
 
Index: cmake/modules/TableGen.cmake
===================================================================
--- cmake/modules/TableGen.cmake
+++ cmake/modules/TableGen.cmake
@@ -146,7 +146,7 @@
   set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN} PARENT_SCOPE)
   set(${project}_TABLEGEN_TARGET ${${project}_TABLEGEN} PARENT_SCOPE)
 
-  if(LLVM_USE_HOST_TOOLS)
+  if(LLVM_USE_HOST_TOOLS AND NOT HAVE_NATIVE_${project}_TABLEGEN)
     if( ${${project}_TABLEGEN} STREQUAL "${target}" )
       if (NOT CMAKE_CONFIGURATION_TYPES)
         set(${project}_TABLEGEN_EXE "${LLVM_NATIVE_BUILD}/bin/${target}")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41580.128160.patch
Type: text/x-patch
Size: 1177 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171226/9b29de08/attachment.bin>


More information about the llvm-commits mailing list