aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2021-10-12 15:59:08 -0400
committerLouis Dionne <ldionne.2@gmail.com>2022-03-01 08:39:42 -0500
commit3ee0cec88effc88285732c8bec2a8f0e4e37c0b1 (patch)
treec68506c88557c1e93442f77a9c77d5ed128fc614
parent368faacac7525e538fa6680aea74e19a75e3458d (diff)
downloadllvm-3ee0cec88effc88285732c8bec2a8f0e4e37c0b1.zip
llvm-3ee0cec88effc88285732c8bec2a8f0e4e37c0b1.tar.gz
llvm-3ee0cec88effc88285732c8bec2a8f0e4e37c0b1.tar.bz2
[runtimes] Remove FOO_TARGET_TRIPLE, FOO_SYSROOT and FOO_GCC_TOOLCHAIN
Instead, folks can use the equivalent variables provided by CMake to set those. This removal aims to reduce complexity and potential for confusion when setting the target triple for building the runtimes, and make it correct when `CMAKE_OSX_ARCHITECTURES` is used (right now both `-arch` and `--target=` will end up being passed, which is downright incorrect). Differential Revision: https://reviews.llvm.org/D112155
-rw-r--r--libcxx/CMakeLists.txt29
-rw-r--r--libcxx/docs/BuildingLibcxx.rst2
-rw-r--r--libcxx/docs/ReleaseNotes.rst5
-rw-r--r--libcxx/lib/abi/CMakeLists.txt7
-rw-r--r--libcxx/test/CMakeLists.txt6
-rw-r--r--libcxx/test/configs/legacy.cfg.in4
-rw-r--r--libcxxabi/CMakeLists.txt29
-rw-r--r--libcxxabi/test/CMakeLists.txt6
-rw-r--r--libcxxabi/test/lit.site.cfg.in4
-rw-r--r--libunwind/CMakeLists.txt33
-rw-r--r--libunwind/docs/BuildingLibunwind.rst12
-rw-r--r--libunwind/test/CMakeLists.txt6
-rw-r--r--libunwind/test/lit.site.cfg.in4
13 files changed, 41 insertions, 106 deletions
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index c966341..df7a630 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -282,24 +282,10 @@ if (LIBCXX_BUILD_32_BITS)
message(FATAL_ERROR "LIBCXX_BUILD_32_BITS is not supported anymore when building the runtimes, please specify a full triple instead.")
endif()
-if(NOT CMAKE_SYSROOT AND LIBCXX_SYSROOT)
- message(WARNING "LIBCXX_SYSROOT is deprecated, please use CMAKE_SYSROOT instead")
+# TODO: Remove this after branching for LLVM 15
+if(LIBCXX_SYSROOT OR LIBCXX_TARGET_TRIPLE OR LIBCXX_GCC_TOOLCHAIN)
+ message(WARNING "LIBCXX_SYSROOT, LIBCXX_TARGET_TRIPLE and LIBCXX_GCC_TOOLCHAIN are not supported anymore, please use the native CMake equivalents instead")
endif()
-if(NOT CMAKE_CXX_COMPILER_TARGET AND LIBCXX_TARGET_TRIPLE)
- message(WARNING "LIBCXX_TARGET_TRIPLE is deprecated, please use CMAKE_CXX_COMPILER_TARGET instead")
-endif()
-if(NOT CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN AND LIBCXX_GCC_TOOLCHAIN)
- message(WARNING "LIBCXX_GCC_TOOLCHAIN is deprecated, please use CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN instead")
-endif()
-
-if(CMAKE_CXX_COMPILER_TARGET)
- set(LIBCXX_DEFAULT_TARGET_TRIPLE "${CMAKE_CXX_COMPILER_TARGET}")
-else()
- set(LIBCXX_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
-endif()
-set(LIBCXX_TARGET_TRIPLE "${LIBCXX_DEFAULT_TARGET_TRIPLE}" CACHE STRING "Use alternate target triple.")
-set(LIBCXX_SYSROOT "${CMAKE_SYSROOT}" CACHE STRING "Use alternate sysroot.")
-set(LIBCXX_GCC_TOOLCHAIN "${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}" CACHE STRING "Use alternate GCC toolchain.")
# Feature options -------------------------------------------------------------
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
@@ -494,15 +480,6 @@ include(HandleLibcxxFlags)
if(ZOS)
add_target_flags_if_supported("-fzos-le-char-mode=ebcdic")
endif()
-if(LIBCXX_TARGET_TRIPLE)
- add_target_flags_if_supported("--target=${LIBCXX_TARGET_TRIPLE}")
-endif()
-if(LIBCXX_SYSROOT)
- add_target_flags_if_supported("--sysroot=${LIBCXX_SYSROOT}")
-endif()
-if(LIBCXX_GCC_TOOLCHAIN)
- add_target_flags_if_supported("--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
-endif()
# Configure compiler.
include(config-ix)
diff --git a/libcxx/docs/BuildingLibcxx.rst b/libcxx/docs/BuildingLibcxx.rst
index 0e536cc..aa26a22 100644
--- a/libcxx/docs/BuildingLibcxx.rst
+++ b/libcxx/docs/BuildingLibcxx.rst
@@ -136,7 +136,7 @@ In either case, then run:
If you are running in an MSYS2 shell and you have installed the
MSYS2-provided clang package (which defaults to a non-MSVC target), you
-should add e.g. ``-DLIBCXX_TARGET_TRIPLE=x86_64-windows-msvc`` (replacing
+should add e.g. ``-DCMAKE_CXX_COMPILER_TARGET=x86_64-windows-msvc`` (replacing
``x86_64`` with the architecture you're targeting) to the ``cmake`` command
line above. This will instruct ``check-cxx`` to use the right target triple
when invoking ``clang++``.
diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst
index 4228067..eb85502 100644
--- a/libcxx/docs/ReleaseNotes.rst
+++ b/libcxx/docs/ReleaseNotes.rst
@@ -79,3 +79,8 @@ Build System Changes
- Support for standalone builds have been entirely removed from libc++, libc++abi and
libunwind. Please use :ref:`these instructions <build instructions>` for building
libc++, libc++abi and/or libunwind.
+
+- The ``{LIBCXX,LIBCXXABI,LIBUNWIND}_TARGET_TRIPLE``, ``{LIBCXX,LIBCXXABI,LIBUNWIND}_SYSROOT`` and
+ ``{LIBCXX,LIBCXXABI,LIBUNWIND}_GCC_TOOLCHAIN`` CMake variables have been removed. Instead, please
+ use the ``CMAKE_CXX_COMPILER_TARGET``, ``CMAKE_SYSROOT`` and ``CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN``
+ variables provided by CMake.
diff --git a/libcxx/lib/abi/CMakeLists.txt b/libcxx/lib/abi/CMakeLists.txt
index 421600a..a2d41e1 100644
--- a/libcxx/lib/abi/CMakeLists.txt
+++ b/libcxx/lib/abi/CMakeLists.txt
@@ -50,8 +50,13 @@ function(cxx_abi_list_identifier result triple abi_library abi_version unstable
set(${result} "${tmp}" PARENT_SCOPE)
endfunction()
+if (CMAKE_CXX_COMPILER_TARGET)
+ set(triple "${CMAKE_CXX_COMPILER_TARGET}")
+else()
+ set(triple "${LLVM_DEFAULT_TARGET_TRIPLE}")
+endif()
cxx_abi_list_identifier(abi_list_identifier
- "${LIBCXX_TARGET_TRIPLE}"
+ "${triple}"
"${LIBCXX_CXX_ABI_LIBNAME}"
"${LIBCXX_ABI_VERSION}"
"${LIBCXX_ABI_UNSTABLE}"
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index 1375bf4..1c9445b 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -104,8 +104,10 @@ if (NOT LIBCXX_ENABLE_DEBUG_MODE_SUPPORT)
serialize_lit_param(enable_debug_tests False)
endif()
-if (LIBCXX_TARGET_TRIPLE)
- serialize_lit_param(target_triple "\"${LIBCXX_TARGET_TRIPLE}\"")
+if (CMAKE_CXX_COMPILER_TARGET)
+ serialize_lit_param(target_triple "\"${CMAKE_CXX_COMPILER_TARGET}\"")
+else()
+ serialize_lit_param(target_triple "\"${LLVM_DEFAULT_TARGET_TRIPLE}\"")
endif()
if (LLVM_USE_SANITIZER)
diff --git a/libcxx/test/configs/legacy.cfg.in b/libcxx/test/configs/legacy.cfg.in
index a131978..cf36837 100644
--- a/libcxx/test/configs/legacy.cfg.in
+++ b/libcxx/test/configs/legacy.cfg.in
@@ -17,8 +17,8 @@ config.enable_shared = @LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX@
config.cxx_abi = "@LIBCXX_CXX_ABI_LIBNAME@"
config.configuration_variant = "@LIBCXX_LIT_VARIANT@"
config.host_triple = "@LLVM_HOST_TRIPLE@"
-config.sysroot = "@LIBCXX_SYSROOT@"
-config.gcc_toolchain = "@LIBCXX_GCC_TOOLCHAIN@"
+config.sysroot = "@CMAKE_SYSROOT@"
+config.gcc_toolchain = "@CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN@"
config.generate_coverage = @LIBCXX_GENERATE_COVERAGE@
config.target_info = "@LIBCXX_TARGET_INFO@"
config.test_linker_flags = "@LIBCXX_TEST_LINKER_FLAGS@"
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index ebda5a4..a7e8444 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -125,24 +125,10 @@ option(LIBCXXABI_INSTALL_HEADERS "Install the libc++abi headers." ON)
option(LIBCXXABI_INSTALL_LIBRARY "Install the libc++abi library." ON)
set(LIBCXXABI_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH "Path to install the libc++abi headers at.")
-if(NOT CMAKE_SYSROOT AND LIBCXXABI_SYSROOT)
- message(WARNING "LIBCXXABI_SYSROOT is deprecated, please use CMAKE_SYSROOT instead")
+# TODO: Remove this after branching for LLVM 15
+if(LIBCXXABI_SYSROOT OR LIBCXXABI_TARGET_TRIPLE OR LIBCXXABI_GCC_TOOLCHAIN)
+ message(WARNING "LIBCXXABI_SYSROOT, LIBCXXABI_TARGET_TRIPLE and LIBCXXABI_GCC_TOOLCHAIN are not supported anymore, please use the native CMake equivalents instead")
endif()
-if(NOT CMAKE_CXX_COMPILER_TARGET AND LIBCXXABI_TARGET_TRIPLE)
- message(WARNING "LIBCXXABI_TARGET_TRIPLE is deprecated, please use CMAKE_CXX_COMPILER_TARGET instead")
-endif()
-if(NOT CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN AND LIBCXXABI_GCC_TOOLCHAIN)
- message(WARNING "LIBCXXABI_GCC_TOOLCHAIN is deprecated, please use CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN instead")
-endif()
-
-if(CMAKE_CXX_COMPILER_TARGET)
- set(LIBCXXABI_DEFAULT_TARGET_TRIPLE "${CMAKE_CXX_COMPILER_TARGET}")
-else()
- set(LIBCXXABI_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
-endif()
-set(LIBCXXABI_TARGET_TRIPLE "${LIBCXXABI_DEFAULT_TARGET_TRIPLE}" CACHE STRING "Target triple for cross compiling.")
-set(LIBCXXABI_GCC_TOOLCHAIN "${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}" CACHE PATH "GCC toolchain for cross compiling.")
-set(LIBCXXABI_SYSROOT "${CMAKE_SYSROOT}" CACHE PATH "Sysroot for cross compiling.")
set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.")
set(LIBCXXABI_LIBRARY_VERSION "1.0" CACHE STRING
@@ -286,15 +272,6 @@ include(HandleLibcxxabiFlags)
if(ZOS)
add_target_flags_if_supported("-fzos-le-char-mode=ebcdic")
endif()
-if(LIBCXXABI_TARGET_TRIPLE)
- add_target_flags_if_supported("--target=${LIBCXXABI_TARGET_TRIPLE}")
-endif()
-if(LIBCXXABI_GCC_TOOLCHAIN)
- add_target_flags_if_supported("--gcc-toolchain=${LIBCXXABI_GCC_TOOLCHAIN}")
-endif()
-if(LIBCXXABI_SYSROOT)
- add_target_flags_if_supported("--sysroot=${LIBCXXABI_SYSROOT}")
-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 57b5fcc..608e5f3 100644
--- a/libcxxabi/test/CMakeLists.txt
+++ b/libcxxabi/test/CMakeLists.txt
@@ -85,8 +85,10 @@ if (LLVM_USE_SANITIZER)
serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
endif()
-if (LIBCXXABI_TARGET_TRIPLE)
- serialize_lit_param(target_triple "\"${LIBCXXABI_TARGET_TRIPLE}\"")
+if (CMAKE_CXX_COMPILER_TARGET)
+ serialize_lit_param(target_triple "\"${CMAKE_CXX_COMPILER_TARGET}\"")
+else()
+ serialize_lit_param(target_triple "\"${LLVM_DEFAULT_TARGET_TRIPLE}\"")
endif()
foreach(param IN LISTS LIBCXXABI_TEST_PARAMS)
diff --git a/libcxxabi/test/lit.site.cfg.in b/libcxxabi/test/lit.site.cfg.in
index 585e03e..ae387f5 100644
--- a/libcxxabi/test/lit.site.cfg.in
+++ b/libcxxabi/test/lit.site.cfg.in
@@ -24,8 +24,8 @@ config.executor = "@LIBCXXABI_EXECUTOR@"
config.libcxxabi_shared = @LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI@
config.enable_shared = @LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX@
config.host_triple = "@LLVM_HOST_TRIPLE@"
-config.sysroot = "@LIBCXXABI_SYSROOT@"
-config.gcc_toolchain = "@LIBCXXABI_GCC_TOOLCHAIN@"
+config.sysroot = "@CMAKE_SYSROOT@"
+config.gcc_toolchain = "@CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN@"
config.cxx_ext_threads = @LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY@
config.pstl_src_root = "@ParallelSTL_SOURCE_DIR@" if @LIBCXX_ENABLE_PARALLEL_ALGORITHMS@ else None
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index 1960813c..068074c 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -88,16 +88,6 @@ option(LIBUNWIND_USE_FRAME_HEADER_CACHE "Cache frame headers for unwinding. Requ
option(LIBUNWIND_REMEMBER_HEAP_ALLOC "Use heap instead of the stack for .cfi_remember_state." OFF)
option(LIBUNWIND_INSTALL_HEADERS "Install the libunwind headers." OFF)
-if(NOT CMAKE_SYSROOT AND LIBUNWIND_SYSROOT)
- message(WARNING "LIBUNWIND_SYSROOT is deprecated, please use CMAKE_SYSROOT instead")
-endif()
-if(NOT CMAKE_CXX_COMPILER_TARGET AND LIBUNWIND_TARGET_TRIPLE)
- message(WARNING "LIBUNWIND_TARGET_TRIPLE is deprecated, please use CMAKE_CXX_COMPILER_TARGET instead")
-endif()
-if(NOT CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN AND LIBUNWIND_GCC_TOOLCHAIN)
- message(WARNING "LIBUNWIND_GCC_TOOLCHAIN is deprecated, please use CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN instead")
-endif()
-
set(LIBUNWIND_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
"Define suffix of library directory name (32/64)")
option(LIBUNWIND_INSTALL_LIBRARY "Install the libunwind library." ON)
@@ -107,19 +97,16 @@ 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)
-if(CMAKE_CXX_COMPILER_TARGET)
- set(LIBUNWIND_DEFAULT_TARGET_TRIPLE "${CMAKE_CXX_COMPILER_TARGET}")
-else()
- set(LIBUNWIND_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
-endif()
-set(LIBUNWIND_TARGET_TRIPLE "${LIBUNWIND_DEFAULT_TARGET_TRIPLE}" CACHE STRING "Target triple for cross compiling.")
-set(LIBUNWIND_GCC_TOOLCHAIN "${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}" CACHE PATH "GCC toolchain for cross compiling.")
-set(LIBUNWIND_SYSROOT "${CMAKE_SYSROOT}" CACHE PATH "Sysroot for cross compiling.")
set(LIBUNWIND_TEST_LINKER_FLAGS "" CACHE STRING
"Additional linker flags for test programs.")
set(LIBUNWIND_TEST_COMPILER_FLAGS "" CACHE STRING
"Additional compiler flags for test programs.")
+# TODO: Remove this after branching for LLVM 15
+if(LIBUNWIND_SYSROOT OR LIBUNWIND_TARGET_TRIPLE OR LIBUNWIND_GCC_TOOLCHAIN)
+ message(WARNING "LIBUNWIND_SYSROOT, LIBUNWIND_TARGET_TRIPLE and LIBUNWIND_GCC_TOOLCHAIN are not supported anymore, please use the native CMake equivalents instead")
+endif()
+
if (LIBUNWIND_ENABLE_SHARED)
set(LIBUNWIND_DEFAULT_TEST_CONFIG "llvm-libunwind-shared.cfg.in")
else()
@@ -200,16 +187,6 @@ include(HandleLibunwindFlags)
# tests here now.
set(CMAKE_TRY_COMPILE_TARGET_TYPE_ORIG ${CMAKE_TRY_COMPILE_TARGET_TYPE})
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
-
-if(LIBUNWIND_TARGET_TRIPLE)
- add_target_flags_if_supported("--target=${LIBUNWIND_TARGET_TRIPLE}")
-endif()
-if(LIBUNWIND_GCC_TOOLCHAIN)
- add_target_flags_if_supported("--gcc-toolchain=${LIBUNWIND_GCC_TOOLCHAIN}")
-endif()
-if(LIBUNWIND_SYSROOT)
- add_target_flags_if_supported("--sysroot=${LIBUNWIND_SYSROOT}")
-endif()
set(CMAKE_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE_ORIG})
# Configure compiler.
diff --git a/libunwind/docs/BuildingLibunwind.rst b/libunwind/docs/BuildingLibunwind.rst
index 99e52761..79166b4 100644
--- a/libunwind/docs/BuildingLibunwind.rst
+++ b/libunwind/docs/BuildingLibunwind.rst
@@ -142,18 +142,6 @@ libunwind specific options
Build libunwind with threading support.
-.. option:: LIBUNWIND_TARGET_TRIPLE:STRING
-
- Target triple for cross compiling
-
-.. option:: LIBUNWIND_GCC_TOOLCHAIN:PATH
-
- GCC toolchain for cross compiling
-
-.. option:: LIBUNWIND_SYSROOT
-
- Sysroot for cross compiling
-
.. option:: LIBUNWIND_INSTALL_LIBRARY_DIR:PATH
**Default**: ``lib${LIBUNWIND_LIBDIR_SUFFIX}``
diff --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt
index 7e86d50..736b692 100644
--- a/libunwind/test/CMakeLists.txt
+++ b/libunwind/test/CMakeLists.txt
@@ -36,8 +36,10 @@ if (LLVM_USE_SANITIZER)
serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
endif()
-if (LIBUNWIND_TARGET_TRIPLE)
- serialize_lit_param(target_triple "\"${LIBUNWIND_TARGET_TRIPLE}\"")
+if (CMAKE_CXX_COMPILER_TARGET)
+ serialize_lit_param(target_triple "\"${CMAKE_CXX_COMPILER_TARGET}\"")
+else()
+ serialize_lit_param(target_triple "\"${LLVM_DEFAULT_TARGET_TRIPLE}\"")
endif()
foreach(param IN LISTS LIBUNWIND_TEST_PARAMS)
diff --git a/libunwind/test/lit.site.cfg.in b/libunwind/test/lit.site.cfg.in
index 4fd633f..9fb3240 100644
--- a/libunwind/test/lit.site.cfg.in
+++ b/libunwind/test/lit.site.cfg.in
@@ -25,8 +25,8 @@ config.libunwind_shared = @LIBUNWIND_ENABLE_SHARED@
config.enable_shared = @LIBCXX_ENABLE_SHARED@
config.arm_ehabi = @LIBUNWIND_USES_ARM_EHABI@
config.host_triple = "@LLVM_HOST_TRIPLE@"
-config.sysroot = "@LIBUNWIND_SYSROOT@"
-config.gcc_toolchain = "@LIBUNWIND_GCC_TOOLCHAIN@"
+config.sysroot = "@CMAKE_SYSROOT@"
+config.gcc_toolchain = "@CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN@"
config.cxx_ext_threads = @LIBUNWIND_BUILD_EXTERNAL_THREAD_LIBRARY@
config.x86_cet = @LIBUNWIND_ENABLE_CET@