[libcxx-commits] [PATCH] D138864: Setting the LLVM_TARGET_TRIPLE macro based on the LLVM_DEFAULT_TARGET_TRIPLE
Nicole Rabjohn via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 28 14:02:47 PST 2022
nicolerabjohn created this revision.
nicolerabjohn added reviewers: daltenty, cebowleratibm, phosek, mstorsjo, mgorny.
Herald added a project: All.
nicolerabjohn requested review of this revision.
Herald added projects: libc++, libc++abi, LLVM.
Herald added subscribers: llvm-commits, libcxx-commits.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.
Due to https://reviews.llvm.org/D137870, LLVM_TARGET_TRIPLE is no longer defined on the runtime path into compiler-rt. This patch creates a common block of code to set LLVM_TARGET_TRIPLE equal to the default for both the llvm- and runtime- paths to compiler-rt.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D138864
Files:
llvm/CMakeLists.txt
llvm/cmake/modules/SetTargetTriple.cmake
runtimes/CMakeLists.txt
Index: runtimes/CMakeLists.txt
===================================================================
--- runtimes/CMakeLists.txt
+++ runtimes/CMakeLists.txt
@@ -169,6 +169,9 @@
# This can be used to detect whether we're in the runtimes build.
set(LLVM_RUNTIMES_BUILD ON)
+include(SetTargetTriple)
+set_llvm_target_triple()
+
foreach(entry ${runtimes})
get_filename_component(projName ${entry} NAME)
Index: llvm/cmake/modules/SetTargetTriple.cmake
===================================================================
--- /dev/null
+++ llvm/cmake/modules/SetTargetTriple.cmake
@@ -0,0 +1,17 @@
+
+# Common code between the runtimes and LLVM entry point when building libatomic
+# To set LLVM_TARGET_TRIPLE based on the default
+
+macro(set_llvm_target_triple)
+ set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE_default}" CACHE STRING
+ "Default target for which LLVM will generate code." )
+ if (TARGET_TRIPLE)
+ message(WARNING "TARGET_TRIPLE is deprecated and will be removed in a future release. "
+ "Please use LLVM_DEFAULT_TARGET_TRIPLE instead.")
+ set(LLVM_TARGET_TRIPLE "${TARGET_TRIPLE}")
+ else()
+ set(LLVM_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
+ endif()
+ message(STATUS "LLVM host triple: ${LLVM_HOST_TRIPLE}")
+ message(STATUS "LLVM default target triple: ${LLVM_DEFAULT_TARGET_TRIPLE}")
+endmacro()
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -865,17 +865,8 @@
endif()
endif()
-set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE_default}" CACHE STRING
- "Default target for which LLVM will generate code." )
-if (TARGET_TRIPLE)
- message(WARNING "TARGET_TRIPLE is deprecated and will be removed in a future release. "
- "Please use LLVM_DEFAULT_TARGET_TRIPLE instead.")
- set(LLVM_TARGET_TRIPLE "${TARGET_TRIPLE}")
-else()
- set(LLVM_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
-endif()
-message(STATUS "LLVM host triple: ${LLVM_HOST_TRIPLE}")
-message(STATUS "LLVM default target triple: ${LLVM_DEFAULT_TARGET_TRIPLE}")
+include(SetTargetTriple)
+set_llvm_target_triple()
if(WIN32 OR CYGWIN)
if(BUILD_SHARED_LIBS OR LLVM_BUILD_LLVM_DYLIB)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138864.478360.patch
Type: text/x-patch
Size: 2248 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221128/5d85aea4/attachment.bin>
More information about the libcxx-commits
mailing list