-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathbuild.rs
31 lines (27 loc) · 1.1 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
fn main() {
lalrpop::Configuration::new()
.use_cargo_dir_conventions()
.process_file("src/parser/grammar.lalrpop")
.unwrap();
#[cfg(feature = "nix-experimental")]
{
use cxx_build::CFG;
use std::path::PathBuf;
for lib in &["nix-store", "nix-cmd", "nix-expr", "nix-main"] {
let lib = pkg_config::Config::new()
.atleast_version("2.16.0")
.probe(lib)
.unwrap();
let lib_include_paths = lib.include_paths.iter().map(PathBuf::as_path);
CFG.exported_header_dirs.extend(lib_include_paths);
}
cxx_build::bridge("src/nix_ffi/mod.rs")
.file("src/nix_ffi/cpp/nix.cc")
.flag_if_supported("-std=c++20")
.flag_if_supported("-U_FORTIFY_SOURCE") // Otherwise builds with `-O0` raise a lot of warnings
.compile("nickel-lang");
println!("cargo:rerun-if-changed=src/nix_ffi/mod.rs");
println!("cargo:rerun-if-changed=src/nix_ffi/cpp/nix.cc");
println!("cargo:rerun-if-changed=src/nix_ffi/cpp/nix.hh");
}
}