@@ -17,6 +17,9 @@ emsdk_deps()
17
17
18
18
load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps")
19
19
emsdk_emscripten_deps(emscripten_version = "2.0.31")
20
+
21
+ load("@emsdk//:toolchains.bzl", "register_emscripten_toolchains")
22
+ register_emscripten_toolchains()
20
23
```
21
24
The SHA1 hash in the above ` strip_prefix ` and ` url ` parameters correspond to the git revision of
22
25
[ emsdk 2.0.31] ( https://github.com/emscripten-core/emsdk/releases/tag/2.0.31 ) . To get access to
@@ -26,8 +29,13 @@ parameter of `emsdk_emscripten_deps()`. Supported versions are listed in `revisi
26
29
27
30
## Building
28
31
29
- ### Using wasm_cc_binary (preferred)
30
- First, write a new rule wrapping your ` cc_binary ` .
32
+ Put the following line into your ` .bazelrc ` :
33
+
34
+ ```
35
+ build --incompatible_enable_cc_toolchain_resolution
36
+ ```
37
+
38
+ Then write a new rule wrapping your ` cc_binary ` .
31
39
32
40
```
33
41
load("@rules_cc//cc:defs.bzl", "cc_binary")
@@ -54,17 +62,3 @@ and all of its dependencies, and does not require amending `.bazelrc`. This
54
62
is the preferred way, since it also unpacks the resulting tarball.
55
63
56
64
See ` test_external/ ` for an example using [ embind] ( https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html ) .
57
-
58
- ### Using --config=wasm
59
-
60
- Put the following lines into your ` .bazelrc ` :
61
- ```
62
- build:wasm --crosstool_top=@emsdk//emscripten_toolchain:everything
63
- build:wasm --cpu=wasm
64
- build:wasm --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
65
- ```
66
-
67
- Simply pass ` --config=wasm ` when building a normal ` cc_binary ` . The result of
68
- this build will be a tar archive containing any files produced by emscripten.
69
- See the [ Bazel documentation] ( https://docs.bazel.build/versions/main/tutorial/cc-toolchain-config.html )
70
- for more details
0 commit comments