mirror of
https://github.com/google/googletest.git
synced 2025-12-07 01:06:50 +08:00
avoid -lpthread link option when building with emscripten without threads
- having this flag causes emscripten to generate binary with pthread support, which is not compatible with browsers that do not support pthreads or with web pages that do not enable pthread support
This commit is contained in:
parent
eb2d85edd0
commit
ab94ddbd0e
13
BUILD.bazel
13
BUILD.bazel
@ -56,6 +56,16 @@ config_setting(
|
|||||||
constraint_values = ["@platforms//os:openbsd"],
|
constraint_values = ["@platforms//os:openbsd"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
config_setting(
|
||||||
|
name = "emscripten_without_threads",
|
||||||
|
constraint_values = [
|
||||||
|
"@platforms//os:emscripten",
|
||||||
|
],
|
||||||
|
values = {
|
||||||
|
"features": "-use_pthreads",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
# NOTE: Fuchsia is not an officially supported platform.
|
# NOTE: Fuchsia is not an officially supported platform.
|
||||||
config_setting(
|
config_setting(
|
||||||
name = "fuchsia",
|
name = "fuchsia",
|
||||||
@ -111,10 +121,12 @@ cc_library(
|
|||||||
copts = select({
|
copts = select({
|
||||||
":qnx": [],
|
":qnx": [],
|
||||||
":windows": [],
|
":windows": [],
|
||||||
|
":emscripten_without_threads": [],
|
||||||
"//conditions:default": ["-pthread"],
|
"//conditions:default": ["-pthread"],
|
||||||
}),
|
}),
|
||||||
defines = select({
|
defines = select({
|
||||||
":has_absl": ["GTEST_HAS_ABSL=1"],
|
":has_absl": ["GTEST_HAS_ABSL=1"],
|
||||||
|
":emscripten_without_threads": ["GTEST_HAS_PTHREAD=0"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
features = select({
|
features = select({
|
||||||
@ -138,6 +150,7 @@ cc_library(
|
|||||||
"-lm",
|
"-lm",
|
||||||
"-pthread",
|
"-pthread",
|
||||||
],
|
],
|
||||||
|
":emscripten_without_threads": [],
|
||||||
"//conditions:default": ["-pthread"],
|
"//conditions:default": ["-pthread"],
|
||||||
}),
|
}),
|
||||||
deps = select({
|
deps = select({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user