Skip to content

Commit 7621b76

Browse files
authored
Merge pull request #67468 from apple/maxd/wasi-sysroot
build: Add support for `wasi-sysroot` option in build-script `wasi-sysroot` allows providing a path to a custom libc that supports this platform.
2 parents 0457451 + bfa7260 commit 7621b76

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

utils/build-script-impl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,16 @@ KNOWN_SETTINGS=(
116116
darwin-toolchain-require-use-os-runtime "0" "When setting up a plist for a toolchain, require the users of the toolchain to link against the OS instead of the packaged toolchain runtime. 0 for false, 1 for true"
117117
darwin-xcrun-toolchain "default" "the name of the toolchain to use on Darwin"
118118

119+
## WebAssembly/WASI Options
120+
wasi-sysroot "" "An absolute path to the wasi-sysroot that will be used as a libc implementation for Wasm builds"
121+
119122
## Build Types for Components
120123
swift-stdlib-build-type "Debug" "the CMake build variant for Swift"
121124

122125
## Skip Build ...
123126
skip-build "" "set to configure as usual while skipping the build step"
124127
skip-build-android "" "set to skip building Swift stdlibs for Android"
128+
skip-build-wasm "" "set to skip building Swift stdlibs for WebAssembly"
125129
skip-build-benchmarks "" "set to skip building Swift Benchmark Suite"
126130
skip-build-clang-tools-extra "" "set to skip building clang-tools-extra as part of llvm"
127131
skip-build-compiler-rt "" "set to skip building Compiler-RT"
@@ -1741,6 +1745,13 @@ for host in "${ALL_HOSTS[@]}"; do
17411745
)
17421746
fi
17431747

1748+
if [[ ! "${SKIP_BUILD_WASM}" ]]; then
1749+
cmake_options=(
1750+
"${cmake_options[@]}"
1751+
-DSWIFT_WASI_SYSROOT_PATH:STRING="${WASI_SYSROOT}"
1752+
)
1753+
fi
1754+
17441755
if [[ $(is_cross_tools_host ${host}) && "${host}" == "openbsd-"* && -n "${OPENBSD_USE_TOOLCHAIN_FILE}" ]]; then
17451756
cmake_options=(
17461757
"${cmake_options[@]}"

utils/swift_build_support/swift_build_support/host_specific_configuration.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ def __platforms_to_skip_build(self, args, stage_dependent_args):
260260
StdlibDeploymentTarget.AppleWatchSimulator)
261261
if not stage_dependent_args.build_android:
262262
platforms_to_skip_build.add(StdlibDeploymentTarget.Android)
263+
if not args.build_wasm:
264+
platforms_to_skip_build.add(StdlibDeploymentTarget.WASI)
263265
return platforms_to_skip_build
264266

265267
def __platforms_to_skip_test(self, args, stage_dependent_args):

0 commit comments

Comments
 (0)