-
Notifications
You must be signed in to change notification settings - Fork 73
build: refactor Bazel configuration towards multiple runtime tests #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
e8a1e61
10897f3
cf4bb15
5cc55d2
9964456
8bd5f3a
2f4ffe9
7570f7c
2bd8242
72fdbb6
4061ab5
c3c3558
0f3f6b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
build --enable_platform_specific_config | ||
|
||
# COPTS | ||
build:linux --cxxopt=-std=c++17 | ||
build:macos --cxxopt=-std=c++17 | ||
# TODO(mathetake): Windows build is not verified yet. | ||
# build:windows --cxxopt="/std:c++17" | ||
|
||
# LINKOPTS | ||
# See https://bytecodealliance.github.io/wasmtime/c-api/ | ||
build:linux --action_env=BAZEL_LINKOPTS=-lm:-lpthread:-ldl | ||
# TODO(mathetake): Windows build is not verified yet. | ||
# build:windows --action_env=BAZEL_LINKOPTS=ws2_32.lib:advapi32.lib:userenv.lib:ntdll.lib:shell32.lib:ole32.lib | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
load("@rules_cc//cc:defs.bzl", "cc_library") | ||
load("@proxy_wasm_cpp_host//bazel:variables.bzl", "COPTS") | ||
load( | ||
"@proxy_wasm_cpp_host//bazel:select.bzl", | ||
"proxy_wasm_select_wasm_runtime_v8", | ||
"proxy_wasm_select_wasm_runtime_wasmtime", | ||
"proxy_wasm_select_wasm_runtime_wavm", | ||
) | ||
|
||
licenses(["notice"]) # Apache 2 | ||
|
||
|
@@ -13,27 +18,72 @@ cc_library( | |
], | ||
) | ||
|
||
# TODO(mathetkae): once other runtimes(WAVM,V8) can be linked in this repos, | ||
# use -define=wasm=v8|wavm|wasmtime and switch | ||
cc_library( | ||
name = "lib", | ||
srcs = glob( | ||
[ | ||
"src/**/*.cc", | ||
"src/**/*.h", | ||
], | ||
exclude = [ | ||
"src/**/wavm*", | ||
"src/**/v8*", | ||
], | ||
), | ||
hdrs = glob(["src/**/*.h"]), | ||
copts = COPTS, | ||
name = "common_lib", | ||
srcs = glob([ | ||
"src/*.h", | ||
"src/*.cc", | ||
"src/common/*.h", | ||
"src/common/*.cc", | ||
"src/third_party/*.h", | ||
"src/third_party/*.cc", | ||
"src/null/*.cc", | ||
]), | ||
deps = [ | ||
":include", | ||
"@boringssl//:crypto", | ||
"@com_google_protobuf//:protobuf_lite", | ||
"@proxy_wasm_cpp_sdk//:api_lib", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "v8_lib", | ||
srcs = glob([ | ||
# TODO(@mathetake): Add V8 lib. | ||
# "src/v8/*.h", | ||
# "src/v8/*.cc", | ||
]), | ||
deps = [ | ||
":common_lib", | ||
# TODO(@mathetake): Add V8 lib. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW, it's probably not worth spending time too much time on getting V8 to build, and we can wait until Bazel is officially supported in V8. |
||
], | ||
) | ||
|
||
cc_library( | ||
name = "wasmtime_lib", | ||
srcs = glob([ | ||
"src/wasmtime/*.h", | ||
"src/wasmtime/*.cc", | ||
]), | ||
deps = [ | ||
":common_lib", | ||
"@wasm_c_api//:wasmtime_lib", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "wavm_lib", | ||
srcs = glob([ | ||
# TODO(@mathetake): Add WAVM lib. | ||
# "src/wavm/*.h", | ||
# "src/wavm/*.cc", | ||
]), | ||
deps = [ | ||
":common_lib", | ||
# TODO(@mathetake): Add WAVM lib. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any chance you could try to add WAVM here? Or do you prefer to leave it for a separate PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will do in a separate PR. |
||
], | ||
) | ||
|
||
cc_library( | ||
name = "lib", | ||
deps = [ | ||
":common_lib", | ||
] + proxy_wasm_select_wasm_runtime_wasmtime( | ||
["wasmtime_lib"], | ||
) + proxy_wasm_select_wasm_runtime_v8( | ||
["v8_lib"], | ||
) + proxy_wasm_select_wasm_runtime_wavm( | ||
["wavm_lib"], | ||
), | ||
mathetake marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
config_setting( | ||
name = "wasm_runtime_wavm", | ||
values = {"define": "wasm_runtime=wavm"}, | ||
mathetake marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) | ||
|
||
config_setting( | ||
name = "wasm_runtime_v8", | ||
values = {"define": "wasm_runtime=v8"}, | ||
) | ||
|
||
config_setting( | ||
name = "wasm_runtime_wasmtime", | ||
values = {"define": "wasm_runtime=wasmtime"}, | ||
) | ||
mathetake marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
def proxy_wasm_select_wasm_runtime_v8(xs): | ||
return select({ | ||
"@proxy_wasm_cpp_host//bazel:wasm_runtime_v8": xs, | ||
"//conditions:default": [], | ||
}) | ||
|
||
def proxy_wasm_select_wasm_runtime_wavm(xs): | ||
return select({ | ||
"@proxy_wasm_cpp_host//bazel:wasm_runtime_wavm": xs, | ||
"//conditions:default": [], | ||
}) | ||
|
||
def proxy_wasm_select_wasm_runtime_wasmtime(xs): | ||
return select({ | ||
"@proxy_wasm_cpp_host//bazel:wasm_runtime_wasmtime": xs, | ||
"//conditions:default": [], | ||
}) | ||
mathetake marked this conversation as resolved.
Show resolved
Hide resolved
|
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.