2008-10-26 08:47:52 +08:00
|
|
|
# Returns the host triple.
|
|
|
|
# Invokes config.guess
|
|
|
|
|
2012-01-25 02:00:44 +08:00
|
|
|
function( get_host_triple var )
|
2008-10-26 08:47:52 +08:00
|
|
|
if( MSVC )
|
2021-08-06 16:36:21 +08:00
|
|
|
if( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM64.*" )
|
|
|
|
set( value "aarch64-pc-windows-msvc" )
|
|
|
|
elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM.*" )
|
|
|
|
set( value "armv7-pc-windows-msvc" )
|
|
|
|
elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "x64" )
|
|
|
|
set( value "x86_64-pc-windows-msvc" )
|
|
|
|
elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "X86" )
|
|
|
|
set( value "i686-pc-windows-msvc" )
|
|
|
|
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
2018-08-09 10:16:18 +08:00
|
|
|
set( value "x86_64-pc-windows-msvc" )
|
2009-08-12 08:04:12 +08:00
|
|
|
else()
|
2018-08-09 10:16:18 +08:00
|
|
|
set( value "i686-pc-windows-msvc" )
|
2009-08-12 08:04:12 +08:00
|
|
|
endif()
|
2009-08-17 04:50:41 +08:00
|
|
|
elseif( MINGW AND NOT MSYS )
|
2021-08-06 16:36:21 +08:00
|
|
|
# CMake doesn't provide COMPILER_ARCHITECTURE_ID for Clang/GCC,
|
|
|
|
# but it does for MSVC.
|
|
|
|
if( CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "ARM.*" )
|
|
|
|
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
|
|
|
set( value "aarch64-w64-windows-gnu" )
|
|
|
|
else()
|
2021-08-11 19:06:28 +08:00
|
|
|
set( value "armv7-w64-windows-gnu" )
|
2021-08-06 16:36:21 +08:00
|
|
|
endif()
|
2010-10-14 04:15:08 +08:00
|
|
|
else()
|
2021-08-06 16:36:21 +08:00
|
|
|
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
|
|
|
set( value "x86_64-w64-windows-gnu" )
|
|
|
|
else()
|
2021-08-11 19:06:28 +08:00
|
|
|
set( value "i686-w64-windows-gnu" )
|
2021-08-06 16:36:21 +08:00
|
|
|
endif()
|
2010-10-14 04:15:08 +08:00
|
|
|
endif()
|
2020-07-09 20:17:33 +08:00
|
|
|
elseif( CMAKE_SYSTEM_NAME MATCHES "OS390" )
|
|
|
|
set( value "s390x-ibm-zos" )
|
|
|
|
elseif( CMAKE_SYSTEM_NAME STREQUAL AIX )
|
2020-02-21 04:39:16 +08:00
|
|
|
# We defer to dynamic detection of the host AIX version.
|
|
|
|
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
|
|
|
|
set( value "powerpc64-ibm-aix" )
|
|
|
|
else()
|
|
|
|
set( value "powerpc-ibm-aix" )
|
|
|
|
endif()
|
2008-10-26 08:47:52 +08:00
|
|
|
else( MSVC )
|
2019-06-27 06:07:43 +08:00
|
|
|
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS)
|
2019-06-15 00:47:04 +08:00
|
|
|
message(WARNING "unable to determine host target triple")
|
|
|
|
else()
|
|
|
|
set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess)
|
|
|
|
execute_process(COMMAND sh ${config_guess}
|
|
|
|
RESULT_VARIABLE TT_RV
|
|
|
|
OUTPUT_VARIABLE TT_OUT
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
if( NOT TT_RV EQUAL 0 )
|
|
|
|
message(FATAL_ERROR "Failed to execute ${config_guess}")
|
|
|
|
endif( NOT TT_RV EQUAL 0 )
|
2020-02-21 04:39:16 +08:00
|
|
|
set( value ${TT_OUT} )
|
2019-06-15 00:47:04 +08:00
|
|
|
endif()
|
2008-10-26 08:47:52 +08:00
|
|
|
endif( MSVC )
|
2009-11-08 07:52:27 +08:00
|
|
|
set( ${var} ${value} PARENT_SCOPE )
|
2012-01-25 02:00:44 +08:00
|
|
|
endfunction( get_host_triple var )
|