[libcxx-commits] [libcxx] 395271a - [runtimes] Simplify how we set the target triple

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 16 07:34:03 PDT 2021


Author: Louis Dionne
Date: 2021-07-16T10:33:39-04:00
New Revision: 395271ad11b8c233db1a4e0e6a76aa52e93e5aec

URL: https://github.com/llvm/llvm-project/commit/395271ad11b8c233db1a4e0e6a76aa52e93e5aec
DIFF: https://github.com/llvm/llvm-project/commit/395271ad11b8c233db1a4e0e6a76aa52e93e5aec.diff

LOG: [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 77396bbc98 and 5099e01568, which were reverted in
850b57c5fbe because they broke the build.

Differential Revision: https://reviews.llvm.org/D106009

Added: 
    

Modified: 
    libcxx/CMakeLists.txt
    libcxx/lib/abi/CMakeLists.txt
    libcxx/test/CMakeLists.txt
    libcxxabi/CMakeLists.txt
    libcxxabi/test/CMakeLists.txt
    libunwind/CMakeLists.txt
    libunwind/test/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 3025b6c4f37b..80c240dfc0b0 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -251,7 +251,7 @@ option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
 
 # Target options --------------------------------------------------------------
 option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})
-set(LIBCXX_TARGET_TRIPLE "" CACHE STRING "Use alternate target triple.")
+set(LIBCXX_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING "Use alternate target triple.")
 set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.")
 set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.")
 
@@ -480,10 +480,6 @@ elseif(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN)
   set(LIBCXX_GCC_TOOLCHAIN "${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}")
 endif()
 
-if(LIBCXX_TARGET_TRIPLE)
-  set(TARGET_TRIPLE "${LIBCXX_TARGET_TRIPLE}")
-endif()
-
 # Configure compiler.
 include(config-ix)
 

diff  --git a/libcxx/lib/abi/CMakeLists.txt b/libcxx/lib/abi/CMakeLists.txt
index 3d19c0bd16f2..c406330426d0 100644
--- a/libcxx/lib/abi/CMakeLists.txt
+++ b/libcxx/lib/abi/CMakeLists.txt
@@ -41,7 +41,7 @@ function(cxx_abi_list_identifier result triple abi_library abi_version unstable
 endfunction()
 
 cxx_abi_list_identifier(abi_list_identifier
-  "${TARGET_TRIPLE}"
+  "${LIBCXX_TARGET_TRIPLE}"
   "${LIBCXX_CXX_ABI_LIBNAME}"
   "${LIBCXX_ABI_VERSION}"
   "${LIBCXX_ABI_UNSTABLE}"

diff  --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index df16ab574f67..58e95b8be2a7 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -105,8 +105,8 @@ if (NOT LIBCXX_ENABLE_DEBUG_MODE_SUPPORT)
   serialize_lit_param(enable_debug_tests False)
 endif()
 
-if (TARGET_TRIPLE)
-  serialize_lit_param(target_triple "\"${TARGET_TRIPLE}\"")
+if (LIBCXX_TARGET_TRIPLE)
+  serialize_lit_param(target_triple "\"${LIBCXX_TARGET_TRIPLE}\"")
 endif()
 
 if (LLVM_USE_SANITIZER)

diff  --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index 8c21fc39d185..9fb35860d483 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -111,7 +111,7 @@ option(LIBCXXABI_INCLUDE_TESTS "Generate build targets for the libc++abi unit te
 set(LIBCXXABI_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
     "Define suffix of library directory name (32/64)")
 option(LIBCXXABI_INSTALL_LIBRARY "Install the libc++abi library." ON)
-set(LIBCXXABI_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
+set(LIBCXXABI_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING "Target triple for cross compiling.")
 set(LIBCXXABI_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
 set(LIBCXXABI_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
 set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.")
@@ -273,10 +273,6 @@ elseif(CMAKE_SYSROOT)
   set(LIBCXXABI_SYSROOT "${CMAKE_SYSROOT}")
 endif()
 
-if (LIBCXXABI_TARGET_TRIPLE)
-  set(TARGET_TRIPLE "${LIBCXXABI_TARGET_TRIPLE}")
-endif()
-
 # Configure compiler. Must happen after setting the target flags.
 include(config-ix)
 

diff  --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt
index 526e85204103..a8a97aecba47 100644
--- a/libcxxabi/test/CMakeLists.txt
+++ b/libcxxabi/test/CMakeLists.txt
@@ -86,8 +86,8 @@ if (LLVM_USE_SANITIZER)
   serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
 endif()
 
-if (TARGET_TRIPLE)
-  serialize_lit_param(target_triple "\"${TARGET_TRIPLE}\"")
+if (LIBCXXABI_TARGET_TRIPLE)
+  serialize_lit_param(target_triple "\"${LIBCXXABI_TARGET_TRIPLE}\"")
 endif()
 
 if (LIBCXXABI_BUILD_32_BITS)

diff  --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index 956332889667..81eddbc24879 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -77,7 +77,7 @@ cmake_dependent_option(LIBUNWIND_INSTALL_STATIC_LIBRARY
 cmake_dependent_option(LIBUNWIND_INSTALL_SHARED_LIBRARY
   "Install the shared libunwind library." ON
   "LIBUNWIND_ENABLE_SHARED;LIBUNWIND_INSTALL_LIBRARY" OFF)
-set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
+set(LIBUNWIND_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING "Target triple for cross compiling.")
 set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
 set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
 set(LIBUNWIND_TEST_LINKER_FLAGS "" CACHE STRING
@@ -167,10 +167,6 @@ elseif(CMAKE_SYSROOT)
   set(LIBUNWIND_SYSROOT "${CMAKE_SYSROOT}")
 endif()
 
-if (LIBUNWIND_TARGET_TRIPLE)
-  set(TARGET_TRIPLE "${LIBUNWIND_TARGET_TRIPLE}")
-endif()
-
 # Configure compiler.
 include(config-ix)
 

diff  --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt
index 8e7fa4427104..ae83ea90a8ce 100644
--- a/libunwind/test/CMakeLists.txt
+++ b/libunwind/test/CMakeLists.txt
@@ -36,8 +36,8 @@ if (LLVM_USE_SANITIZER)
   serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
 endif()
 
-if (TARGET_TRIPLE)
-  serialize_lit_param(target_triple "\"${TARGET_TRIPLE}\"")
+if (LIBUNWIND_TARGET_TRIPLE)
+  serialize_lit_param(target_triple "\"${LIBUNWIND_TARGET_TRIPLE}\"")
 endif()
 
 if (LIBUNWIND_BUILD_32_BITS)


        


More information about the libcxx-commits mailing list