Skip to content

Commit 7bb6282

Browse files
committed
Copy WasmKit to install_destdir
This enables `swift run` and `swift test` to use WasmKit when cross-compiling to Wasm with Swift SDKs that have toolsets pointing to WasmKit.
1 parent ea74546 commit 7bb6282

File tree

1 file changed

+10
-5
lines changed
  • utils/swift_build_support/swift_build_support/products

1 file changed

+10
-5
lines changed

utils/swift_build_support/swift_build_support/products/wasmkit.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,24 @@ def should_test(self, host_target):
4747

4848
def should_install(self, host_target):
4949
# Currently, it's only used for testing stdlib.
50-
return False
50+
return True
5151

5252
def install(self, host_target):
53-
pass
53+
"""
54+
Install WasmKit to the target location
55+
"""
56+
install_destdir = self.host_install_destdir(host_target)
57+
build_toolchain_path = install_destdir + self.args.install_prefix + '/bin'
58+
shutil.copy(self.bin_path, build_toolchain_path)
5459

5560
def build(self, host_target):
56-
bin_path = run_swift_build(host_target, self, 'wasmkit-cli')
57-
print("Built wasmkit-cli at: " + bin_path)
61+
self.bin_path = run_swift_build(host_target, self, 'wasmkit-cli')
62+
print("Built wasmkit-cli at: " + self.bin_path)
5863
# Copy the built binary to ./bin
5964
dest_bin_path = self.__class__.cli_file_path(self.build_dir)
6065
print("Copying wasmkit-cli to: " + dest_bin_path)
6166
os.makedirs(os.path.dirname(dest_bin_path), exist_ok=True)
62-
shutil.copy(bin_path, dest_bin_path)
67+
shutil.copy(self.bin_path, dest_bin_path)
6368

6469
@classmethod
6570
def cli_file_path(cls, build_dir):

0 commit comments

Comments
 (0)