mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-11-21 20:28:58 +00:00
Add crate feature that controls whether custom libcxx is used (#924)
The `use_custom_libcxx` feature is enabled by default. When this feature is disabled, the crate will link with the system libcxx instead.
This commit is contained in:
parent
0c43be27a1
commit
43893f726d
@ -75,6 +75,10 @@ exclude = [
|
|||||||
"!v8/tools/testrunner/utils/dump_build_config.py",
|
"!v8/tools/testrunner/utils/dump_build_config.py",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["use_custom_libcxx"]
|
||||||
|
use_custom_libcxx = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
libc = "0.2.93"
|
libc = "0.2.93"
|
||||||
|
26
build.rs
26
build.rs
@ -109,6 +109,10 @@ fn build_v8() {
|
|||||||
vec!["is_debug=false".to_string()]
|
vec!["is_debug=false".to_string()]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if cfg!(not(feature = "use_custom_libcxx")) {
|
||||||
|
gn_args.push("use_custom_libcxx=false".to_string());
|
||||||
|
}
|
||||||
|
|
||||||
if !is_debug() {
|
if !is_debug() {
|
||||||
gn_args.push("v8_enable_handle_zapping=false".to_string());
|
gn_args.push("v8_enable_handle_zapping=false".to_string());
|
||||||
}
|
}
|
||||||
@ -398,6 +402,28 @@ fn download_static_lib_binaries() {
|
|||||||
fn print_link_flags() {
|
fn print_link_flags() {
|
||||||
println!("cargo:rustc-link-lib=static=rusty_v8");
|
println!("cargo:rustc-link-lib=static=rusty_v8");
|
||||||
|
|
||||||
|
let should_dyn_link_libcxx = cfg!(not(feature = "use_custom_libcxx"))
|
||||||
|
|| env::var("GN_ARGS").map_or(false, |gn_args| {
|
||||||
|
gn_args
|
||||||
|
.split_whitespace()
|
||||||
|
.any(|ba| ba == "use_custom_libcxx=false")
|
||||||
|
});
|
||||||
|
|
||||||
|
if should_dyn_link_libcxx {
|
||||||
|
// Based on https://github.com/alexcrichton/cc-rs/blob/fba7feded71ee4f63cfe885673ead6d7b4f2f454/src/lib.rs#L2462
|
||||||
|
let target = env::var("TARGET").unwrap();
|
||||||
|
if target.contains("apple")
|
||||||
|
|| target.contains("freebsd")
|
||||||
|
|| target.contains("openbsd")
|
||||||
|
{
|
||||||
|
println!("cargo:rustc-link-lib=dylib=c++");
|
||||||
|
} else if target.contains("linux") {
|
||||||
|
println!("cargo:rustc-link-lib=dylib=stdc++");
|
||||||
|
} else if target.contains("android") {
|
||||||
|
println!("cargo:rustc-link-lib=dylib=c++_shared");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if cfg!(target_os = "windows") {
|
if cfg!(target_os = "windows") {
|
||||||
println!("cargo:rustc-link-lib=dylib=winmm");
|
println!("cargo:rustc-link-lib=dylib=winmm");
|
||||||
println!("cargo:rustc-link-lib=dylib=dbghelp");
|
println!("cargo:rustc-link-lib=dylib=dbghelp");
|
||||||
|
Loading…
Reference in New Issue
Block a user