2020-09-10 21:42:46 -04:00
|
|
|
load(":crosstool.bzl", "emscripten_cc_toolchain_config_rule")
|
|
|
|
|
|
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
|
name = "common-script-includes",
|
|
|
|
|
srcs = [
|
|
|
|
|
"emar.sh",
|
|
|
|
|
"emcc.sh",
|
|
|
|
|
"emscripten_config",
|
|
|
|
|
"env.sh",
|
2021-03-25 00:50:44 +01:00
|
|
|
"@emsdk//:binaries",
|
|
|
|
|
"@emsdk//:node_modules",
|
2021-10-19 15:56:55 -04:00
|
|
|
"@nodejs//:node_files",
|
2020-09-10 21:42:46 -04:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
|
name = "compile-emscripten",
|
|
|
|
|
srcs = [":common-script-includes"],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
|
name = "link-emscripten",
|
|
|
|
|
srcs = [
|
|
|
|
|
"emcc_link.sh",
|
|
|
|
|
"link_wrapper.py",
|
|
|
|
|
":common-script-includes",
|
2021-03-25 00:50:44 +01:00
|
|
|
"@emsdk//:binaries",
|
2020-09-10 21:42:46 -04:00
|
|
|
"@nodejs//:node_files",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
|
name = "every-file",
|
|
|
|
|
srcs = [
|
|
|
|
|
":compile-emscripten",
|
|
|
|
|
":link-emscripten",
|
2021-03-25 00:50:44 +01:00
|
|
|
"@emsdk//:binaries",
|
2020-09-10 21:42:46 -04:00
|
|
|
"@nodejs//:node_files",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
filegroup(name = "empty")
|
|
|
|
|
|
|
|
|
|
# dlmalloc.bc is implictly added by the emscripten toolchain
|
|
|
|
|
cc_library(name = "malloc")
|
|
|
|
|
|
|
|
|
|
emscripten_cc_toolchain_config_rule(
|
|
|
|
|
name = "wasm",
|
|
|
|
|
cpu = "wasm",
|
2021-03-25 00:50:44 +01:00
|
|
|
em_config = "emscripten_config",
|
|
|
|
|
emscripten_binaries = "@emsdk//:binaries",
|
2020-09-10 21:42:46 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
cc_toolchain(
|
|
|
|
|
name = "cc-compiler-wasm",
|
|
|
|
|
all_files = ":every-file",
|
|
|
|
|
ar_files = ":common-script-includes",
|
|
|
|
|
as_files = ":empty",
|
|
|
|
|
compiler_files = ":compile-emscripten",
|
|
|
|
|
dwp_files = ":empty",
|
|
|
|
|
linker_files = ":link-emscripten",
|
|
|
|
|
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",
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
py_binary(
|
|
|
|
|
name = "wasm_binary",
|
|
|
|
|
srcs = ["wasm_binary.py"],
|
|
|
|
|
)
|