[PATCH] D64032: [cmake] With utils disabled, don't build tblgen in cross mode
Keno Fischer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 1 13:57:01 PDT 2019
loladiro created this revision.
loladiro added reviewers: smeenai, compnerd, aganea, pzheng.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.
In cross mode, we build a separate NATIVE tblgen that runs on the
host and is used during the build. Separately, we have a flag that
disables building all executables in utils/. Of course generally,
this doesn't turn off tblgen, since we need that during the build.
In cross mode, however, that tblegen is useless since we never
actually use it. Furthermore, it can be actively problematic if the
cross toolchain doesn't like building executables for whatever reason.
And even if building executables works fine, we can at least save
compile time by omitting it from the target build. There's two changes
needed to make this happen:
- Stop creating a dependency from the native tool to the target tool. No such dependency is required for a correct build, so I'm not entirely sure why it was there in the first place.
- If utils were disabled on the CMake command line and we're in cross mode, respect that by excluding it from the install target (using EXCLUDE_FROM_ALL).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D64032
Files:
llvm/cmake/modules/TableGen.cmake
Index: llvm/cmake/modules/TableGen.cmake
===================================================================
--- llvm/cmake/modules/TableGen.cmake
+++ llvm/cmake/modules/TableGen.cmake
@@ -113,9 +113,6 @@
set(LLVM_ENABLE_OBJLIB ON)
endif()
- add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
- set(LLVM_LINK_COMPONENTS ${${target}_OLD_LLVM_LINK_COMPONENTS})
-
set(${project}_TABLEGEN "${target}" CACHE
STRING "Native TableGen executable. Saves building one when cross-compiling.")
@@ -125,7 +122,7 @@
if(LLVM_USE_HOST_TOOLS)
if( ${${project}_TABLEGEN} STREQUAL "${target}" )
- build_native_tool(${target} ${project}_TABLEGEN_EXE DEPENDS ${target})
+ build_native_tool(${target} ${project}_TABLEGEN_EXE)
set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN_EXE} PARENT_SCOPE)
add_custom_target(${project}-tablegen-host DEPENDS ${${project}_TABLEGEN_EXE})
@@ -138,9 +135,18 @@
TARGET LLVM-tablegen-host)
add_dependencies(${project}-tablegen-host LLVM-tablegen-host)
endif()
+
+ # If we're using the host tablegen, and utils were not requested, we have no
+ # need to build this tablegen.
+ if ( NOT LLVM_BUILD_UTILS )
+ set(EXCLUDE_FROM_ALL ON)
+ endif()
endif()
endif()
+ add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
+ set(LLVM_LINK_COMPONENTS ${${target}_OLD_LLVM_LINK_COMPONENTS})
+
if (${project} STREQUAL LLVM AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
set(export_to_llvmexports)
if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64032.207404.patch
Type: text/x-patch
Size: 1607 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190701/34c4eec9/attachment.bin>
More information about the llvm-commits
mailing list