Skip to content

Commit fe09128

Browse files
committed
Add WAVM.
Signed-off-by: Takeshi Yoneda <[email protected]>
1 parent 9337c10 commit fe09128

File tree

6 files changed

+52
-10
lines changed

6 files changed

+52
-10
lines changed

.github/workflows/cpp.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ jobs:
5959

6060
strategy:
6161
matrix:
62-
# TODO(mathetake): Add other runtimes.
63-
runtime: [ "wamr", "wasmtime" ]
62+
# TODO(mathetake): Add V8.
63+
runtime: [ "wamr", "wasmtime", "wavm" ]
6464

6565
steps:
6666
- uses: actions/checkout@v2
@@ -69,7 +69,7 @@ jobs:
6969
uses: actions/cache@v1
7070
with:
7171
path: "/home/runner/.cache/bazel"
72-
key: bazel-${{ matrix.runtime }}
72+
key: bazel-${{ matrix.runtime }}-
7373

7474
- name: Test
7575
run: |

BUILD

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,12 @@ cc_library(
7878
cc_library(
7979
name = "wavm_lib",
8080
srcs = glob([
81-
# TODO(@mathetake): Add WAVM lib.
82-
# "src/wavm/*.h",
83-
# "src/wavm/*.cc",
81+
"src/wavm/*.h",
82+
"src/wavm/*.cc",
8483
]),
8584
deps = [
8685
":common_lib",
87-
# TODO(@mathetake): Add WAVM lib.
86+
"@wavm//:wavm_lib",
8887
],
8988
)
9089

bazel/external/llvm.BUILD

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package(default_visibility = ["//visibility:public"])
77
filegroup(
88
name = "srcs",
99
srcs = glob(["**"]),
10-
visibility = ["//visibility:public"],
1110
)
1211

1312
cmake(
@@ -46,7 +45,6 @@ cmake(
4645
},
4746
lib_source = ":srcs",
4847
out_static_libs = [
49-
# Order from llvm-config --libnames.
5048
"libLLVMInterpreter.a",
5149
"libLLVMWindowsManifest.a",
5250
"libLLVMLibDriver.a",

bazel/external/wamr.BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package(default_visibility = ["//visibility:public"])
77
filegroup(
88
name = "srcs",
99
srcs = glob(["**"]),
10-
visibility = ["//visibility:public"],
1110
)
1211

1312
cmake(

bazel/external/wavm.BUILD

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
2+
3+
licenses(["notice"]) # Apache 2
4+
5+
package(default_visibility = ["//visibility:public"])
6+
7+
filegroup(
8+
name = "srcs",
9+
srcs = glob(["**"]),
10+
)
11+
12+
cmake(
13+
name = "wavm_lib",
14+
binaries = ["wavm"],
15+
cache_entries = {
16+
"LLVM_DIR": "$EXT_BUILD_DEPS/copy_llvm/llvm/lib/cmake/llvm",
17+
"WAVM_ENABLE_STATIC_LINKING": "on",
18+
"WAVM_ENABLE_RELEASE_ASSERTS": "on",
19+
"WAVM_ENABLE_UNWIND": "on",
20+
# Workaround for the issue with statically linked libstdc++
21+
# using -l:libstdc++.a.
22+
"CMAKE_CXX_FLAGS": "-lstdc++ -Wno-unused-command-line-argument",
23+
},
24+
defines = ["WASM_WAVM"],
25+
env_vars = {
26+
# Workaround for the -DDEBUG flag added in fastbuild on macOS,
27+
# which conflicts with DEBUG macro used in LLVM.
28+
"CFLAGS": "-UDEBUG",
29+
"CXXFLAGS": "-UDEBUG",
30+
"ASMFLAGS": "-UDEBUG",
31+
},
32+
lib_source = ":srcs",
33+
static_libraries = [
34+
"libWAVM.a",
35+
"libWAVMUnwind.a",
36+
],
37+
deps = ["@llvm//:llvm_lib"],
38+
)

bazel/repositories.bzl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,11 @@ def proxy_wasm_cpp_host_repositories():
9090
patch_args = ["-p1"],
9191
patches = ["@proxy_wasm_cpp_host//bazel/external:llvm.patch"],
9292
)
93+
94+
http_archive(
95+
name = "wavm",
96+
build_file = "@proxy_wasm_cpp_host//bazel/external:wavm.BUILD",
97+
sha256 = "ce899269516313b400005a8cc9bc3bcd8329663f43f7b4baae211ea0cd456a39",
98+
strip_prefix = "WAVM-79c3aa29366615d9b1593cd527e5b4b94cc6072a",
99+
url = "https://github.com/WAVM/WAVM/archive/79c3aa29366615d9b1593cd527e5b4b94cc6072a.tar.gz",
100+
)

0 commit comments

Comments
 (0)