Skip to content

Commit bd7842e

Browse files
Add standalone_wasm feature to bazel emscripten_toolchain (#1145)
1 parent 32fba7b commit bd7842e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

bazel/emscripten_toolchain/toolchain.bzl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,9 @@ def _impl(ctx):
441441
name = "output_format_js",
442442
enabled = True,
443443
),
444+
feature(
445+
name = "wasm_standalone",
446+
),
444447
]
445448

446449
crosstool_default_flag_sets = [
@@ -1015,6 +1018,11 @@ def _impl(ctx):
10151018
flags = ["-Werror"],
10161019
features = ["wasm_warnings_as_errors"],
10171020
),
1021+
flag_set(
1022+
actions = all_link_actions,
1023+
flags = ["-sSTANDALONE_WASM"],
1024+
features = ["wasm_standalone"],
1025+
),
10181026
]
10191027

10201028
crosstool_default_env_sets = [

bazel/emscripten_toolchain/wasm_cc_binary.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ def _wasm_transition_impl(settings, attr):
2525
if attr.simd:
2626
features.append("wasm_simd")
2727

28+
if attr.standalone:
29+
features.append("wasm_standalone")
30+
2831
return {
2932
"//command_line_option:compiler": "emscripten",
3033
"//command_line_option:crosstool_top": "@emsdk//emscripten_toolchain:everything",
@@ -86,6 +89,9 @@ _WASM_BINARY_COMMON_ATTRS = {
8689
"simd": attr.bool(
8790
default = False,
8891
),
92+
"standalone": attr.bool(
93+
default = False,
94+
),
8995
"_allowlist_function_transition": attr.label(
9096
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
9197
),

0 commit comments

Comments
 (0)