mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[wasm] Rename wasm32-unknown-wasi to wasm32-unknown-wasip1
This commit is contained in:
@@ -466,7 +466,7 @@ macro(configure_sdk_unix name architectures)
|
|||||||
if(SWIFT_ENABLE_WASI_THREADS)
|
if(SWIFT_ENABLE_WASI_THREADS)
|
||||||
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasip1-threads")
|
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasip1-threads")
|
||||||
else()
|
else()
|
||||||
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasi")
|
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasip1")
|
||||||
endif()
|
endif()
|
||||||
elseif("${prefix}" STREQUAL "EMSCRIPTEN")
|
elseif("${prefix}" STREQUAL "EMSCRIPTEN")
|
||||||
set(SWIFT_SDK_EMSCRIPTEN_ARCH_${arch}_TRIPLE "${arch}-unknown-emscripten")
|
set(SWIFT_SDK_EMSCRIPTEN_ARCH_${arch}_TRIPLE "${arch}-unknown-emscripten")
|
||||||
|
|||||||
@@ -44,11 +44,12 @@ class WASILibc(product.Product):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def build(self, host_target):
|
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',
|
self._build(host_target, thread_model='posix',
|
||||||
target_triple='wasm32-wasip1-threads')
|
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)
|
build_root = os.path.dirname(self.build_dir)
|
||||||
|
|
||||||
if self.args.build_runtime_with_host_compiler:
|
if self.args.build_runtime_with_host_compiler:
|
||||||
@@ -84,18 +85,6 @@ class WASILibc(product.Product):
|
|||||||
'TARGET_TRIPLE=' + target_triple,
|
'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
|
@classmethod
|
||||||
def get_dependencies(cls):
|
def get_dependencies(cls):
|
||||||
return [llvm.LLVM]
|
return [llvm.LLVM]
|
||||||
@@ -145,7 +134,7 @@ class WasmLLVMRuntimeLibs(cmake_product.CMakeProduct):
|
|||||||
|
|
||||||
def build(self, host_target):
|
def build(self, host_target):
|
||||||
self._build(host_target, enable_wasi_threads=False,
|
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,
|
self._build(host_target, enable_wasi_threads=True,
|
||||||
compiler_rt_os_dir='wasip1', target_triple='wasm32-wasip1-threads')
|
compiler_rt_os_dir='wasip1', target_triple='wasm32-wasip1-threads')
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class WasmStdlib(cmake_product.CMakeProduct):
|
|||||||
return self.args.test_wasmstdlib
|
return self.args.test_wasmstdlib
|
||||||
|
|
||||||
def build(self, host_target):
|
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):
|
def _build(self, host_target, target_triple, short_triple):
|
||||||
llvm_build_dir = self._configure_llvm(target_triple, short_triple)
|
llvm_build_dir = self._configure_llvm(target_triple, short_triple)
|
||||||
@@ -181,10 +181,10 @@ class WasmStdlib(cmake_product.CMakeProduct):
|
|||||||
'SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING', 'TRUE')
|
'SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING', 'TRUE')
|
||||||
self.cmake_options.define(
|
self.cmake_options.define(
|
||||||
'SWIFT_SDK_embedded_ARCH_wasm32_PATH:PATH',
|
'SWIFT_SDK_embedded_ARCH_wasm32_PATH:PATH',
|
||||||
self._wasi_sysroot_path("wasm32-wasi"))
|
self._wasi_sysroot_path("wasm32-wasip1"))
|
||||||
self.cmake_options.define(
|
self.cmake_options.define(
|
||||||
'SWIFT_SDK_embedded_ARCH_wasm32-unknown-wasip1_PATH:PATH',
|
'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()
|
self.add_extra_cmake_options()
|
||||||
|
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ class WasmSwiftSDK(product.Product):
|
|||||||
# and header paths from the sysroot
|
# and header paths from the sysroot
|
||||||
# https://github.com/llvm/llvm-project/blob/73ef397fcba35b7b4239c00bf3e0b4e689ca0add/clang/lib/Driver/ToolChains/WebAssembly.cpp#L29-L36
|
# 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 [
|
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
|
# TODO: Include p1-threads in the Swift SDK once sdk-generator supports multi-target SDK
|
||||||
('wasm32-unknown-wasip1-threads', 'wasm32-wasip1-threads',
|
('wasm32-unknown-wasip1-threads', 'wasm32-wasip1-threads',
|
||||||
'wasmthreadsstdlib', False, True),
|
'wasmthreadsstdlib', False, True),
|
||||||
|
|||||||
Reference in New Issue
Block a user