From 48f98a43fe8d8888e20a300645b08d9d694fd25a Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 13 Sep 2023 16:46:26 +0200 Subject: [PATCH] oodle: Fix linking statically --- CHANGELOG.adoc | 1 + lib/oodle/build.rs | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 2e2b7a4..4d1861c 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -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 diff --git a/lib/oodle/build.rs b/lib/oodle/build.rs index cc416c5..7b200aa 100644 --- a/lib/oodle/build.rs +++ b/lib/oodle/build.rs @@ -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); - dbg!(&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" - } + }; + println!("cargo:rustc-link-lib=static={}", lib_name); } else { - "oo2corelinux64" - }; - - println!("cargo:rustc-link-lib={}", lib_name); - dbg!(&lib_name); + println!("cargo:rustc-link-lib=static=oo2corelinux64"); + println!("cargo:rustc-link-lib=stdc++") + } println!("cargo:rerun-if-changed=oodle2.h");