mirror of
https://github.com/bspeice/aeron-rs
synced 2024-12-21 13:38:07 -05:00
Add support for Windows lib lookup directory
This commit is contained in:
parent
67a24a35d8
commit
ffe015e9db
@ -46,12 +46,17 @@ pub fn main() {
|
||||
link_type.link_lib(),
|
||||
link_type.target_name()
|
||||
);
|
||||
let lib_dir = Config::new(&aeron_path)
|
||||
let cmake_output = Config::new(&aeron_path)
|
||||
.build_target(link_type.target_name())
|
||||
.build();
|
||||
|
||||
// Trying to figure out the final path is a bit weird;
|
||||
// For Linux/OSX, it's just build/lib
|
||||
// For Windows, it's build/lib/{profile}
|
||||
let lib_dir = lib_output_dir(&cmake_output);
|
||||
println!(
|
||||
"cargo:rustc-link-search=native={}",
|
||||
lib_dir.join("build/lib").display()
|
||||
lib_dir.display()
|
||||
);
|
||||
|
||||
println!("cargo:include={}", header_path.display());
|
||||
@ -65,3 +70,15 @@ pub fn main() {
|
||||
.write_to_file(out_path.join("bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
||||
|
||||
fn lib_output_dir(cmake_dir: &PathBuf) -> PathBuf {
|
||||
if cfg!(target_os = "windows") {
|
||||
if cmake_dir.join("build/lib/Debug").exists() {
|
||||
cmake_dir.join("build/lib/Debug")
|
||||
} else {
|
||||
cmake_dir.join("build/lib/Release")
|
||||
}
|
||||
} else {
|
||||
cmake_dir.join("build/lib")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user