forked from fast-pack/FastPFOR-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
32 lines (28 loc) · 1.04 KB
/
Copy pathbuild.rs
File metadata and controls
32 lines (28 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
fn main() {
#[cfg(feature = "cpp")]
{
use std::path::Path;
assert!(
Path::new("cpp/CMakeLists.txt").exists(),
"FastPFOR submodule not initialized. Run `git submodule update --init`."
);
// Compile FastPFOR using CMake
println!("cargo:rerun-if-changed=cpp");
let lib_path = cmake::Config::new("cpp")
.define("WITH_TEST", "OFF")
.build()
.join("lib");
let lib_path = lib_path.to_str().unwrap();
// Compile the bridge
println!("cargo:rerun-if-changed=src/cpp/fastpfor_bridge.h");
println!("cargo:rerun-if-changed=src/cpp/mod.rs");
cxx_build::bridge("src/cpp/mod.rs")
.include("cpp/headers")
.include("src/cpp")
.std("c++14")
.compile("fastpfor_bridge");
// Link the FastPFOR library - must be done after the bridge is compiled
println!("cargo:rustc-link-search=native={lib_path}");
println!("cargo:rustc-link-lib=static=FastPFOR");
}
}