Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/modules/SwiftConfigureSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ macro(configure_sdk_unix name architectures)
if(SWIFT_ENABLE_WASI_THREADS)
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasip1-threads")
else()
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasi")
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasip1")
endif()
elseif("${prefix}" STREQUAL "EMSCRIPTEN")
set(SWIFT_SDK_EMSCRIPTEN_ARCH_${arch}_TRIPLE "${arch}-unknown-emscripten")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ def should_install(self, host_target):
return False

def build(self, host_target):
self._build(host_target)
self._build(host_target, thread_model='single',
target_triple='wasm32-wasip1')
self._build(host_target, thread_model='posix',
target_triple='wasm32-wasip1-threads')

def _build(self, host_target, thread_model='single', target_triple='wasm32-wasi'):
def _build(self, host_target, thread_model, target_triple):
build_root = os.path.dirname(self.build_dir)

if self.args.build_runtime_with_host_compiler:
Expand Down Expand Up @@ -84,18 +85,6 @@ def _build(self, host_target, thread_model='single', target_triple='wasm32-wasi'
'TARGET_TRIPLE=' + target_triple,
])

if target_triple == "wasm32-wasi":
# Alias wasm32-wasip1 to wasm32-wasi as Embedded modules use
# wasm32-unknown-wasip1 as the target triple.
for subpath in ["lib", "include"]:
dest_path = os.path.join(sysroot_install_path, subpath, "wasm32-wasip1")
if not os.path.exists(dest_path):
shell.symlink("wasm32-wasi", dest_path)

dest_path = os.path.join(sysroot_install_path, "lib", "wasip1")
if not os.path.exists(dest_path):
shell.symlink("wasi", dest_path)

@classmethod
def get_dependencies(cls):
return [llvm.LLVM]
Expand Down Expand Up @@ -145,7 +134,7 @@ def should_install(self, host_target):

def build(self, host_target):
self._build(host_target, enable_wasi_threads=False,
compiler_rt_os_dir='wasi', target_triple='wasm32-wasi')
compiler_rt_os_dir='wasip1', target_triple='wasm32-wasip1')
self._build(host_target, enable_wasi_threads=True,
compiler_rt_os_dir='wasip1', target_triple='wasm32-wasip1-threads')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def should_test(self, host_target):
return self.args.test_wasmstdlib

def build(self, host_target):
self._build(host_target, 'wasm32-wasi', 'wasi-wasm32')
self._build(host_target, 'wasm32-wasip1', 'wasip1-wasm32')

def _build(self, host_target, target_triple, short_triple):
llvm_build_dir = self._configure_llvm(target_triple, short_triple)
Expand Down Expand Up @@ -181,10 +181,10 @@ def _build_stdlib(self, host_target, target_triple, llvm_cmake_dir):
'SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING', 'TRUE')
self.cmake_options.define(
'SWIFT_SDK_embedded_ARCH_wasm32_PATH:PATH',
self._wasi_sysroot_path("wasm32-wasi"))
self._wasi_sysroot_path("wasm32-wasip1"))
self.cmake_options.define(
'SWIFT_SDK_embedded_ARCH_wasm32-unknown-wasip1_PATH:PATH',
self._wasi_sysroot_path("wasm32-wasi"))
self._wasi_sysroot_path("wasm32-wasip1"))

self.add_extra_cmake_options()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def build(self, host_target):
# and header paths from the sysroot
# https://github.com/llvm/llvm-project/blob/73ef397fcba35b7b4239c00bf3e0b4e689ca0add/clang/lib/Driver/ToolChains/WebAssembly.cpp#L29-L36
for swift_host_triple, clang_multiarch_triple, build_basename, build_sdk, has_pthread in [
('wasm32-unknown-wasi', 'wasm32-wasi', 'wasmstdlib', True, False),
('wasm32-unknown-wasip1', 'wasm32-wasip1', 'wasmstdlib', True, False),
# TODO: Include p1-threads in the Swift SDK once sdk-generator supports multi-target SDK
('wasm32-unknown-wasip1-threads', 'wasm32-wasip1-threads',
'wasmthreadsstdlib', False, True),
Expand Down