aboutsummaryrefslogtreecommitdiff
path: root/libcxx
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2021-07-26 11:27:53 -0400
committerLouis Dionne <ldionne.2@gmail.com>2021-07-26 15:04:45 -0400
commit069428b6f73bdfb7bba13d461a2f57beb86b6aa7 (patch)
treeab46eb7ac226c32013b8c07a829a92dc2038df80 /libcxx
parent0fb16d5ad126a14213ceee6b20b86c721ea49d4e (diff)
downloadllvm-069428b6f73bdfb7bba13d461a2f57beb86b6aa7.zip
llvm-069428b6f73bdfb7bba13d461a2f57beb86b6aa7.tar.gz
llvm-069428b6f73bdfb7bba13d461a2f57beb86b6aa7.tar.bz2
[libc++] Set the target triple by default in the standalone build
Even though the standalone build is deprecated, some people are still relying on it (including libc++ itself for some configurations). Setting the target triple will ensure that the build and the test suite behaves consistently in the standalone and normal builds. Differential Revision: https://reviews.llvm.org/D106800
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake6
-rw-r--r--libcxx/utils/libcxx/test/dsl.py16
-rw-r--r--libcxx/utils/libcxx/test/params.py2
3 files changed, 7 insertions, 17 deletions
diff --git a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
index a355fdf..ad2820b 100644
--- a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
+++ b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
@@ -26,6 +26,12 @@ endif()
message(STATUS "Configuring for standalone build.")
+# By default, we target the host, but this can be overridden at CMake invocation time.
+include(GetHostTriple)
+get_host_triple(LLVM_INFERRED_HOST_TRIPLE)
+set(LLVM_HOST_TRIPLE "${LLVM_INFERRED_HOST_TRIPLE}" CACHE STRING "Host on which LLVM binaries will run")
+set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}" CACHE STRING "Target triple used by default.")
+
# Add LLVM Functions --------------------------------------------------------
if (WIN32)
set(LLVM_ON_UNIX 0)
diff --git a/libcxx/utils/libcxx/test/dsl.py b/libcxx/utils/libcxx/test/dsl.py
index 64988e1..3f2b5b7 100644
--- a/libcxx/utils/libcxx/test/dsl.py
+++ b/libcxx/utils/libcxx/test/dsl.py
@@ -210,22 +210,6 @@ def featureTestMacros(config, flags=''):
allMacros = compilerMacros(config, flags)
return {m: int(v.rstrip('LlUu')) for (m, v) in allMacros.items() if m.startswith('__cpp_')}
-@_memoizeExpensiveOperation(lambda c: (c.substitutions, c.environment))
-def getHostTriple(config):
- """
- Returns the default triple of the compiler.
-
- TODO: This shouldn't be necessary here - ideally the user would always pass
- the triple as a parameter. This is done to support the legacy standalone
- builds, which don't set the triple.
- """
- with _makeConfigTest(config) as test:
- unparsedOutput, err, exitCode, timeoutInfo = _executeScriptInternal(test, [
- "%{cxx} %{flags} %{compile_flags} -dumpmachine"
- ])
- output = re.search(r"# command output:\n(.+)\n", unparsedOutput).group(1)
- return output
-
def _appendToSubstitution(substitutions, key, value):
return [(k, v + ' ' + value) if k == key else (k, v) for (k, v) in substitutions]
diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index 21621aed..ee233e0 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -53,7 +53,7 @@ def getStdFlag(cfg, std):
return None
DEFAULT_PARAMETERS = [
- Parameter(name='target_triple', type=str, default=getHostTriple,
+ Parameter(name='target_triple', type=str,
help="The target triple to compile the test suite for. This must be "
"compatible with the target that the tests will be run on.",
actions=lambda triple: filter(None, [