[llvm] r364872 - [cmake] With utils disabled, don't build tblgen in cross mode

Keno Fischer via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 16:15:07 PDT 2019


Author: kfischer
Date: Mon Jul  1 16:15:07 2019
New Revision: 364872

URL: http://llvm.org/viewvc/llvm-project?rev=364872&view=rev
Log:
[cmake] With utils disabled, don't build tblgen in cross mode

Summary:
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).

Reviewers: smeenai
Differential Revision: https://reviews.llvm.org/D64032

Modified:
    llvm/trunk/cmake/modules/TableGen.cmake

Modified: llvm/trunk/cmake/modules/TableGen.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=364872&r1=364871&r2=364872&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/TableGen.cmake (original)
+++ llvm/trunk/cmake/modules/TableGen.cmake Mon Jul  1 16:15:07 2019
@@ -125,7 +125,7 @@ macro(add_tablegen target project)
 
   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,6 +138,12 @@ macro(add_tablegen target project)
           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_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL ON)
+      endif()
     endif()
   endif()
 




More information about the llvm-commits mailing list