@@ -127,22 +127,54 @@ cc_library(
127127 ],
128128)
129129
130- cc_library (
131- name = "wasmtime_lib " ,
130+ genrule (
131+ name = "prefixed_wasmtime_sources " ,
132132 srcs = [
133- "src/common/types.h" ,
134133 "src/wasmtime/types.h" ,
135134 "src/wasmtime/wasmtime.cc" ,
136135 ],
136+ outs = [
137+ "src/wasmtime/prefixed_types.h" ,
138+ "src/wasmtime/prefixed_wasmtime.cc" ,
139+ ],
140+ cmd = """
141+ for file in $(SRCS); do
142+ sed -e 's/wasm_/wasmtime_wasm_/g' \
143+ -e 's/wasmtime\\ /types.h/wasmtime\\ /prefixed_types.h/g' \
144+ $$file >$(@D)/$$(dirname $$file)/prefixed_$$(basename $$file)
145+ done
146+ """ ,
147+ )
148+
149+ cc_library (
150+ name = "wasmtime_lib" ,
151+ srcs = [
152+ "src/common/types.h" ,
153+ ] + select ({
154+ "@proxy_wasm_cpp_host//bazel:multiengine" : [
155+ "src/wasmtime/prefixed_types.h" ,
156+ "src/wasmtime/prefixed_wasmtime.cc" ,
157+ ],
158+ "//conditions:default" : [
159+ "src/wasmtime/types.h" ,
160+ "src/wasmtime/wasmtime.cc" ,
161+ ],
162+ }),
137163 hdrs = ["include/proxy-wasm/wasmtime.h" ],
138164 defines = [
139165 "PROXY_WASM_HAS_RUNTIME_WASMTIME" ,
140166 "PROXY_WASM_HOST_ENGINE_WASMTIME" ,
141167 ],
142168 deps = [
143169 ":wasm_vm_headers" ,
144- "//external:wasmtime" ,
145- ],
170+ ] + select ({
171+ "@proxy_wasm_cpp_host//bazel:multiengine" : [
172+ "//external:prefixed_wasmtime" ,
173+ ],
174+ "//conditions:default" : [
175+ "//external:wasmtime" ,
176+ ],
177+ }),
146178)
147179
148180cc_library (
0 commit comments