Files
ci-emsdk/bazel/emscripten_toolchain/BUILD.bazel

105 lines
2.2 KiB
Python
Raw Normal View History

load(":toolchain.bzl", "emscripten_cc_toolchain_config_rule")
2020-09-10 21:42:46 -04:00
package(default_visibility = ["//visibility:public"])
filegroup(
name = "common_files",
2020-09-10 21:42:46 -04:00
srcs = [
"@emscripten_cache//:emscripten_config",
2020-09-10 21:42:46 -04:00
"env.sh",
2021-12-20 11:24:56 -08:00
"env.bat",
"@nodejs//:node_files",
2020-09-10 21:42:46 -04:00
],
)
filegroup(
name = "compiler_files",
srcs = [
"emcc.sh",
"emcc.bat",
"@emsdk//:compiler_files",
":common_files",
],
2020-09-10 21:42:46 -04:00
)
filegroup(
name = "linker_files",
2020-09-10 21:42:46 -04:00
srcs = [
"emcc_link.sh",
2021-12-20 11:24:56 -08:00
"emcc_link.bat",
2020-09-10 21:42:46 -04:00
"link_wrapper.py",
"@emsdk//:linker_files",
":common_files",
2020-09-10 21:42:46 -04:00
],
)
filegroup(
name = "ar_files",
2020-09-10 21:42:46 -04:00
srcs = [
"emar.sh",
"emar.bat",
"@emsdk//:ar_files",
":common_files",
2020-09-10 21:42:46 -04:00
],
)
filegroup(
name = "all_files",
srcs = [
":ar_files",
":compiler_files",
":linker_files",
],
)
2020-09-10 21:42:46 -04:00
filegroup(name = "empty")
# dlmalloc.bc is implicitly added by the emscripten toolchain
2020-09-10 21:42:46 -04:00
cc_library(name = "malloc")
emscripten_cc_toolchain_config_rule(
name = "wasm",
cpu = "wasm",
em_config = "@emscripten_cache//:emscripten_config",
emscripten_binaries = "@emsdk//:compiler_files",
nodejs_bin = "@nodejs//:node",
2021-12-20 11:24:56 -08:00
script_extension = select({
"@bazel_tools//src/conditions:host_windows": "bat",
"//conditions:default": "sh",
}),
2020-09-10 21:42:46 -04:00
)
cc_toolchain(
name = "cc-compiler-wasm",
all_files = ":all_files",
ar_files = ":ar_files",
2020-09-10 21:42:46 -04:00
as_files = ":empty",
compiler_files = ":compiler_files",
2020-09-10 21:42:46 -04:00
dwp_files = ":empty",
linker_files = ":linker_files",
2020-09-10 21:42:46 -04:00
objcopy_files = ":empty",
strip_files = ":empty",
toolchain_config = "wasm",
toolchain_identifier = "emscripten-wasm",
)
cc_toolchain_suite(
name = "everything",
toolchains = {
"wasm": ":cc-compiler-wasm",
"wasm|emscripten": ":cc-compiler-wasm",
},
)
toolchain(
name = "cc-toolchain-wasm",
target_compatible_with = ["@platforms//cpu:wasm32"],
toolchain = ":cc-compiler-wasm",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)
2020-09-10 21:42:46 -04:00
py_binary(
name = "wasm_binary",
srcs = ["wasm_binary.py"],
)