oodle: Fix linking statically
Some checks failed
lint/clippy Checking for common mistakes and opportunities for code improvement
build/linux Build for the target platform: linux
build/msvc Build for the target platform: msvc

This commit is contained in:
Lucas Schwiderski 2023-09-13 16:46:26 +02:00
parent 6a2eccb630
commit 48f98a43fe
Signed by: lucas
GPG key ID: AA12679AAA6DF4D8
2 changed files with 11 additions and 13 deletions

View file

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

View file

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