Windows packaging: assert every linked OCCT toolkit has a DLL to ship

The previous guard only caught an empty glob. That is the wrong invariant.
The glob ships whatever the deps prefix holds, which is not the same as what
libslic3r links.

This fork sets BUILD_MODULE_ModelingAlgorithms=ON; upstream OrcaSlicer sets it
OFF. Upstream's DataExchange module pulls in most ModelingAlgorithms toolkits
transitively, but not TKFillet and TKOffset -- those two exist only because we
turned the module on. So a source build against a deps tree carried over from
upstream has 40 of the 42 OCCT DLLs. The glob copies all 40, the build
succeeds, and the slicer dies at launch with "error 126 (dependency not
found)". Reported by SoftFever, who named exactly those two DLLs.

CI is unaffected: the deps cache key is hashFiles('deps/**'), so flipping the
OCCT flag invalidated it and every shipped artifact has all 42.

Publish OCCT_LIBS from libslic3r as the single source of truth and check each
toolkit has a DLL, so the list can never drift from what we link. Verified
against a simulated stale prefix: the configure fails naming exactly
TKFillet.dll;TKOffset.dll, and passes when both are present.

Windows-only: every call site of the copy function is inside if (WIN32).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVzKmX6Y1aEteit1HTXG4Q
This commit is contained in:
Tommaso Bianchi
2026-07-10 08:48:11 +02:00
co-authored by Claude Opus 4.8
parent d568e89c34
commit 546cef5f42
2 changed files with 23 additions and 7 deletions
+20 -7
View File
@@ -817,14 +817,27 @@ function(orcaslicer_copy_dlls target config postfix output_dlls)
# TKOffset/TKBool/TKFeat. Glob everything instead; the built occt/ dir is the one
# source of truth. (OCCT is Shared only on Windows — deps/OCCT/OCCT.cmake.)
file(GLOB _occt_dlls "${CMAKE_PREFIX_PATH}/bin/occt/*.dll")
# A glob that matches nothing yields an empty list and copies nothing, so the package
# would ship with no OpenCASCADE at all and die at launch with error 126. The explicit
# per-file list this replaced failed the configure instead. Keep that loudness.
if (NOT _occt_dlls)
# The glob degrades silently: it ships whatever the deps prefix holds. That is not the
# same as shipping what we link. A deps tree built with BUILD_MODULE_ModelingAlgorithms=OFF
# (upstream OrcaSlicer's setting) simply has no TKFillet.dll / TKOffset.dll, so the glob
# copies 40 of 42 DLLs, the build succeeds, and the slicer dies at launch with
# "error 126 (dependency not found)". The explicit per-file list this replaced failed
# the configure instead. Assert the real invariant: every linked toolkit has a DLL.
if (NOT OCCT_LIBS)
message(FATAL_ERROR "OCCT_LIBS is not set; libslic3r must be configured first.")
endif ()
set(_missing_occt "")
foreach (_tk IN LISTS OCCT_LIBS)
if (NOT EXISTS "${CMAKE_PREFIX_PATH}/bin/occt/${_tk}.dll")
list(APPEND _missing_occt "${_tk}.dll")
endif ()
endforeach ()
if (_missing_occt)
message(FATAL_ERROR
"No OCCT DLLs found in ${CMAKE_PREFIX_PATH}/bin/occt/. Build the dependencies "
"first (build_release_vs2022.bat deps); refusing to package a slicer without "
"OpenCASCADE, which would fail at startup with error 126.")
"OCCT DLLs missing from ${CMAKE_PREFIX_PATH}/bin/occt/: ${_missing_occt}\n"
"Rebuild the dependencies (build_release_vs2022.bat deps). This fork sets "
"BUILD_MODULE_ModelingAlgorithms=ON, so a deps tree built from upstream "
"OrcaSlicer lacks TKFillet/TKOffset and the slicer would fail at startup.")
endif ()
file(COPY ${_occt_dlls}
${CMAKE_PREFIX_PATH}/bin/freetype.dll
+3
View File
@@ -595,6 +595,9 @@ set(OCCT_LIBS
TKMath
TKernel
)
# Publish the link list so the Windows packaging step can assert it ships a DLL for
# every toolkit we link, instead of shipping whatever the deps prefix happens to hold.
set(OCCT_LIBS "${OCCT_LIBS}" CACHE INTERNAL "OCCT toolkits linked by libslic3r")
target_link_libraries(libslic3r
PUBLIC