[bazel] Switch to platforms-based toolchain resolution (#1036)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
load(":crosstool.bzl", "emscripten_cc_toolchain_config_rule")
|
||||
load(":toolchain.bzl", "emscripten_cc_toolchain_config_rule")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
@@ -86,6 +86,13 @@ cc_toolchain_suite(
|
||||
},
|
||||
)
|
||||
|
||||
toolchain(
|
||||
name = "cc-toolchain-wasm",
|
||||
target_compatible_with = ["@platforms//cpu:wasm32"],
|
||||
toolchain = ":cc-compiler-wasm",
|
||||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
||||
)
|
||||
|
||||
py_binary(
|
||||
name = "wasm_binary",
|
||||
srcs = ["wasm_binary.py"],
|
||||
|
||||
@@ -1105,7 +1105,7 @@ emscripten_cc_toolchain_config_rule = rule(
|
||||
attrs = {
|
||||
"cpu": attr.string(mandatory = True, values = ["asmjs", "wasm"]),
|
||||
"em_config": attr.label(mandatory = True, allow_single_file = True),
|
||||
"emscripten_binaries": attr.label(mandatory = True),
|
||||
"emscripten_binaries": attr.label(mandatory = True, cfg = "exec"),
|
||||
"script_extension": attr.string(mandatory = True, values = ["sh", "bat"]),
|
||||
},
|
||||
provides = [CcToolchainConfigInfo],
|
||||
@@ -32,7 +32,7 @@ def _wasm_transition_impl(settings, attr):
|
||||
"//command_line_option:features": features,
|
||||
"//command_line_option:dynamic_mode": "off",
|
||||
"//command_line_option:linkopt": linkopts,
|
||||
"//command_line_option:platforms": [],
|
||||
"//command_line_option:platforms": ["@emsdk//:platform_wasm"],
|
||||
"//command_line_option:custom_malloc": "@emsdk//emscripten_toolchain:malloc",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user