Skip to content

Commit 86edeb5

Browse files
author
Le Yao
committed
Bazel build the runtime from external WAMR repo
Build and testing runtime Signed-off-by: Le Yao <[email protected]>
1 parent 199fe7f commit 86edeb5

File tree

6 files changed

+38
-2
lines changed

6 files changed

+38
-2
lines changed

BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ cc_library(
3535
"@com_google_protobuf//:protobuf_lite",
3636
"@proxy_wasm_cpp_sdk//:api_lib",
3737
"@wasm_c_api//:wasmtime_lib",
38+
"@wamr//:wamr_lib",
3839
],
3940
)

bazel/external/wamr.BUILD

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
licenses(["notice"]) # Apache 2
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
cc_import(
6+
name = "linklib",
7+
shared_library = "library/linux-classic_interp-multi_module-dbg/libiwasm.so",
8+
)
9+
10+
cc_library(
11+
name = "headlib",
12+
hdrs = glob(["include/*.h"]),
13+
srcs = glob(["include/*.c"]),
14+
include_prefix = "wamr",
15+
)
16+
17+
cc_library(
18+
name = "wamr_lib",
19+
defines = ["WASM_WAMR"],
20+
deps = [
21+
"linklib",
22+
"headlib",
23+
],
24+
)

bazel/repositories.bzl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ def proxy_wasm_cpp_host_repositories():
4444
url = "https://github.com/bytecodealliance/wasmtime/archive/v0.21.0.tar.gz",
4545
)
4646

47+
http_archive(
48+
name = "wamr",
49+
build_file = "@proxy_wasm_cpp_host//bazel/external:wamr.BUILD",
50+
sha256 = "fb2ca3b0322becb8c62de626181ef66a7be15e36000913f0ad4bf51d4619891b",
51+
strip_prefix = "wamr_pre_release",
52+
url = "https://github.com/lum1n0us/wasm-micro-runtime/releases/download/WAMR-01-29-2021/wamr_pre_release.zip",
53+
)
54+
4755
http_archive(
4856
name = "wasm_c_api",
4957
build_file = "@proxy_wasm_cpp_host//bazel/external:wasm-c-api.BUILD",

src/wamr/types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
#include "src/common/types.h"
16-
#include "wasm_c_api.h"
16+
#include "wamr/include/wasm_c_api.h"
1717

1818
namespace proxy_wasm {
1919
namespace wamr {

src/wamr/wamr.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <vector>
3131

3232
#include "src/wamr/types.h"
33-
#include "wasm_c_api.h"
33+
#include "wamr/include/wasm_c_api.h"
3434

3535
namespace proxy_wasm {
3636
namespace wamr {

test/utility.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
#if defined(WASM_WASMTIME)
3333
#include "include/proxy-wasm/wasmtime.h"
3434
#endif
35+
#if defined(WASM_WASMTIME)
36+
#include "include/proxy-wasm/wamr.h"
37+
#endif
3538

3639
namespace proxy_wasm {
3740

0 commit comments

Comments
 (0)