fix build.rs is broken on Windows (rust.nim:112–115). lib_ext is only set under cfg(target_os = "macos"|"linux"). On Windows the symbol is undefined → compile error. The

CMakeLists handles Windows; the Rust generator should either match or fail loudly.
This commit is contained in:
Ivan FB 2026-05-11 21:25:05 +02:00
parent 51ed83b04a
commit 8479fb8ad3
No known key found for this signature in database
GPG Key ID: DF0C67A04C543270
2 changed files with 20 additions and 8 deletions

View File

@ -21,12 +21,18 @@ fn main() {
}
}
// Match the per-OS shared-library naming used by the CMakeLists:
// macOS: lib<name>.dylib
// Linux: lib<name>.so
// Windows: <name>.dll (Cargo links the auto-generated <name>.lib import lib)
#[cfg(target_os = "macos")]
let lib_ext = "dylib";
let out_lib = repo_root.join("libnimtimer.dylib");
#[cfg(target_os = "linux")]
let lib_ext = "so";
let out_lib = repo_root.join(format!("libnimtimer.{lib_ext}"));
let out_lib = repo_root.join("libnimtimer.so");
#[cfg(target_os = "windows")]
let out_lib = repo_root.join("nimtimer.dll");
#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))]
compile_error!("nim-ffi build.rs: unsupported target OS (expected macos, linux, or windows)");
let mut cmd = Command::new("nim");
cmd.arg("c")

View File

@ -109,12 +109,18 @@ fn main() {
}
}
// Match the per-OS shared-library naming used by the CMakeLists:
// macOS: lib<name>.dylib
// Linux: lib<name>.so
// Windows: <name>.dll (Cargo links the auto-generated <name>.lib import lib)
#[cfg(target_os = "macos")]
let lib_ext = "dylib";
let out_lib = repo_root.join("lib$2.dylib");
#[cfg(target_os = "linux")]
let lib_ext = "so";
let out_lib = repo_root.join(format!("lib$2.{lib_ext}"));
let out_lib = repo_root.join("lib$2.so");
#[cfg(target_os = "windows")]
let out_lib = repo_root.join("$2.dll");
#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))]
compile_error!("nim-ffi build.rs: unsupported target OS (expected macos, linux, or windows)");
let mut cmd = Command::new("nim");
cmd.arg("c")