Skip to content

build: move global copts/linkopts into specific targets. #269

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

Merged
merged 1 commit into from
Feb 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,10 @@ build:zig-cc-linux-aarch64 --test_env=QEMU_LD_PREFIX=/usr/aarch64-linux-gnu/

build --enable_platform_specific_config

# Use C++17.
build:linux --cxxopt=-std=c++17
# See https://bytecodealliance.github.io/wasmtime/c-api/
build:linux --linkopt=-lm
build:linux --linkopt=-lpthread
build:linux --linkopt=-ldl

build:macos --cxxopt=-std=c++17
build:windows --cxxopt="/std:c++17"

# Enable runfiles on Windows (enabled by default on other platforms).
build:windows --enable_runfiles
build:windows --cxxopt="/std:c++17"
# See https://bytecodealliance.github.io/wasmtime/c-api/
build:windows --copt="/DWASM_API_EXTERN="
build:windows --linkopt="ws2_32.lib advapi32.lib userenv.lib ntdll.lib shell32.lib ole32.lib bcrypt.lib"
49 changes: 49 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,31 @@ cc_library(
"src/wasmtime/wasmtime.cc",
],
hdrs = ["include/proxy-wasm/wasmtime.h"],
copts = [
"-DWASM_API_EXTERN=",
],
defines = [
"PROXY_WASM_HAS_RUNTIME_WASMTIME",
"PROXY_WASM_HOST_ENGINE_WASMTIME",
],
# See: https://bytecodealliance.github.io/wasmtime/c-api/
linkopts = select({
"@platforms//os:macos": [],
"@platforms//os:windows": [
"ws2_32.lib",
"advapi32.lib",
"userenv.lib",
"ntdll.lib",
"shell32.lib",
"ole32.lib",
"bcrypt.lib",
],
"//conditions:default": [
"-ldl",
"-lm",
"-lpthread",
],
}),
deps = [
":wasm_vm_headers",
"//external:wasmtime",
Expand Down Expand Up @@ -179,10 +200,31 @@ cc_library(
"src/wasmtime/prefixed_wasmtime.cc",
],
hdrs = ["include/proxy-wasm/wasmtime.h"],
copts = [
"-DWASM_API_EXTERN=",
],
defines = [
"PROXY_WASM_HAS_RUNTIME_WASMTIME",
"PROXY_WASM_HOST_ENGINE_WASMTIME",
],
# See: https://bytecodealliance.github.io/wasmtime/c-api/
linkopts = select({
"@platforms//os:macos": [],
"@platforms//os:windows": [
"ws2_32.lib",
"advapi32.lib",
"userenv.lib",
"ntdll.lib",
"shell32.lib",
"ole32.lib",
"bcrypt.lib",
],
"//conditions:default": [
"-ldl",
"-lm",
"-lpthread",
],
}),
deps = [
":wasm_vm_headers",
"//external:prefixed_wasmtime",
Expand All @@ -204,6 +246,13 @@ cc_library(
"PROXY_WASM_HAS_RUNTIME_WAVM",
"PROXY_WASM_HOST_ENGINE_WAVM",
],
linkopts = select({
"@platforms//os:macos": [],
"@platforms//os:windows": [],
"//conditions:default": [
"-ldl",
],
}),
deps = [
":wasm_vm_headers",
"//external:wavm",
Expand Down