From 08128911e32cc70da42045d3d0c516c468d187d3 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 24 Jun 2026 00:36:59 -0300 Subject: [PATCH] fix: copy runtime DLLs for Ninja generator on Windows The runtime DLL copy was nested under CMAKE_CONFIGURATION_TYPES, so it only ran for multi-config generators. Ninja single-config leaves that variable empty, which skipped copying OCCT, GMP, MPFR, WebView2, and freetype DLLs next to the executable. Run the copy logic for both generator styles while keeping it Windows-only. --- src/CMakeLists.txt | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 73c767dad2..6ccd480e3b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -212,14 +212,6 @@ if (WIN32) VERBATIM ) endforeach () - - if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - orcaslicer_copy_dlls(COPY_DLLS "Debug" "d" output_dlls_Debug) - elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") - orcaslicer_copy_dlls(COPY_DLLS "RelWithDebInfo" "" output_dlls_Release) - else() - orcaslicer_copy_dlls(COPY_DLLS "Release" "" output_dlls_Release) - endif() else () file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/resources" WIN_RESOURCES_SYMLINK) add_custom_command(TARGET OrcaSlicer POST_BUILD @@ -229,6 +221,27 @@ if (WIN32) ) endif () + if (CMAKE_CONFIGURATION_TYPES) + # Multi-config generators (Visual Studio, Ninja Multi-Config): copy per config. + foreach (cfg ${CMAKE_CONFIGURATION_TYPES}) + if ("${cfg}" STREQUAL "Debug") + orcaslicer_copy_dlls(COPY_DLLS "Debug" "d" output_dlls_Debug) + elseif("${cfg}" STREQUAL "RelWithDebInfo") + orcaslicer_copy_dlls(COPY_DLLS "RelWithDebInfo" "" output_dlls_RelWithDebInfo) + else() + orcaslicer_copy_dlls(COPY_DLLS "${cfg}" "" output_dlls_${cfg}) + endif() + endforeach() + else() + # Single-config generators (Ninja): use CMAKE_BUILD_TYPE. + if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + orcaslicer_copy_dlls(COPY_DLLS "Debug" "d" output_dlls_Debug) + elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") + orcaslicer_copy_dlls(COPY_DLLS "RelWithDebInfo" "" output_dlls_RelWithDebInfo) + else() + orcaslicer_copy_dlls(COPY_DLLS "Release" "" output_dlls_Release) + endif() + endif() else () if (APPLE AND NOT CMAKE_MACOSX_BUNDLE)