opencascade-rs
opencascade-rs copied to clipboard
Fix Windows build: CMake profile matching and missing system libraries
Problem
Building on Windows with MSVC fails with two issues:
-
PDB file errors: CMake is hardcoded to Release profile, causing "cannot find TKernel.pdb" errors when building with
cargo build(debug mode) -
Linker errors: Missing Windows system libraries causing 23 unresolved external symbols (e.g.,
SetFileSecurityW,OpenProcessToken,RegOpenKeyW)
Solution
-
crates/occt-sys/src/lib.rs: ReadPROFILEenvironment variable from Cargo and pass the correct profile to CMake (Debug vs Release) -
crates/opencascade-sys/build.rs: Add missing Windows system libraries:-
advapi32.lib- Security and registry APIs -
gdi32.lib- Graphics Device Interface -
shell32.lib- Windows Shell API -
comdlg32.lib- Common Dialog Box
-
Testing
- [x] Successfully builds on Windows 11 with
cargo build --release - [x] Successfully builds on Windows 11 with
cargo build(debug) - [x] Both MSVC Release and Debug profiles now work correctly
Notes
This appears to be Windows-specific as Linux builds work fine (debug symbols are embedded in binaries, and these Windows libraries aren't needed).
Fixes the build issues reported by Windows users.