From: Andy Gibbs Date: Wed, 26 Jun 2013 07:57:53 +0000 (+0000) Subject: Support using "host" as a target in LLVM_TARGETS_TO_BUILD when using cmake. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=84bb3a2af228e0ee04d4b872cd0760f74253d3a3;p=oota-llvm.git Support using "host" as a target in LLVM_TARGETS_TO_BUILD when using cmake. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184923 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b313780a41f..895e2f71687 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 5b6172321d2..d0d8531bff3 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -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