[libcxx-commits] [PATCH] D106800: [libc++] Set the target triple by default in the standalone build

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 26 12:05:09 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG069428b6f73b: [libc++] Set the target triple by default in the standalone build (authored by ldionne).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106800/new/

https://reviews.llvm.org/D106800

Files:
  libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
  libcxx/utils/libcxx/test/dsl.py
  libcxx/utils/libcxx/test/params.py


Index: libcxx/utils/libcxx/test/params.py
===================================================================
--- libcxx/utils/libcxx/test/params.py
+++ libcxx/utils/libcxx/test/params.py
@@ -53,7 +53,7 @@
   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, [
Index: libcxx/utils/libcxx/test/dsl.py
===================================================================
--- libcxx/utils/libcxx/test/dsl.py
+++ libcxx/utils/libcxx/test/dsl.py
@@ -210,22 +210,6 @@
   allMacros = compilerMacros(config, flags)
   return {m: int(v.rstrip('LlUu')) for (m, v) in allMacros.items() if m.startswith('__cpp_')}
 
- at _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]
 
Index: libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
===================================================================
--- libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
+++ libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
@@ -26,6 +26,12 @@
 
 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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106800.361746.patch
Type: text/x-patch
Size: 2491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210726/c8eb2389/attachment-0001.bin>


More information about the libcxx-commits mailing list