diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -282,24 +282,10 @@ 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(FATAL_ERROR "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 @@ 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 --- a/libcxx/docs/BuildingLibcxx.rst +++ b/libcxx/docs/BuildingLibcxx.rst @@ -136,7 +136,7 @@ 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 --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -72,3 +72,8 @@ - Support for standalone builds have been entirely removed from libc++, libc++abi and libunwind. Please use :ref:`these 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 --- a/libcxx/lib/abi/CMakeLists.txt +++ b/libcxx/lib/abi/CMakeLists.txt @@ -50,8 +50,13 @@ 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 --- a/libcxx/test/CMakeLists.txt +++ b/libcxx/test/CMakeLists.txt @@ -104,8 +104,10 @@ 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 --- a/libcxx/test/configs/legacy.cfg.in +++ b/libcxx/test/configs/legacy.cfg.in @@ -17,8 +17,8 @@ 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 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -123,24 +123,10 @@ "Define suffix of library directory name (32/64)") option(LIBCXXABI_INSTALL_LIBRARY "Install the libc++abi library." ON) -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(FATAL_ERROR "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 @@ -284,15 +270,6 @@ 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 --- a/libcxxabi/test/CMakeLists.txt +++ b/libcxxabi/test/CMakeLists.txt @@ -85,8 +85,10 @@ 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 --- a/libcxxabi/test/lit.site.cfg.in +++ b/libcxxabi/test/lit.site.cfg.in @@ -24,8 +24,8 @@ 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 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -88,16 +88,6 @@ 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_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(FATAL_ERROR "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 @@ # 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 --- a/libunwind/docs/BuildingLibunwind.rst +++ b/libunwind/docs/BuildingLibunwind.rst @@ -142,18 +142,6 @@ 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 --- a/libunwind/test/CMakeLists.txt +++ b/libunwind/test/CMakeLists.txt @@ -36,8 +36,10 @@ 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 --- a/libunwind/test/lit.site.cfg.in +++ b/libunwind/test/lit.site.cfg.in @@ -25,8 +25,8 @@ 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@