Krys4lide/build.rs

33 lines
1.3 KiB
Rust

// use std::env;
// use std::path::PathBuf;
fn main() {
// --- OLD VERSION ---
// In fact, the commented code is not necessary
// Indeed, the static library is automatically found
// when the directory is provided by rustflags in Cargo.toml
// The dynamic library is found in the PATH or LD_LIBRARY_PATH
// let static_lib_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("lib");
// println!("cargo:rustc-link-search=native={}", static_lib_path.display());
// println!("cargo:rustc-link-lib=static=p4pillondebuglib");
// println!("cargo:rerun-if-changed={}", static_lib_path.join("libp4pillondebuglib.lib").display());
// let dynamic_lib_path = PathBuf::from("C:/Program Files/santesocial/fsv/1.40.13/lib");
// println!("cargo:rustc-link-search=native={}", dynamic_lib_path.display());
// println!("cargo:rustc-link-lib=dylib=ssvw64");
// println!("cargo:rerun-if-changed={}", dynamic_lib_path.join("ssvw64.dll").display());
// --- NEW VERSION ---
// Cross-platform libraries
println!("cargo:rustc-link-lib=static=p4pillondebuglib");
// Target-specific libraries
if cfg!(target_os = "windows") {
println!("cargo:rustc-link-lib=dylib=ssvw64");
} else if cfg!(target_os = "linux") {
println!("cargo:rustc-link-lib=dylib=ssvlux64");
}
}