Skip to content

Commit fc084b7

Browse files
authored
wasmtime: split "prefixed_wasmtime" into a separate target. (#262)
Signed-off-by: Piotr Sikora <[email protected]>
1 parent f2c162f commit fc084b7

File tree

5 files changed

+31
-25
lines changed

5 files changed

+31
-25
lines changed

BUILD

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,24 @@ cc_library(
128128
],
129129
)
130130

131+
cc_library(
132+
name = "wasmtime_lib",
133+
srcs = [
134+
"src/common/types.h",
135+
"src/wasmtime/types.h",
136+
"src/wasmtime/wasmtime.cc",
137+
],
138+
hdrs = ["include/proxy-wasm/wasmtime.h"],
139+
defines = [
140+
"PROXY_WASM_HAS_RUNTIME_WASMTIME",
141+
"PROXY_WASM_HOST_ENGINE_WASMTIME",
142+
],
143+
deps = [
144+
":wasm_vm_headers",
145+
"//external:wasmtime",
146+
],
147+
)
148+
131149
genrule(
132150
name = "prefixed_wasmtime_sources",
133151
srcs = [
@@ -141,41 +159,29 @@ genrule(
141159
cmd = """
142160
for file in $(SRCS); do
143161
sed -e 's/wasm_/wasmtime_wasm_/g' \
162+
-e 's/include\\/wasm.h/include\\/prefixed_wasm.h/g' \
144163
-e 's/wasmtime\\/types.h/wasmtime\\/prefixed_types.h/g' \
145164
$$file >$(@D)/$$(dirname $$file)/prefixed_$$(basename $$file)
146165
done
147166
""",
148167
)
149168

150169
cc_library(
151-
name = "wasmtime_lib",
170+
name = "prefixed_wasmtime_lib",
152171
srcs = [
153172
"src/common/types.h",
154-
] + select({
155-
"@proxy_wasm_cpp_host//bazel:multiengine": [
156-
"src/wasmtime/prefixed_types.h",
157-
"src/wasmtime/prefixed_wasmtime.cc",
158-
],
159-
"//conditions:default": [
160-
"src/wasmtime/types.h",
161-
"src/wasmtime/wasmtime.cc",
162-
],
163-
}),
173+
"src/wasmtime/prefixed_types.h",
174+
"src/wasmtime/prefixed_wasmtime.cc",
175+
],
164176
hdrs = ["include/proxy-wasm/wasmtime.h"],
165177
defines = [
166178
"PROXY_WASM_HAS_RUNTIME_WASMTIME",
167179
"PROXY_WASM_HOST_ENGINE_WASMTIME",
168180
],
169181
deps = [
170182
":wasm_vm_headers",
171-
] + select({
172-
"@proxy_wasm_cpp_host//bazel:multiengine": [
173-
"//external:prefixed_wasmtime",
174-
],
175-
"//conditions:default": [
176-
"//external:wasmtime",
177-
],
178-
}),
183+
"//external:prefixed_wasmtime",
184+
],
179185
)
180186

181187
cc_library(
@@ -211,6 +217,7 @@ cc_library(
211217
[":wamr_lib"],
212218
) + proxy_wasm_select_engine_wasmtime(
213219
[":wasmtime_lib"],
220+
[":prefixed_wasmtime_lib"],
214221
) + proxy_wasm_select_engine_wavm(
215222
[":wavm_lib"],
216223
),

bazel/external/wasm-c-api.BUILD

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ cc_library(
99
hdrs = [
1010
"include/wasm.h",
1111
],
12-
include_prefix = "wasmtime",
1312
deps = [
1413
"@com_github_bytecodealliance_wasmtime//:rust_c_api",
1514
],
@@ -21,7 +20,7 @@ genrule(
2120
"include/wasm.h",
2221
],
2322
outs = [
24-
"wasmtime/include/wasm.h",
23+
"include/prefixed_wasm.h",
2524
],
2625
cmd = """
2726
sed -e 's/\\ wasm_/\\ wasmtime_wasm_/g' \

bazel/select.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ def proxy_wasm_select_engine_wamr(xs):
3333
"//conditions:default": [],
3434
})
3535

36-
def proxy_wasm_select_engine_wasmtime(xs):
36+
def proxy_wasm_select_engine_wasmtime(xs, xp):
3737
return select({
3838
"@proxy_wasm_cpp_host//bazel:engine_wasmtime": xs,
39-
"@proxy_wasm_cpp_host//bazel:multiengine": xs,
39+
"@proxy_wasm_cpp_host//bazel:multiengine": xp,
4040
"//conditions:default": [],
4141
})
4242

src/wasmtime/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 "wasmtime/include/wasm.h"
16+
#include "include/wasm.h"
1717

1818
namespace proxy_wasm {
1919
namespace wasmtime {

src/wasmtime/wasmtime.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include "src/wasmtime/types.h"
2828

29-
#include "wasmtime/include/wasm.h"
29+
#include "include/wasm.h"
3030

3131
namespace proxy_wasm {
3232
namespace wasmtime {

0 commit comments

Comments
 (0)