[llvm] f4a4c63 - llvmbuildectomy - support disabled native target

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 06:50:41 PST 2020


Author: serge-sans-paille
Date: 2020-11-13T15:50:13+01:00
New Revision: f4a4c63588d4d784f42a94591c46b72bec64a415

URL: https://github.com/llvm/llvm-project/commit/f4a4c63588d4d784f42a94591c46b72bec64a415
DIFF: https://github.com/llvm/llvm-project/commit/f4a4c63588d4d784f42a94591c46b72bec64a415.diff

LOG: llvmbuildectomy - support disabled native target

Added: 
    

Modified: 
    llvm/cmake/modules/LLVM-Build.cmake
    llvm/lib/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/LLVM-Build.cmake b/llvm/cmake/modules/LLVM-Build.cmake
index 746f09b09019..ce56273c5a1d 100644
--- a/llvm/cmake/modules/LLVM-Build.cmake
+++ b/llvm/cmake/modules/LLVM-Build.cmake
@@ -81,13 +81,21 @@ endfunction()
 
 # Resolve cross-component dependencies, for each available component.
 function(LLVMBuildResolveComponentsLink)
-  get_property(llvm_components GLOBAL PROPERTY LLVM_COMPONENT_LIBS)
-  get_property(llvm_has_jit_native TARGET ${LLVM_NATIVE_ARCH} PROPERTY LLVM_HAS_JIT)
+
+  # the native target may not be enabled when cross compiling
+  if(TARGET ${LLVM_NATIVE_ARCH})
+    get_property(llvm_has_jit_native TARGET ${LLVM_NATIVE_ARCH} PROPERTY LLVM_HAS_JIT)
+  else()
+    set(llvm_has_jit_native OFF)
+  endif()
+
   if(llvm_has_jit_native)
     set_property(TARGET Engine APPEND PROPERTY LLVM_LINK_COMPONENTS "MCJIT" "Native")
   else()
     set_property(TARGET Engine APPEND PROPERTY LLVM_LINK_COMPONENTS "Interpreter")
   endif()
+
+  get_property(llvm_components GLOBAL PROPERTY LLVM_COMPONENT_LIBS)
   foreach(llvm_component ${llvm_components})
     get_property(link_components TARGET ${llvm_component} PROPERTY LLVM_LINK_COMPONENTS)
     llvm_map_components_to_libnames(llvm_libs ${link_components})

diff  --git a/llvm/lib/CMakeLists.txt b/llvm/lib/CMakeLists.txt
index 9425efab94a9..e2093f1dd327 100644
--- a/llvm/lib/CMakeLists.txt
+++ b/llvm/lib/CMakeLists.txt
@@ -1,13 +1,5 @@
 include(LLVM-Build)
 
-# Special components which don't have any source attached but aggregate other
-# components
-add_llvm_component_group(all-targets LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD})
-add_llvm_component_group(Engine)
-add_llvm_component_group(Native LINK_COMPONENTS ${LLVM_NATIVE_ARCH})
-add_llvm_component_group(NativeCodeGen LINK_COMPONENTS ${LLVM_NATIVE_ARCH}CodeGen)
-
-
 # `Demangle', `Support' and `TableGen' libraries are added on the top-level
 # CMakeLists.txt
 
@@ -50,5 +42,20 @@ add_subdirectory(WindowsManifest)
 
 set(LLVMCONFIGLIBRARYDEPENDENCIESINC "${LLVM_BINARY_DIR}/tools/llvm-config/LibraryDependencies.inc")
 
+# Special components which don't have any source attached but aggregate other
+# components
+add_llvm_component_group(all-targets LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD})
+add_llvm_component_group(Engine)
+
+# The native target may not be enabled when cross compiling
+if(TARGET ${LLVM_NATIVE_ARCH})
+  add_llvm_component_group(Native LINK_COMPONENTS ${LLVM_NATIVE_ARCH})
+  add_llvm_component_group(NativeCodeGen LINK_COMPONENTS ${LLVM_NATIVE_ARCH}CodeGen)
+else()
+  add_llvm_component_group(Native)
+  add_llvm_component_group(NativeCodeGen)
+endif()
+
+# Component post-processing
 LLVMBuildResolveComponentsLink()
 LLVMBuildGenerateCFragment(OUTPUT ${LLVMCONFIGLIBRARYDEPENDENCIESINC})


        


More information about the llvm-commits mailing list