Skip to content

Commit 92dd843

Browse files
authored
Fix building Wasm stdlib with macOS presets (#80850)
Added optional `ignore_extra_cmake_options` to `cmake_product.py`, existing behavior is preserved with the default argument value set to `False`. Passed `ignore_extra_cmake_options=True` in `wasisysroot.py`. This allows libc++ for WASI to be built correctly with `-fno-exceptions` in presence of `extra-cmake-options` in macOS presets (which are absent in Linux presets).
1 parent 1a84348 commit 92dd843

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

utils/swift_build_support/swift_build_support/products/cmake_product.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def is_verbose(self):
2424
return self.args.verbose_build
2525

2626
def build_with_cmake(self, build_targets, build_type, build_args,
27-
prefer_native_toolchain=False):
27+
prefer_native_toolchain=False,
28+
ignore_extra_cmake_options=False):
2829
assert self.toolchain.cmake is not None
2930
cmake_build = []
3031
_cmake = cmake.CMake(self.args, self.toolchain,
@@ -67,7 +68,8 @@ def build_with_cmake(self, build_targets, build_type, build_args,
6768
shell.call(["env"] + [self.toolchain.cmake]
6869
+ list(_cmake.common_options(self))
6970
+ list(self.cmake_options)
70-
+ self.args.extra_cmake_options + [self.source_dir],
71+
+ (self.args.extra_cmake_options if not ignore_extra_cmake_options else [])
72+
+ [self.source_dir],
7173
env=env)
7274

7375
is_llvm = self.product_name() == "llvm"

utils/swift_build_support/swift_build_support/products/wasisysroot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ def _build(self, host_target, enable_wasi_threads, compiler_rt_os_dir, target_tr
230230
cmake.cmake_options.define('UNIX:BOOL', 'TRUE')
231231

232232
cmake.build_with_cmake([], cmake.args.build_variant, [],
233-
prefer_native_toolchain=True)
233+
prefer_native_toolchain=True,
234+
ignore_extra_cmake_options=True)
234235
cmake.install_with_cmake(
235236
["install"], WASILibc.sysroot_install_path(build_root, target_triple))
236237

0 commit comments

Comments
 (0)