[llvm] r184923 - Support using "host" as a target in LLVM_TARGETS_TO_BUILD when using cmake.

Andy Gibbs andyg1001 at hotmail.co.uk
Wed Jun 26 00:57:54 PDT 2013


Author: andyg
Date: Wed Jun 26 02:57:53 2013
New Revision: 184923

URL: http://llvm.org/viewvc/llvm-project?rev=184923&view=rev
Log:
Support using "host" as a target in LLVM_TARGETS_TO_BUILD when using cmake.

Modified:
    llvm/trunk/CMakeLists.txt
    llvm/trunk/cmake/config-ix.cmake

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=184923&r1=184922&r2=184923&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Wed Jun 26 02:57:53 2013
@@ -137,18 +137,6 @@ set(LLVM_TARGETS_TO_BUILD
    ${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD})
 list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD)
 
-set(LLVM_ENUM_TARGETS "")
-foreach(c ${LLVM_TARGETS_TO_BUILD})
-  list(FIND LLVM_ALL_TARGETS ${c} idx)
-  list(FIND LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ${c} idy)
-  if( idx LESS 0 AND idy LESS 0 )
-    message(FATAL_ERROR "The target `${c}' does not exist.
-    It should be one of\n${LLVM_ALL_TARGETS}")
-  else()
-    set(LLVM_ENUM_TARGETS "${LLVM_ENUM_TARGETS}LLVM_TARGET(${c})\n")
-  endif()
-endforeach(c)
-
 set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm)
 
 include(AddLLVMDefinitions)
@@ -322,11 +310,22 @@ include(${LLVMBUILDCMAKEFRAG})
 
 # Configure all of the various header file fragments LLVM uses which depend on
 # configuration variables.
+set(LLVM_ENUM_TARGETS "")
 set(LLVM_ENUM_ASM_PRINTERS "")
 set(LLVM_ENUM_ASM_PARSERS "")
 set(LLVM_ENUM_DISASSEMBLERS "")
 foreach(t ${LLVM_TARGETS_TO_BUILD})
   set( td ${LLVM_MAIN_SRC_DIR}/lib/Target/${t} )
+
+  list(FIND LLVM_ALL_TARGETS ${t} idx)
+  list(FIND LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ${t} idy)
+  if( idx LESS 0 AND idy LESS 0 )
+    message(FATAL_ERROR "The target `${t}' does not exist.
+    It should be one of\n${LLVM_ALL_TARGETS}")
+  else()
+    set(LLVM_ENUM_TARGETS "${LLVM_ENUM_TARGETS}LLVM_TARGET(${t})\n")
+  endif()
+
   file(GLOB asmp_file "${td}/*AsmPrinter.cpp")
   if( asmp_file )
     set(LLVM_ENUM_ASM_PRINTERS

Modified: llvm/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=184923&r1=184922&r2=184923&view=diff
==============================================================================
--- llvm/trunk/cmake/config-ix.cmake (original)
+++ llvm/trunk/cmake/config-ix.cmake Wed Jun 26 02:57:53 2013
@@ -384,6 +384,14 @@ else ()
   message(FATAL_ERROR "Unknown architecture ${LLVM_NATIVE_ARCH}")
 endif ()
 
+# If build targets includes "host", then replace with native architecture.
+list(FIND LLVM_TARGETS_TO_BUILD "host" idx)
+if( NOT idx LESS 0 )
+  list(REMOVE_AT LLVM_TARGETS_TO_BUILD ${idx})
+  list(APPEND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH})
+  list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD)
+endif()
+
 list(FIND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH} NATIVE_ARCH_IDX)
 if (NATIVE_ARCH_IDX EQUAL -1)
   message(STATUS





More information about the llvm-commits mailing list