Skip to content

Commit

Permalink
Add WAVM and update cache keys.
Browse files Browse the repository at this point in the history
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
  • Loading branch information
mathetake committed May 12, 2021
1 parent 9337c10 commit 077bf23
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ jobs:

strategy:
matrix:
# TODO(mathetake): Add other runtimes.
runtime: [ "wamr", "wasmtime" ]
# TODO(mathetake): Add V8.
runtime: [ "wamr", "wasmtime", "wavm" ]

steps:
- uses: actions/checkout@v2
Expand All @@ -69,7 +69,7 @@ jobs:
uses: actions/cache@v1
with:
path: "/home/runner/.cache/bazel"
key: bazel-${{ matrix.runtime }}
key: bazel-${{ matrix.runtime }}-clang

- name: Test
run: |
Expand Down
7 changes: 3 additions & 4 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,12 @@ cc_library(
cc_library(
name = "wavm_lib",
srcs = glob([
# TODO(@mathetake): Add WAVM lib.
# "src/wavm/*.h",
# "src/wavm/*.cc",
"src/wavm/*.h",
"src/wavm/*.cc",
]),
deps = [
":common_lib",
# TODO(@mathetake): Add WAVM lib.
"@wavm//:wavm_lib",
],
)

Expand Down
2 changes: 0 additions & 2 deletions bazel/external/llvm.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package(default_visibility = ["//visibility:public"])
filegroup(
name = "srcs",
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)

cmake(
Expand Down Expand Up @@ -46,7 +45,6 @@ cmake(
},
lib_source = ":srcs",
out_static_libs = [
# Order from llvm-config --libnames.
"libLLVMInterpreter.a",
"libLLVMWindowsManifest.a",
"libLLVMLibDriver.a",
Expand Down
1 change: 0 additions & 1 deletion bazel/external/wamr.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package(default_visibility = ["//visibility:public"])
filegroup(
name = "srcs",
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)

cmake(
Expand Down
38 changes: 38 additions & 0 deletions bazel/external/wavm.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")

licenses(["notice"]) # Apache 2

package(default_visibility = ["//visibility:public"])

filegroup(
name = "srcs",
srcs = glob(["**"]),
)

cmake(
name = "wavm_lib",
binaries = ["wavm"],
cache_entries = {
"LLVM_DIR": "$EXT_BUILD_DEPS/copy_llvm/llvm/lib/cmake/llvm",
"WAVM_ENABLE_STATIC_LINKING": "on",
"WAVM_ENABLE_RELEASE_ASSERTS": "on",
"WAVM_ENABLE_UNWIND": "on",
# Workaround for the issue with statically linked libstdc++
# using -l:libstdc++.a.
"CMAKE_CXX_FLAGS": "-lstdc++ -Wno-unused-command-line-argument",
},
defines = ["WASM_WAVM"],
env_vars = {
# Workaround for the -DDEBUG flag added in fastbuild on macOS,
# which conflicts with DEBUG macro used in LLVM.
"CFLAGS": "-UDEBUG",
"CXXFLAGS": "-UDEBUG",
"ASMFLAGS": "-UDEBUG",
},
lib_source = ":srcs",
static_libraries = [
"libWAVM.a",
"libWAVMUnwind.a",
],
deps = ["@llvm//:llvm_lib"],
)
8 changes: 8 additions & 0 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,11 @@ def proxy_wasm_cpp_host_repositories():
patch_args = ["-p1"],
patches = ["@proxy_wasm_cpp_host//bazel/external:llvm.patch"],
)

http_archive(
name = "wavm",
build_file = "@proxy_wasm_cpp_host//bazel/external:wavm.BUILD",
sha256 = "ce899269516313b400005a8cc9bc3bcd8329663f43f7b4baae211ea0cd456a39",
strip_prefix = "WAVM-79c3aa29366615d9b1593cd527e5b4b94cc6072a",
url = "https://github.com/WAVM/WAVM/archive/79c3aa29366615d9b1593cd527e5b4b94cc6072a.tar.gz",
)

0 comments on commit 077bf23

Please sign in to comment.