Skip to content

Commit 46fc738

Browse files
committed
Fix Windows DLL load by using static MSVC runtime
- Add MSVC_RUNTIME_LIBRARY=MultiThreaded to statically link MSVC runtime - Build CFD library with same static runtime to avoid runtime mismatch - This eliminates dependency on VC++ redistributable
1 parent a32b65a commit 46fc738

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/build-wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- name: Build CFD library (Windows)
5050
if: runner.os == 'Windows'
5151
run: |
52-
cmake -S cfd -B cfd/build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
52+
cmake -S cfd -B cfd/build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
5353
cmake --build cfd/build --config Release
5454
echo "=== CFD library built ==="
5555
dir cfd\build\lib\Release

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ set_target_properties(cfd_python PROPERTIES
5959
C_STANDARD 11
6060
)
6161

62+
# On Windows, use static MSVC runtime to avoid requiring VC++ redistributable
63+
if(MSVC)
64+
set_property(TARGET cfd_python PROPERTY
65+
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
66+
endif()
67+
6268
# Configure stable ABI if enabled
6369
if(CFD_USE_STABLE_ABI)
6470
# Define Py_LIMITED_API for Python 3.8+ stable ABI

0 commit comments

Comments
 (0)