Skip to content

Commit aedbdc7

Browse files
[wasm] Enable building Swift SDK for wasm32-unknown-wasip1-threads
1 parent 749e9ee commit aedbdc7

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

utils/swift_build_support/swift_build_support/products/wasmswiftsdk.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,13 @@ def build(self, host_target):
120120
# and header paths from the sysroot
121121
# https://github.com/llvm/llvm-project/blob/73ef397fcba35b7b4239c00bf3e0b4e689ca0add/clang/lib/Driver/ToolChains/WebAssembly.cpp#L29-L36
122122
# 3. short_triple: The triple used by build-script to name the build directory
123-
for swift_host_triple, clang_multiarch_triple, short_triple, build_basename in [
124-
('wasm32-unknown-wasi', 'wasm32-wasi', 'wasi-wasm32', 'wasmstdlib'),
125-
# TODO: Enable threads stdlib once sdk-generator supports multi-target SDK
126-
# ('wasm32-unknown-wasip1-threads', 'wasm32-wasip1-threads',
127-
# 'wasip1-threads-wasm32', 'wasmthreadsstdlib'),
123+
for swift_host_triple, clang_multiarch_triple, short_triple, build_basename, build_sdk in [
124+
('wasm32-unknown-wasi', 'wasm32-wasi',
125+
'wasi-wasm32', 'wasmstdlib', True),
126+
# FIXME: Enable build_sdk for threads once we will be able to
127+
# unify Swift SDK archive for threads and non-threads.
128+
('wasm32-unknown-wasip1-threads', 'wasm32-wasip1-threads',
129+
'wasip1-threads-wasm32', 'wasmthreadsstdlib', False),
128130
]:
129131
stdlib_build_path = os.path.join(
130132
build_root, '%s-%s' % (build_basename, host_target))
@@ -133,7 +135,8 @@ def build(self, host_target):
133135
package_path = self._build_target_package(
134136
swift_host_triple, short_triple, stdlib_build_path,
135137
llvm_runtime_libs_build_path, wasi_sysroot)
136-
target_packages.append((swift_host_triple, wasi_sysroot, package_path))
138+
if build_sdk:
139+
target_packages.append((swift_host_triple, wasi_sysroot, package_path))
137140

138141
swiftc_path = os.path.abspath(self.toolchain.swiftc)
139142
toolchain_path = os.path.dirname(os.path.dirname(swiftc_path))

0 commit comments

Comments
 (0)