Skip to content

Commit 2e5e72b

Browse files
committed
[build] Add a new --cross-compile-build-swift-tools flag to disable cross-compiling the compiler (#38441)
This is useful when building cross-compilation toolchains where you want the stdlib and corelibs cross-compiled but don't want the Swift compiler cross-compiled too with `--cross-compile-hosts`.
1 parent 9f6a172 commit 2e5e72b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

utils/build-script-impl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ KNOWN_SETTINGS=(
292292
cross-compile-install-prefixes "" "semicolon-separated list of install prefixes to use for the cross-compiled hosts. The list expands, so if there are more cross-compile hosts than prefixes, unmatched hosts use the last prefix in the list"
293293
cross-compile-deps-path "" "path for CMake to look for cross-compiled library dependencies, such as libXML2"
294294
cross-compile-append-host-target-to-destdir "1" "turns on appending the host target name of each cross-compiled toolchain to its install-destdir, to keep them separate from the natively-built toolchain"
295+
cross-compile-build-swift-tools "1" "set to 1 to cross-compile the Swift host tools, like the Swift compiler"
295296
skip-merge-lipo-cross-compile-tools "" "set to skip running merge-lipo after installing cross-compiled host Swift tools"
296297
coverage-db "" "If set, coverage database to use when prioritizing testing"
297298
skip-local-host-install "" "If we are cross-compiling multiple targets, skip an install pass locally if the hosts match"
@@ -1707,6 +1708,12 @@ for host in "${ALL_HOSTS[@]}"; do
17071708
"${cmake_options[@]}"
17081709
-DLLVM_TABLEGEN=$(build_directory "${LOCAL_HOST}" llvm)/bin/llvm-tblgen
17091710
-DSWIFT_INCLUDE_TEST_BINARIES:BOOL=FALSE
1711+
-DSWIFT_INCLUDE_TOOLS:BOOL=$(true_false "${CROSS_COMPILE_BUILD_SWIFT_TOOLS}")
1712+
)
1713+
else
1714+
cmake_options=(
1715+
"${cmake_options[@]}"
1716+
-DSWIFT_INCLUDE_TOOLS:BOOL=$(true_false "${BUILD_SWIFT_TOOLS}")
17101717
)
17111718
fi
17121719

@@ -1779,7 +1786,6 @@ for host in "${ALL_HOSTS[@]}"; do
17791786
-DSWIFT_NATIVE_LLVM_TOOLS_PATH:STRING="${native_llvm_tools_path}"
17801787
-DSWIFT_NATIVE_CLANG_TOOLS_PATH:STRING="${native_clang_tools_path}"
17811788
-DSWIFT_NATIVE_SWIFT_TOOLS_PATH:STRING="${native_swift_tools_path}"
1782-
-DSWIFT_INCLUDE_TOOLS:BOOL=$(true_false "${BUILD_SWIFT_TOOLS}")
17831789
-DSWIFT_BUILD_CLANG_OVERLAYS:BOOL=$(true_false "${BUILD_SWIFT_CLANG_OVERLAYS}")
17841790
-DSWIFT_BUILD_REMOTE_MIRROR:BOOL=$(true_false "${BUILD_SWIFT_REMOTE_MIRROR}")
17851791
-DSWIFT_STDLIB_SIL_DEBUGGING:BOOL=$(true_false "${BUILD_SIL_DEBUGGING_STDLIB}")

0 commit comments

Comments
 (0)