-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathbuild.rs
48 lines (42 loc) · 1.23 KB
/
build.rs
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use std::env;
use std::process::Command;
// WASMTIME_FEATURE_LIST
const FEATURES: &[&str] = &[
"ASYNC",
"PROFILING",
"CACHE",
"PARALLEL_COMPILATION",
"WASI",
"LOGGING",
"DISABLE_LOGGING",
"COREDUMP",
"ADDR2LINE",
"DEMANGLE",
"THREADS",
"GC",
"GC_DRC",
"GC_NULL",
"CRANELIFT",
"WINCH",
"COMPONENT_MODEL",
];
// ... if you add a line above this be sure to change the other locations
// marked WASMTIME_FEATURE_LIST
fn main() {
println!("cargo:rerun-if-changed=cmake/features.cmake");
println!("cargo:rerun-if-changed=cmake/install-headers.cmake");
println!("cargo:rerun-if-changed=include");
let out_dir = std::env::var("OUT_DIR").unwrap();
let mut cmake = Command::new("cmake");
cmake.arg("-DWASMTIME_DISABLE_ALL_FEATURES=ON");
cmake.arg(format!("-DCMAKE_INSTALL_PREFIX={out_dir}"));
for f in FEATURES {
if env::var_os(format!("CARGO_FEATURE_{f}")).is_some() {
cmake.arg(format!("-DWASMTIME_FEATURE_{f}=ON"));
}
}
cmake.arg("-P").arg("cmake/install-headers.cmake");
let status = cmake.status().expect("failed to spawn `cmake`");
assert!(status.success());
println!("cargo:include={out_dir}/include");
}