llvm.org GIT mirror llvm / 579e43a
CMake: GetTargetTriple: new module for determining the target triple. Assign to LLVM_HOSTTRIPLE so it figures in config.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58176 91177308-0d34-0410-b5e6-96231b3b80d8 Oscar Fuentes 10 years ago
4 changed file(s) with 30 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
5050 check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
5151 check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
5252 check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
53
54 include(GetTargetTriple)
55 get_target_triple(LLVM_HOSTTRIPLE)
56 message(STATUS "LLVM_HOSTTRIPLE: ${LLVM_HOSTTRIPLE}")
5357
5458 if( MINGW )
5559 # tbi: Comprobar que existen las librerias:
0 # Returns the host triple.
1 # Invokes config.guess
2
3 function( get_target_triple var )
4 if( MSVC )
5 set( ${var} "i686-pc-win32" PARENT_SCOPE )
6 else( MSVC )
7 set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess)
8 execute_process(COMMAND sh ${config_guess}
9 RESULT_VARIABLE TT_RV
10 OUTPUT_VARIABLE TT_OUT
11 OUTPUT_STRIP_TRAILING_WHITESPACE)
12 if( NOT TT_RV EQUAL 0 )
13 message(FATAL_ERROR "Failed to execute ${config_guess}")
14 endif( NOT TT_RV EQUAL 0 )
15 set( ${var} ${TT_OUT} PARENT_SCOPE )
16 message(STATUS "Target triple: ${${var}}")
17 endif( MSVC )
18 endfunction( get_target_triple var )
438438
439439 /* Installation directory for config files */
440440 #undef LLVM_ETCDIR
441
442 /* Host triple we were built on */
443 #cmakedefine LLVM_HOSTTRIPLE "${LLVM_HOSTTRIPLE}"
441444
442445 /* Installation directory for include files */
443446 #undef LLVM_INCLUDEDIR
2828 #EXEEXT already set.
2929 set(OS "${CMAKE_SYSTEM}")
3030 set(ARCH "X86") # TODO: This gives "i686" in Linux: "${CMAKE_SYSTEM_PROCESSOR}")
31 # TODO: avoid using autoconf:
32 set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess)
33 execute_process(COMMAND sh ${config_guess}
34 RESULT_VARIABLE TT_RV
35 OUTPUT_VARIABLE LLVM_TARGET_TRIPLET
36 OUTPUT_STRIP_TRAILING_WHITESPACE)
37 message(STATUS "Target triplet: ${LLVM_TARGET_TRIPLET}")
38 if( NOT TT_RV EQUAL 0 )
39 message(FATAL_ERROR "Failed to execute ${config_guess}")
40 endif( NOT TT_RV EQUAL 0 )
41 set(target ${LLVM_TARGET_TRIPLET})
31
32 include(GetTargetTriple)
33 get_target_triple(target)
34
4235 foreach(c ${LLVM_TARGETS_TO_BUILD})
4336 set(TARGETS_BUILT "${TARGETS_BUILT} ${c}")
4437 endforeach(c)