oodle: Fix linking statically #121

Merged
lucas merged 8 commits from issue/static-linking into master 2023-11-08 11:12:26 +01:00
2 changed files with 11 additions and 13 deletions
Showing only changes of commit 48f98a43fe - Show all commits

View file

@ -21,6 +21,7 @@
- all: force unix path separators for engine values - all: force unix path separators for engine values
- dtmt: fix extracing files with non-flattened file names - dtmt: fix extracing files with non-flattened file names
- oodle: fix static linking
== 2023-03-01 == 2023-03-01

View file

@ -4,24 +4,21 @@ use std::env;
use std::path::PathBuf; use std::path::PathBuf;
fn main() { fn main() {
// Tell cargo to look for shared libraries in the specified directory let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").expect("No CARGO_MANIFEST_DIR");
if let Ok(manifest_dir) = std::env::var("CARGO_MANIFEST_DIR") { println!("cargo:rustc-link-search=native={}", &manifest_dir);
println!("cargo:rustc-link-search={}", manifest_dir);
dbg!(&manifest_dir); dbg!(&manifest_dir);
}
let lib_name = if std::env::var("CARGO_CFG_WINDOWS").is_ok() { if std::env::var("CARGO_CFG_WINDOWS").is_ok() {
if cfg!(debug_assertions) { let lib_name = if cfg!(debug_assertions) {
"oo2core_win64_debug" "oo2core_win64_debug"
} else { } else {
"oo2core_win64" "oo2core_win64"
}
} else {
"oo2corelinux64"
}; };
println!("cargo:rustc-link-lib=static={}", lib_name);
println!("cargo:rustc-link-lib={}", lib_name); } else {
dbg!(&lib_name); println!("cargo:rustc-link-lib=static=oo2corelinux64");
println!("cargo:rustc-link-lib=stdc++")
}
println!("cargo:rerun-if-changed=oodle2.h"); println!("cargo:rerun-if-changed=oodle2.h");