Skip to content

Commit

Permalink
[main] Bump Emscripten to 2.0.34 (#97)
Browse files Browse the repository at this point in the history
* Improve emscripten-releases-tags.txt to support mutliple aliases (#837)

Also, improve reporting of version resolution. e.g.:

```
$ ./emsdk  install sdk-latest
Resolving SDK alias 'latest' to '2.0.23'
Resolving SDK version '2.0.23' to 'sdk-releases-upstream-77b065ace39e6ab21446e13f92897f956c80476a-64bit'
Installing SDK 'sdk-releases-upstream-77b065ace39e6ab21446e13f92897f956c80476a-64bit'..
...
```

* bugfix: allow to install SDK binaries alone (#834)

* 2.0.24 (#839)

* Error out on attempt to activate a missing tools (#838)

Previously if a tool (any part of an SDK) was not installed
we would issue a warning and continue to active without returning
non-zero.

This meant doing `emsdk install 2.0.0 && emsdk activate latest`
would appear to be work aside from the warning messages about
latest not being installed.

This is especially annoying since we dropped support for side
by side SDK installations.  The following sequence is no longer
valid and we want to make that clear by erroring out:

```
$ emsdk install 2.0.1
$ emsdk install 2.0.2
$ emsdk activate 2.0.1
```

Since 2.0.2 replaces 2.0.1 on the filesystem the active here
could fail hard rather than just warning.

* Consistent error messages (#840)

* Point zsh and csh users to the correct startup script (#843)

Fixes: emscripten-core/emscripten#14446

* Print sys.argv when link_wrapper.py is invoked incorrectly (#847)

This should help debug cases when the link_wrapper is not invoked correctly.

* Support linking with `-o filename` (#849)

When linking with `-o filename` (such as in various CMake build checks), the parameter passed to the linker is a temporary file, and it is passed as a bare filename (i.e. relative path without a `'/'`). In such cases, `outdir` would have been the empty string, and the final `tar` command would fail (actually the call to `subprocess.check_call(…)` is what fails).

* 2.0.25 (#850)

* 2.0.26 (#858)

* 2.0.26-lto (#861)

* 2.0.27 (#868)

Includes LTO and non-LTO, with non-LTO as the default

* 2.0.28 (#871)

* Use `.json` extension for emscripten-releases-tags.json. NFC (#870)

* Add LTO build for 2.0.28 (#873)

* Small fix for Bazel instructions. (#875)

In the past the instructions were to copy `emscripten_toolchain` into the project dir, now it downloads emsdk as a package so the `bazelrc` part has to refer to `@emsdk`.

* Version 2.0.29 (#878)

* 2.0.29-lto (#881)

* Fix release name for 2.0.29-lto (#885)

Fixes #884

* [Bazel] fix llvm bin path (#888)

* Add arm64 fastcomp releases to emsdk_manifest.json (#891)

This was missing from emsdk_manifest.json and should alow older fastcomp
SDKs to be install on M1 apple hardware (in emulation mode).

Fixes: #889

* 2.0.30 (#893)

* Fix error handling: untargz() in emsdk.py (#895)

Make untargz() in emsdk.py return False if tar command failed.

* Fix passing -DLLVM_ENABLE_PROJECTS directive to CMake - it does not want to see double quotes in the field passed to it. (#898)

* Fix emscripten-version parsing (#902)

See emscripten-core/emscripten#15144

* 2.0.31 (#906)

* bazel: pass -g instead of -g4 for wasm_asan feature (#904)

* Add embind example to Bazel docs (#910)

* Add embind example to Bazel docs

* address feedback

* Run buildifier on bazel/ (#913)

* Update build_bazel_rules_nodejs to fix closure compiles (#912)

* Update build_bazel_rules_nodejs to fix closure compiles

* Fix spacing in update_bazel_workspace.sh script

* space

* 2.0.32 (#915)

* Improve flags in bazel example (#917)

* Add back node.js 12.18.1 packages for Windows 7 support. (#877)

* Update CMAKE_OSX_DEPLOYMENT_TARGET from 10.11 to 10.14 (#924)

Apparently 10.11 is no longer good enough to run the latest version of
binaryen.  Specifically since binaryen switched to using std::variant it
now fails to build with this set to 10.11.

This is also the version used on the emscripten-releases CI which builds
the emsdk binaries:
https://chromium.googlesource.com/emscripten-releases/+/refs/heads/main/src/build.py#673

* Revert "Update CMAKE_OSX_DEPLOYMENT_TARGET from 10.11 to 10.14 (#924)"

This reverts commit 99e5e02.

* 2.0.33 (#922)

I add to temporarily disable the test_binaryen_from_source test
under macOS to work around:
WebAssembly/binaryen#4299

* 2.0.34 (#925)

* Bump EmscriptenVersion to 2.0.34

* Fix bad edit

Co-authored-by: Sam Clegg <sbc@chromium.org>
Co-authored-by: Yulong Wang <yulong.fs@gmail.com>
Co-authored-by: Attila Oláh <attilaolah@gmail.com>
Co-authored-by: Attila Oláh <atl@google.com>
Co-authored-by: Derek Schuff <dschuff@chromium.org>
Co-authored-by: Danny B <danila.bespalov@gmail.com>
Co-authored-by: Brad Kotsopoulos <bkotsopoulos@snapchat.com>
Co-authored-by: Matt Gucci <matt9ucci@gmail.com>
Co-authored-by: juj <jujjyl@gmail.com>
Co-authored-by: walkingeyerobot <mitch@thefoley.net>
Co-authored-by: Kevin Lubick <kjlubick@users.noreply.github.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
  • Loading branch information
13 people authored Jan 28, 2022
1 parent b2054b9 commit b581f08
Show file tree
Hide file tree
Showing 22 changed files with 418 additions and 169 deletions.
3 changes: 1 addition & 2 deletions bazel/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package(default_visibility = ['//visibility:public'])
package(default_visibility = ["//visibility:public"])

config_setting(
name = "linux",
Expand Down Expand Up @@ -41,4 +41,3 @@ alias(
":windows": "@emscripten_npm_win//:node_modules",
}),
)

43 changes: 26 additions & 17 deletions bazel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,26 @@ In `WORKSPACE` file, put:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "emsdk",
strip_prefix = "emsdk-c1589b55641787d55d53e883852035beea9aec3f/bazel",
url = "https://github.com/emscripten-core/emsdk/archive/c1589b55641787d55d53e883852035beea9aec3f.tar.gz",
sha256 = "7a58a9996b113d3e0675df30b5f17e28aa47de2e684a844f05394fe2f6f12e8e",
sha256 = "d55e3c73fc4f8d1fecb7aabe548de86bdb55080fe6b12ce593d63b8bade54567",
strip_prefix = "emsdk-3891e7b04bf8cbb3bc62758e9c575ae096a9a518/bazel",
url = "https://github.com/emscripten-core/emsdk/archive/3891e7b04bf8cbb3bc62758e9c575ae096a9a518.tar.gz",
)
load("@emsdk//:deps.bzl", emsdk_deps = "deps")
emsdk_deps()
load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps")
emsdk_emscripten_deps()
emsdk_emscripten_deps(emscripten_version = "2.0.31")
```
The SHA1 hash in the above `strip_prefix` and `url` parameters correspond to the git revision of
[emsdk 2.0.31](https://github.com/emscripten-core/emsdk/releases/tag/2.0.31). To get access to
newer versions, you'll need to update those. To make use of older versions, change the
parameter of `emsdk_emscripten_deps()`. Supported versions are listed in `revisions.bzl`

## Building

### Using --config=wasm

Put the following lines into your `.bazelrc`:
```
build:wasm --crosstool_top=//emscripten_toolchain:everything
build:wasm --cpu=wasm
build:wasm --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
```

Simply pass `--config=wasm` when building a normal `cc_binary`. The result of
this build will be a tar archive containing any files produced by emscripten.
## Building

### Using wasm_cc_binary
### Using wasm_cc_binary (preferred)
First, write a new rule wrapping your `cc_binary`.

```
Expand All @@ -59,3 +52,19 @@ rules.
`wasm_cc_binary` uses transition to use emscripten toolchain on `cc_target`
and all of its dependencies, and does not require amending `.bazelrc`. This
is the preferred way, since it also unpacks the resulting tarball.

See `test_external/` for an example using [embind](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html).

### Using --config=wasm

Put the following lines into your `.bazelrc`:
```
build:wasm --crosstool_top=@emsdk//emscripten_toolchain:everything
build:wasm --cpu=wasm
build:wasm --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
```

Simply pass `--config=wasm` when building a normal `cc_binary`. The result of
this build will be a tar archive containing any files produced by emscripten.
See the [Bazel documentation](https://docs.bazel.build/versions/main/tutorial/cc-toolchain-config.html)
for more details
2 changes: 2 additions & 0 deletions bazel/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
workspace(name = "emsdk")

load(":deps.bzl", "deps")

deps()

load(":emscripten_deps.bzl", "emscripten_deps")

emscripten_deps()
4 changes: 2 additions & 2 deletions bazel/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ def deps():
if "build_bazel_rules_nodejs" not in excludes:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "0f2de53628e848c1691e5729b515022f5a77369c76a09fbe55611e12731c90e3",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/2.0.1/rules_nodejs-2.0.1.tar.gz"],
sha256 = "4501158976b9da216295ac65d872b1be51e3eeb805273e68c516d2eb36ae1fbb",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.4.1/rules_nodejs-4.4.1.tar.gz"],
)
4 changes: 2 additions & 2 deletions bazel/emscripten_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ load("@build_bazel_rules_nodejs//:index.bzl", "npm_install")
load(":revisions.bzl", "EMSCRIPTEN_TAGS")

def _parse_version(v):
return [int(u) for u in v.split(".")]
return [int(u) for u in v.split(".")]

def emscripten_deps(emscripten_version = "latest"):
version = emscripten_version

if version == "latest":
version = reversed(sorted(EMSCRIPTEN_TAGS.keys(), key=_parse_version))[0]
version = reversed(sorted(EMSCRIPTEN_TAGS.keys(), key = _parse_version))[0]

if version not in EMSCRIPTEN_TAGS.keys():
error_msg = "Emscripten version {} not found.".format(version)
Expand Down
2 changes: 1 addition & 1 deletion bazel/emscripten_toolchain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ filegroup(
"emcc.sh",
"emscripten_config",
"env.sh",
"@nodejs//:node_files",
"@emsdk//:binaries",
"@emsdk//:node_modules",
"@nodejs//:node_files",
],
)

Expand Down
12 changes: 6 additions & 6 deletions bazel/emscripten_toolchain/crosstool.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ def _impl(ctx):
# https://emscripten.org/docs/debugging/Sanitizers.html
feature(name = "wasm_asan"),
feature(name = "wasm_ubsan"),

feature(
name = "output_format_js",
enabled = True,
Expand Down Expand Up @@ -518,7 +517,7 @@ def _impl(ctx):
# Language Features
flag_set(
actions = all_cpp_compile_actions,
flags = ["-std=gnu++17", "-nostdinc", "-nostdinc++",],
flags = ["-std=gnu++17", "-nostdinc", "-nostdinc++"],
),

# Emscripten-specific settings:
Expand Down Expand Up @@ -619,7 +618,7 @@ def _impl(ctx):
actions = all_compile_actions +
all_link_actions,
flags = [
"-g4",
"-g",
"-fsanitize=address",
"-O1",
"-DADDRESS_SANITIZER=1",
Expand Down Expand Up @@ -910,7 +909,8 @@ def _impl(ctx):
"-iwithsysroot" + "/include/c++/v1",
"-iwithsysroot" + "/include/compat",
"-iwithsysroot" + "/include",
"-isystem", emscripten_dir + "/lib/clang/13.0.0/include",
"-isystem",
emscripten_dir + "/lib/clang/14.0.0/include",
],
),
# Inputs and outputs
Expand Down Expand Up @@ -1072,7 +1072,7 @@ def _impl(ctx):
emscripten_dir + "/emscripten/cache/sysroot/include/c++/v1",
emscripten_dir + "/emscripten/cache/sysroot/include/compat",
emscripten_dir + "/emscripten/cache/sysroot/include",
emscripten_dir + "/lib/clang/13.0.0/include",
emscripten_dir + "/lib/clang/14.0.0/include",
]

artifact_name_patterns = []
Expand Down Expand Up @@ -1103,7 +1103,7 @@ emscripten_cc_toolchain_config_rule = rule(
implementation = _impl,
attrs = {
"cpu": attr.string(mandatory = True, values = ["asmjs", "wasm"]),
"em_config": attr.label(mandatory = True, allow_single_file=True),
"em_config": attr.label(mandatory = True, allow_single_file = True),
"emscripten_binaries": attr.label(mandatory = True),
},
provides = [CcToolchainConfigInfo],
Expand Down
6 changes: 3 additions & 3 deletions bazel/emscripten_toolchain/link_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import sys

# Only argument should be @path/to/parameter/file
assert sys.argv[1][0] == '@'
assert sys.argv[1][0] == '@', sys.argv
param_filename = sys.argv[1][1:]
param_file_args = [l.strip() for l in open(param_filename, 'r').readlines()]

Expand Down Expand Up @@ -51,7 +51,7 @@
options = parser.parse_known_args(param_file_args)[0]
output_file = options.o
oformat = options.oformat
outdir = os.path.dirname(output_file)
outdir = os.path.normpath(os.path.dirname(output_file))
base_name = os.path.basename(output_file)

# The output file name is the name of the build rule that was built.
Expand Down Expand Up @@ -105,7 +105,7 @@
# is the blaze output path; we want it to be just the filename.

llvm_objcopy = os.path.join(
os.environ['EMSCRIPTEN'], 'llvm-bin/llvm-objcopy')
os.environ['EM_BIN_PATH'], 'bin/llvm-objcopy')
# First, check to make sure the .wasm file has the header that needs to be
# rewritten.
rtn = subprocess.call([
Expand Down
88 changes: 77 additions & 11 deletions bazel/revisions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,133 @@
# DO NOT MODIFY

EMSCRIPTEN_TAGS = {
"2.0.23": struct(
"2.0.34": struct(
hash = "d8fc1b92dbc0ce8d740a7adb937c5137ba4755e0",
sha_linux = "a6304e3a52c172eb178c6f9817d74aa3ee411e97ef00bcae0884377799c49954",
sha_mac = "975ae11000100362baf19d161fec04d82e1f7c9fb7d43c43864ddd65a47f1780",
sha_win = "30f64dbc6425490157360439d40141feae359dbf586f59fa23185d7e009f3209",
),
"2.0.33": struct(
hash = "cef8850d57278271766fb2163eebcb07354018e7",
sha_linux = "958a0f4b1533e877c1a5ed3c13cb8baabc80e791d45858c2c94ac62325ada953",
sha_mac = "8ecb248653d44c3748e23c089cb9f0e3d4eee7cda13fdec27ec0113b896e34c4",
sha_win = "6b6b2831f8b338488f787b4a8c34700277bf3988358dbb54426f017155603ac9",
),
"2.0.32": struct(
hash = "74646397e3c5010824ad60d1de86c6bcbe334dff",
sha_linux = "236b3954e71d3bb30d347c655b9f47f2a091aa2e61046e1912c8da90152f4ca1",
sha_mac = "6a03267574534948e3b041e5d3e31bd757751ef17912eb6e90b96a47da03afb6",
sha_win = "2f8fbf0db097d67d0c364946faceec27c569c5c2d7b22068eef8db55645aba36",
),
"2.0.31": struct(
hash = "597724ca3f6cd6e84bea73f1f519a3953b5c273d",
sha_linux = "ef70c7733aa0df41cb4c812f5a89bf6b2ed13ca8aa252872396c0be271156d9e",
sha_mac = "77e57c3e98758488ef676f8f58a85faa0bd65a1d326a91771ad83d7cb0e373ca",
sha_win = "541605b740afccd08a39f5ae815978f699f350d621a1b2dfba0763970b56aee4",
),
"2.0.30": struct(
hash = "c69458f1bbf3ef5b8da4e934de210659cc9bca04",
sha_linux = "ee1c8270096a728966ae38af548047d1f64c18318e06ba75952e657136f02537",
sha_mac = "574a5819308eba6c8be6a780e26dff415a0e7178d3f44162dd8dca87eb40d4a7",
sha_win = "242d244f4f5f5af08e6e6ac9c143aebf1b7bb2a23fd2992350731e59acfee07c",
),
"2.0.29": struct(
hash = "c2369dc425725fff86ba90a9007a4603ddf7941b",
sha_linux = "7df4a8f3e25820becadfa7f1fe0d78e764102ec3ee50c474ca1634ed90d48890",
sha_mac = "d998521ba95882a27792f0113ea2c972fbb891c240649f4c994f0260c0e1a213",
sha_win = "c64aa3f2af6503f6711b2322986a45784e00d7c7fe13ec3f5c4f740472d065a0",
),
"2.0.28": struct(
hash = "866055ea639d64dfedc625d28ec981e47ce37168",
sha_linux = "7dca7704eb14e367bb67e9abc9eaf59e75f59b74e32422e04556de10897a9a86",
sha_mac = "370f76493e3805e2538290b698a381f04b6d78a77771e48fc0099cf89dad985f",
sha_win = "e913c50ea5f196d36971f7cf5b1cf9a9ca27ce0818aba56be3a66e31e95c0e5b",
),
"2.0.27": struct(
hash = "1ac46e3b84955231ab4a4f4cbe0c7ac28c86b8cc",
sha_linux = "3e124e278de168cf22e03b93b2f14a65a86777e428cdaab7e5e1c2289eb41605",
sha_mac = "388262b9e1042ef9a3a1945d5a23dcd634c8042a225e8fdf80bcc2c1cb7e05cc",
sha_win = "762276a332432e717afb988310d21ae10e36facc1e05bfd77042a364fb43cc3c",
),
"2.0.26": struct(
hash = "823d37b15d1ab61bc9ac0665ceef6951d3703842",
sha_linux = "996e16d368a99dd4dd12126acbcb8bea9a607b5257cc7b747c4afc2f036fd8cf",
sha_mac = "8b2d7e84cc449531e88034beb31da89a0b61ccaeaa1584ffb6da7842c6348fdc",
sha_win = "095e772764d7f8c0f8228bda4b8500ae43aac2303567da5cdc9f8623f70a5743",
),
"2.0.25": struct(
hash = "f6f001b08fbb67935379cf13d17fd9bfdbaff791",
sha_linux = "06d8e2f3d4f4b35a57de9c15e62a559c941cfba1dd7ec02353d815904d912c3b",
sha_mac = "6541bf3a648aae7df84de424ff392dd1513ab5450203c84f72a6a03e321a301b",
sha_win = "267fbfa809ec0eb911c1962b1b9768675cb82228e694a5f9ef570232ee71db76",
),
"2.0.24": struct(
hash = "6ab7fc5622a67e6111d07c4ba61c8d3c8fc33ed2",
sha_linux = "e5daa0e87f3afd2197e7975297cb0cd4c245edccb964ca5f1f32ee7d985bf440",
sha_mac = "e4b7f2a7b71d6ac4610ee7b14743570e0dfba3668dc6b4f984cbe7a135888527",
sha_win = "db2aad422a3ca2295be6101b0151eeee55dcea29ba1f31b4594c02ba46591cbe",
),
"2.0.23": struct(
hash = "77b065ace39e6ab21446e13f92897f956c80476a",
sha_linux = "7713a9a5572d839aea9eaa84a7c4779d11c6c8818ee64a0f443b62081fae6d47",
sha_mac = "b793087462d581e25c8c267fca9d30519619e3272480862a56cc316a32c7afab",
sha_win = "b8885cbb41a39e4734861462e05ee58c7ff7562016a842bcee2603f229940e8b",
),
"2.0.22": struct(
"2.0.22": struct(
hash = "6465a9acb820207acf7da44661a7de52d0a1ae3c",
sha_linux = "c079781124e763c53c9fc73781fcee40296ce3314276836bc694f07bd331a859",
sha_mac = "ab95574dfc685b0300e37bea36aba413045bbfa2ab06b93eceb881670489eec1",
sha_win = "ba142e7e380596cba763e3a414de6511bcb86de48e4b48cf393b1ea449a24aaa",
),
"2.0.21": struct(
"2.0.21": struct(
hash = "72f4ec97fbc7ec16c15ae68a75b0a257b2835160",
sha_linux = "741264f33f96ba4b785ed0b133861ebdfefbaefab76ddcfe7bde6522829d6f70",
sha_mac = "b07c0d65ee7e2799170c6f3b2aacebfe070c2e4975088bcd1b3a4140fecd8418",
sha_win = "dc3cbf47aa4be52a92526f1790a013734ecbd407f7f36286ed0283c96355999a",
),
"2.0.20": struct(
"2.0.20": struct(
hash = "e0c15cd14170f407a9eb27fcbad22931dc67feb7",
sha_linux = "a196504fd1095836ca3961208338ff9e292be7729ea529bc19800aa7c966d34a",
sha_mac = "6cdbf17ed61486b38ea79d3f31d74483e7388d1e7468518dccba3f24e0ddd4c4",
sha_win = "4d22a32c219dbe18c55b635d014b9eaf7da60536171b7af37d9a8099fd33794b",
),
"2.0.19": struct(
"2.0.19": struct(
hash = "9b9ff2dabfb4a7fbacbc004c0bead12a60f9d05c",
sha_linux = "bd7c2a38ac88d219a1ab5003ddbf8fdc66a6ba55bc69f99077346edf2753b4ea",
sha_mac = "6cc44029c9052855a55938eb6496b5659da4b1ce9cb34502b740af5993a94f93",
sha_win = "a1fa8b1c387b9307f9b87c43dc83c0ff1bc04b9f29fbe4f39aff2dd946ca4b70",
),
"2.0.18": struct(
"2.0.18": struct(
hash = "c2ac7520fad29a7937ed60ab6a95b08eb374c7ba",
sha_linux = "e9f777de592f606b10104b2efe5179a7a8f44e3a9dffa1e3aaf73e05eb8893d7",
sha_mac = "86b1dd62e424e3788bf132292a694a25ca9b0875d06f50d0f5d424593697452c",
sha_win = "49ce07bda6be070251db44a08fcc05cae21ffdbd7522423a0c79bde635e87e28",
),
"2.0.17": struct(
"2.0.17": struct(
hash = "f5c45e60392b82f603e3a8039c62db294fab02d2",
sha_linux = "b40a4874057e4cace600f8ee9787dcbe236e3dc5b2fff5c2ecb0e867e426f99c",
sha_mac = "081f61abf7d5ac0ec31aaffc5550013d4093ea4ea39520b7a32b7448d2a6ee70",
sha_win = "45d06e597e6a1185a76200bd0481495e7298800a4805045d9cdbcce6311c91b2",
),
"2.0.16": struct(
"2.0.16": struct(
hash = "80d9674f2fafa6b9346d735c42d5c52b8cc8aa8e",
sha_linux = "e527638b224d9a30dc7e5fa4b9bd2eb2ab76ad306739ba8cacf5a5e333933a2a",
sha_mac = "061020eb0e3ee0611dc5a0008ccc7778168a4f838d49ca41c0aad8c52c1a01c9",
sha_win = "99364ed0388f928e0594f790662bf3a30c2894b0eff81797e1b64f62128561cb",
),
"2.0.15": struct(
"2.0.15": struct(
hash = "89202930a98fe7f9ed59b574469a9471b0bda7dd",
sha_linux = "7ff49fc63adf29970f6e7af1df445d7f554bdbbb2606db1cb5d3567ce69df1db",
sha_mac = "e35cced1514ad0da40584f8dd6f76aabf847ce0fa82c6dc8dd9442fb74ed6d0d",
sha_win = "31d5f8107c87833cea57edc57613bba4b36b16152772f744c5ad204594b4e666",
),
"2.0.14": struct(
"2.0.14": struct(
hash = "fc5562126762ab26c4757147a3b4c24e85a7289e",
sha_linux = "e466cd47ddd4bf0acd645412fdf08eda6d232484e48e5a2643e08062a7a4cf56",
sha_mac = "1c554c08459b7025638ca4eddba0d35babe8c26b202a70a74e9442d577896211",
sha_win = "428bc6094671937af96f26d803871fc5cd83d4d2b1c1df45fa6873a9bc5cac51",
),
"2.0.13": struct(
"2.0.13": struct(
hash = "ce0e4a4d1cab395ee5082a60ebb4f3891a94b256",
sha_linux = "8986ed886e111c661099c5147126b8a379a4040aab6a1f572fe01f0f9b99a343",
sha_mac = "88c91332c8c76fed14ebf0edc9a08f586012f54f04ad61e5b1b6d02bf96bdeab",
Expand Down
4 changes: 4 additions & 0 deletions bazel/test_external/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bazel-bin
bazel-out
bazel-test_external
bazel-testlogs
40 changes: 40 additions & 0 deletions bazel/test_external/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,43 @@ wasm_cc_binary(
cc_target = ":hello-world",
)

BASE_LINKOPTS = [
"--bind", # Enable embind
"-sMODULARIZE",
]

RELEASE_OPTS = [
"--closure=1", # Run the closure compiler
]

DEBUG_OPTS = [
"--closure=0", # Do not use closure
]

config_setting(
name = "release_opts",
values = {"compilation_mode": "opt"},
)

config_setting(
name = "debug_opts",
values = {"compilation_mode": "dbg"},
)

cc_binary(
name = "hello-embind",
srcs = ["hello-embind.cc"],
linkopts = select({
":debug_opts": BASE_LINKOPTS + DEBUG_OPTS,
":release_opts": BASE_LINKOPTS + RELEASE_OPTS,
"//conditions:default": BASE_LINKOPTS + RELEASE_OPTS,
}),
# This target won't build successfully on its own because of missing emscripten
# headers etc. Therefore, we hide it from wildcards.
tags = ["manual"],
)

wasm_cc_binary(
name = "hello-embind-wasm",
cc_target = ":hello-embind",
)
Loading

0 comments on commit b581f08

Please sign in to comment.