Skip to content

Commit 9c2f9d2

Browse files
committed
wasm_cc_binary: Specify a default OS. Allow users to override platform.
Problem: proxy-wasm/proxy-wasm-cpp-sdk#157 (comment) This is solving the problem in two different ways. Please let me know your thoughts about both approaches, as either will work. Signed-off-by: Martijn Stevenson <[email protected]>
1 parent a896e3d commit 9c2f9d2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

bazel/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,6 @@ platform(
8282
name = "platform_wasm",
8383
constraint_values = [
8484
"@platforms//cpu:wasm32",
85+
"@platforms//os:wasi",
8586
],
8687
)

bazel/emscripten_toolchain/wasm_cc_binary.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _wasm_transition_impl(settings, attr):
3535
"//command_line_option:features": features,
3636
"//command_line_option:dynamic_mode": "off",
3737
"//command_line_option:linkopt": linkopts,
38-
"//command_line_option:platforms": ["@emsdk//:platform_wasm"],
38+
"//command_line_option:platforms": [attr.platform],
3939
"//command_line_option:custom_malloc": "@emsdk//emscripten_toolchain:malloc",
4040
}
4141

@@ -82,6 +82,9 @@ _WASM_BINARY_COMMON_ATTRS = {
8282
"exit_runtime": attr.bool(
8383
default = False,
8484
),
85+
"platform": attr.label(
86+
default = "@emsdk//:platform_wasm",
87+
),
8588
"threads": attr.string(
8689
default = "_default",
8790
values = ["_default", "emscripten", "off"],

0 commit comments

Comments
 (0)