Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Commit 395271a

Browse files
committed
[runtimes] Simplify how we set the target triple
Instead of using TARGET_TRIPLE, which is always set to LLVM_DEFAULT_TARGET_TRIPLE, use that variable directly to populate the various XXXX_TARGET_TRIPLE variables in the runtimes. This re-applies 77396bb and 5099e01, which were reverted in 850b57c because they broke the build. Differential Revision: https://reviews.llvm.org/D106009
1 parent ba627a3 commit 395271a

File tree

7 files changed

+10
-22
lines changed

7 files changed

+10
-22
lines changed

libcxx/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
251251

252252
# Target options --------------------------------------------------------------
253253
option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})
254-
set(LIBCXX_TARGET_TRIPLE "" CACHE STRING "Use alternate target triple.")
254+
set(LIBCXX_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING "Use alternate target triple.")
255255
set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.")
256256
set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.")
257257

@@ -480,10 +480,6 @@ elseif(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN)
480480
set(LIBCXX_GCC_TOOLCHAIN "${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}")
481481
endif()
482482

483-
if(LIBCXX_TARGET_TRIPLE)
484-
set(TARGET_TRIPLE "${LIBCXX_TARGET_TRIPLE}")
485-
endif()
486-
487483
# Configure compiler.
488484
include(config-ix)
489485

libcxx/lib/abi/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function(cxx_abi_list_identifier result triple abi_library abi_version unstable
4141
endfunction()
4242

4343
cxx_abi_list_identifier(abi_list_identifier
44-
"${TARGET_TRIPLE}"
44+
"${LIBCXX_TARGET_TRIPLE}"
4545
"${LIBCXX_CXX_ABI_LIBNAME}"
4646
"${LIBCXX_ABI_VERSION}"
4747
"${LIBCXX_ABI_UNSTABLE}"

libcxx/test/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ if (NOT LIBCXX_ENABLE_DEBUG_MODE_SUPPORT)
105105
serialize_lit_param(enable_debug_tests False)
106106
endif()
107107

108-
if (TARGET_TRIPLE)
109-
serialize_lit_param(target_triple "\"${TARGET_TRIPLE}\"")
108+
if (LIBCXX_TARGET_TRIPLE)
109+
serialize_lit_param(target_triple "\"${LIBCXX_TARGET_TRIPLE}\"")
110110
endif()
111111

112112
if (LLVM_USE_SANITIZER)

libcxxabi/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ option(LIBCXXABI_INCLUDE_TESTS "Generate build targets for the libc++abi unit te
111111
set(LIBCXXABI_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
112112
"Define suffix of library directory name (32/64)")
113113
option(LIBCXXABI_INSTALL_LIBRARY "Install the libc++abi library." ON)
114-
set(LIBCXXABI_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
114+
set(LIBCXXABI_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING "Target triple for cross compiling.")
115115
set(LIBCXXABI_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
116116
set(LIBCXXABI_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
117117
set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.")
@@ -273,10 +273,6 @@ elseif(CMAKE_SYSROOT)
273273
set(LIBCXXABI_SYSROOT "${CMAKE_SYSROOT}")
274274
endif()
275275

276-
if (LIBCXXABI_TARGET_TRIPLE)
277-
set(TARGET_TRIPLE "${LIBCXXABI_TARGET_TRIPLE}")
278-
endif()
279-
280276
# Configure compiler. Must happen after setting the target flags.
281277
include(config-ix)
282278

libcxxabi/test/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ if (LLVM_USE_SANITIZER)
8686
serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
8787
endif()
8888

89-
if (TARGET_TRIPLE)
90-
serialize_lit_param(target_triple "\"${TARGET_TRIPLE}\"")
89+
if (LIBCXXABI_TARGET_TRIPLE)
90+
serialize_lit_param(target_triple "\"${LIBCXXABI_TARGET_TRIPLE}\"")
9191
endif()
9292

9393
if (LIBCXXABI_BUILD_32_BITS)

libunwind/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ cmake_dependent_option(LIBUNWIND_INSTALL_STATIC_LIBRARY
7777
cmake_dependent_option(LIBUNWIND_INSTALL_SHARED_LIBRARY
7878
"Install the shared libunwind library." ON
7979
"LIBUNWIND_ENABLE_SHARED;LIBUNWIND_INSTALL_LIBRARY" OFF)
80-
set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
80+
set(LIBUNWIND_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING "Target triple for cross compiling.")
8181
set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
8282
set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
8383
set(LIBUNWIND_TEST_LINKER_FLAGS "" CACHE STRING
@@ -167,10 +167,6 @@ elseif(CMAKE_SYSROOT)
167167
set(LIBUNWIND_SYSROOT "${CMAKE_SYSROOT}")
168168
endif()
169169

170-
if (LIBUNWIND_TARGET_TRIPLE)
171-
set(TARGET_TRIPLE "${LIBUNWIND_TARGET_TRIPLE}")
172-
endif()
173-
174170
# Configure compiler.
175171
include(config-ix)
176172

libunwind/test/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ if (LLVM_USE_SANITIZER)
3636
serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
3737
endif()
3838

39-
if (TARGET_TRIPLE)
40-
serialize_lit_param(target_triple "\"${TARGET_TRIPLE}\"")
39+
if (LIBUNWIND_TARGET_TRIPLE)
40+
serialize_lit_param(target_triple "\"${LIBUNWIND_TARGET_TRIPLE}\"")
4141
endif()
4242

4343
if (LIBUNWIND_BUILD_32_BITS)

0 commit comments

Comments
 (0)