[PATCH] D81877: [CMake] Fix runtimes build for host Windows (default target)

Kristina Bessonova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 15 13:51:56 PDT 2020


krisb created this revision.
krisb added reviewers: phosek, compnerd, plotfi.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.

When building runtimes, the compiler name (e.g. clang, clang-cl) is set based on
`CMAKE_SYSTEM_NAME` passed to `llvm_ExternalProject_Add()` through `CMAKE_ARGS` argument.
This mechanism doesn't work well if the target is Windows host.
`runtime_default_target()`/`builtin_default_target()` doesn't provide a way
to specify `CMAKE_SYSTEM_NAME` and doesn't set it either.

This patch appends variables specified in `RUNTIMES_CMAKE_ARGS`/`BUILTINS_CMAKE_ARGS`
to `CMAKE_ARGS` argument of `llvm_ExternalProject_Add()` in the case of called
from `runtime_default_target()`/`builtin_default_target()` thus in particular
it allows passing CMAKE_SYSTEM_NAME whenever it is required.

As far as I can see from D73811 <https://reviews.llvm.org/D73811> default target doesn't necessarily assume host.
So, this solution might be safer than D73811 <https://reviews.llvm.org/D73811>.

There is an alternative approach for this problem at D80866 <https://reviews.llvm.org/D80866> (which looks
more vague and unclear).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81877

Files:
  llvm/runtimes/CMakeLists.txt


Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -245,6 +245,7 @@
                                         -DCMAKE_ASM_COMPILER_TARGET=${TARGET_TRIPLE}
                                         -DCMAKE_C_COMPILER_WORKS=ON
                                         -DCMAKE_ASM_COMPILER_WORKS=ON
+                                        ${BUILTINS_CMAKE_ARGS}
                              PASSTHROUGH_PREFIXES COMPILER_RT
                              USE_TOOLCHAIN
                              ${EXTRA_ARGS})
@@ -395,6 +396,7 @@
                                         -DCMAKE_C_COMPILER_WORKS=ON
                                         -DCMAKE_CXX_COMPILER_WORKS=ON
                                         -DCMAKE_ASM_COMPILER_WORKS=ON
+                                        ${RUNTIMES_CMAKE_ARGS}
                              PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
                                                   ${ARG_PREFIXES}
                              EXTRA_TARGETS ${extra_targets}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81877.270852.patch
Type: text/x-patch
Size: 1127 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200615/3b3b7a93/attachment.bin>


More information about the llvm-commits mailing list