Update project structure and configurations

This commit is contained in:
2026-05-23 10:19:55 +02:00
parent ab5dc7e568
commit 62efea0646
1832 changed files with 83568 additions and 51829 deletions

View File

@@ -32,23 +32,27 @@ fn main() {
if let Some(coolprop_path) = coolprop_src_path() {
println!("cargo:rerun-if-changed={}", coolprop_path.display());
// Build CoolProp using CMake
let dst = cmake::Config::new(&coolprop_path)
// Build CoolProp using CMake (always Release to match Rust's CRT)
let mut config = cmake::Config::new(&coolprop_path);
config
.define("COOLPROP_SHARED_LIBRARY", "OFF")
.define("COOLPROP_STATIC_LIBRARY", "ON")
.define("COOLPROP_CATCH_TEST", "OFF")
.define("COOLPROP_C_LIBRARY", "ON")
.define("COOLPROP_MY_IFCO3_WRAPPER", "OFF")
.build();
.profile("Release");
let dst = config.build();
println!("cargo:rustc-link-search=native={}/build", dst.display());
println!("cargo:rustc-link-search=native={}/build/Debug", dst.display());
println!("cargo:rustc-link-search=native={}/build/Release", dst.display());
println!("cargo:rustc-link-search=native={}/lib", dst.display());
println!(
"cargo:rustc-link-search=native={}/build",
coolprop_path.display()
); // Fallback
// Link against CoolProp statically
// Link against CoolProp statically (always Release build, no 'd' suffix)
println!("cargo:rustc-link-lib=static=CoolProp");
// On macOS, force load the static library so its symbols are exported in the final cdylib

View File

@@ -130,10 +130,10 @@ pub enum CoolPropInputPair {
// CoolProp C functions
extern "C" {
/// Get a property value using pressure and temperature
/// Get a property value using pressure and temperature
#[cfg_attr(target_os = "macos", link_name = "\x01__Z7PropsSIPKcS0_dS0_dS0_")]
#[cfg_attr(not(target_os = "macos"), link_name = "_Z7PropsSIPKcS0_dS0_dS0_")]
#[cfg_attr(all(not(target_os = "macos"), not(target_os = "windows")), link_name = "_Z7PropsSIPKcS0_dS0_dS0_")]
#[cfg_attr(target_os = "windows", link_name = "?PropsSI@@YANPEBD0N0N0@Z")]
fn PropsSI(
Output: *const c_char,
Name1: *const c_char,
@@ -145,12 +145,14 @@ extern "C" {
/// Get a property value using input pair
#[cfg_attr(target_os = "macos", link_name = "\x01__Z8Props1SIPKcS0_")]
#[cfg_attr(not(target_os = "macos"), link_name = "_Z8Props1SIPKcS0_")]
#[cfg_attr(all(not(target_os = "macos"), not(target_os = "windows")), link_name = "_Z8Props1SIPKcS0_")]
#[cfg_attr(target_os = "windows", link_name = "?Props1SI@@YANPEBD0@Z")]
fn Props1SI(Fluid: *const c_char, Output: *const c_char) -> c_double;
/// Get CoolProp version string
#[cfg_attr(target_os = "macos", link_name = "\x01__Z23get_global_param_stringPKcPci")]
#[cfg_attr(not(target_os = "macos"), link_name = "get_global_param_string")]
#[cfg_attr(all(not(target_os = "macos"), not(target_os = "windows")), link_name = "get_global_param_string")]
#[cfg_attr(target_os = "windows", link_name = "?get_global_param_string@@YAJPEBDPEADH@Z")]
fn get_global_param_string(
Param: *const c_char,
Output: *mut c_char,
@@ -159,7 +161,8 @@ extern "C" {
/// Get fluid info
#[cfg_attr(target_os = "macos", link_name = "\x01__Z22get_fluid_param_stringPKcS0_Pci")]
#[cfg_attr(not(target_os = "macos"), link_name = "get_fluid_param_string")]
#[cfg_attr(all(not(target_os = "macos"), not(target_os = "windows")), link_name = "get_fluid_param_string")]
#[cfg_attr(target_os = "windows", link_name = "?get_fluid_param_string@@YAJPEBD0PEADH@Z")]
fn get_fluid_param_string(
Fluid: *const c_char,
Param: *const c_char,