mirror of
https://github.com/bdwgc/bdwgc-rust.git
synced 2026-05-29 09:58:55 -06:00
add optional cmake builds
This commit is contained in:
27
build.rs
27
build.rs
@@ -1,6 +1,7 @@
|
||||
const LIB_ATOMIC_OPS_DIR: &str = "vendor/libatomic_ops";
|
||||
const LIB_GC_DIR: &str = "vendor/bdwgc";
|
||||
|
||||
#[cfg(feature = "autotools")]
|
||||
fn main() {
|
||||
for dir in &[LIB_ATOMIC_OPS_DIR, LIB_GC_DIR] {
|
||||
std::process::Command::new("sh")
|
||||
@@ -41,3 +42,29 @@ fn main() {
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "cmake")]
|
||||
fn main() {
|
||||
use cmake::Config;
|
||||
use std::path::Path;
|
||||
|
||||
let libatomic_include_path = Path::new(LIB_ATOMIC_OPS_DIR)
|
||||
.join("src")
|
||||
.canonicalize()
|
||||
.unwrap()
|
||||
.display()
|
||||
.to_string()
|
||||
.replace(r"\\?\", "");
|
||||
|
||||
let dst = Config::new(LIB_GC_DIR)
|
||||
.profile("Release")
|
||||
.define("BUILD_SHARED_LIBS", "FALSE")
|
||||
.cflag(format!("-I{}", libatomic_include_path))
|
||||
.build();
|
||||
|
||||
println!(
|
||||
"cargo:rustc-link-search=native={}",
|
||||
dst.join("lib").display()
|
||||
);
|
||||
println!("cargo:rustc-link-lib=static=gc");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user