Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions libmimalloc-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::env;
use std::path::Path;

fn main() {
let mut build = cc::Build::new();
Expand All @@ -9,6 +10,18 @@ fn main() {
"v2"
};

let cargo_manifest_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
let include_dir = Path::new(&cargo_manifest_dir)
.join("c_src/mimalloc/")
.join(version)
.join("include")
.to_str()
.expect("include path is not valid UTF-8")
.to_string();
// Make the include directory available to consumers via the `DEP_MIMALLOC_INCLUDE_DIR`
// environment variable.
println!("cargo:INCLUDE_DIR={include_dir}");

build.include(format!("c_src/mimalloc/{version}/include"));
build.include(format!("c_src/mimalloc/{version}/src"));
build.file(format!("c_src/mimalloc/{version}/src/static.c"));
Expand Down