Skip to content

Commit

Permalink
Add standalone_wasm feature to bazel emscripten_toolchain (#1145)
Browse files Browse the repository at this point in the history
  • Loading branch information
robbertvanginkel authored Dec 6, 2022
1 parent 32fba7b commit bd7842e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bazel/emscripten_toolchain/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ def _impl(ctx):
name = "output_format_js",
enabled = True,
),
feature(
name = "wasm_standalone",
),
]

crosstool_default_flag_sets = [
Expand Down Expand Up @@ -1015,6 +1018,11 @@ def _impl(ctx):
flags = ["-Werror"],
features = ["wasm_warnings_as_errors"],
),
flag_set(
actions = all_link_actions,
flags = ["-sSTANDALONE_WASM"],
features = ["wasm_standalone"],
),
]

crosstool_default_env_sets = [
Expand Down
6 changes: 6 additions & 0 deletions bazel/emscripten_toolchain/wasm_cc_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def _wasm_transition_impl(settings, attr):
if attr.simd:
features.append("wasm_simd")

if attr.standalone:
features.append("wasm_standalone")

return {
"//command_line_option:compiler": "emscripten",
"//command_line_option:crosstool_top": "@emsdk//emscripten_toolchain:everything",
Expand Down Expand Up @@ -86,6 +89,9 @@ _WASM_BINARY_COMMON_ATTRS = {
"simd": attr.bool(
default = False,
),
"standalone": attr.bool(
default = False,
),
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
Expand Down

0 comments on commit bd7842e

Please sign in to comment.