Build only the OCCT and solver pieces the Design tab needs

SLIC3R_CAD=OFF now builds without SolveSpace or OCCT's ModelingAlgorithms
module, leaving the dependency set identical to upstream's, and the Design
tab's mate connector preference no longer appears in builds without the tab.
When the deps prefix and the project disagree about the option, the configure
fails naming the cause, rather than failing at link time or at first launch
on Windows. The Windows packaging step stages exactly the toolkits libslic3r
links.
This commit is contained in:
SoftFever
2026-08-28 12:59:39 +08:00
parent f693b8d9fe
commit 7fc97a81bd
6 changed files with 39 additions and 36 deletions
+2
View File
@@ -310,12 +310,14 @@ void AppConfig::set_defaults()
if (get("zoom_to_mouse").empty())
set_bool("zoom_to_mouse", false);
#ifdef SLIC3R_CAD
// Design tab: draw a mate connector as a face rather than as the abstract disc + roll
// quadrant. Defaults ON — face orientation is hardwired perception, so the roll and the
// verse read without being learned, which no abstract glyph achieves. Turning it off
// restores the conventional CAD representation for users who expect it (snaporca-x0kd).
if (get("design_connector_face_glyph").empty())
set_bool("design_connector_face_glyph", true);
#endif
//#ifdef SUPPORT_SHOW_HINTS
if (get("show_hints").empty())
+13 -8
View File
@@ -604,7 +604,6 @@ find_package(JPEG REQUIRED)
find_package(Draco REQUIRED)
set(OCCT_LIBS
TKBool
TKXDESTEP
TKSTEP
TKSTEP209
@@ -632,23 +631,29 @@ set(OCCT_LIBS
TKMath
TKernel
)
# The CAD kernel is the only consumer of OCCT's ModelingAlgorithms module. Upstream's
# DataExchange already pulls TKBool in transitively, so the true delta is these two.
# The CAD kernel is the only consumer of OCCT's ModelingAlgorithms module: TKFillet
# (BRepFilletAPI), TKOffset (BRepOffsetAPI) and TKBool, which the other two need.
#
# PREPEND, never append: this list is single-pass static link order, dependents before
# dependencies — note TKernel, which everything needs, is deliberately last. TKOffset
# references BRepAlgo_Loop, which TKBool defines, so TKOffset must come BEFORE TKBool.
# Appending put it after, and the Snapmaker fork's Flatpak build — the one configuration
# whose linker is strictly single-pass — failed with
# Appending put it after, and a strictly single-pass linker (the Flatpak build) failed with
# libTKOffset.a(BRepOffset_MakeLoops.cxx.o): undefined reference to
# `BRepAlgo_Loop::BRepAlgo_Loop()'
# while the ordinary Linux, macOS and Windows links resolved it anyway. Use set() rather
# than list(PREPEND), which needs CMake 3.15 and this project supports 3.13.
if (SLIC3R_CAD)
set(OCCT_LIBS TKFillet TKOffset ${OCCT_LIBS})
set(OCCT_LIBS TKFillet TKOffset TKBool ${OCCT_LIBS})
# deps is configured separately, so its SLIC3R_CAD can differ from ours. The module is
# all-or-nothing, so one absent toolkit proves it; fail here rather than at link time.
if (NOT TARGET TKFillet)
message(FATAL_ERROR
"SLIC3R_CAD is ON, but the OpenCASCADE in ${CMAKE_PREFIX_PATH} was built without "
"BUILD_MODULE_ModelingAlgorithms. Rebuild the dependencies with -DSLIC3R_CAD=ON, "
"or configure this project with -DSLIC3R_CAD=OFF.")
endif ()
endif ()
# 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.
# Published for the Windows packaging step in the top-level CMakeLists.txt.
set(OCCT_LIBS "${OCCT_LIBS}" CACHE INTERNAL "OCCT toolkits linked by libslic3r")
target_link_libraries(libslic3r
+2
View File
@@ -1817,11 +1817,13 @@ void PreferencesDialog::create_items()
auto reverse_mouse_zoom = create_item_checkbox(_L("Reverse mouse zoom"), _L("If enabled, reverses the direction of zoom with mouse wheel."), "reverse_mouse_wheel_zoom");
g_sizer->Add(reverse_mouse_zoom);
#ifdef SLIC3R_CAD
auto item_connector_face_glyph = create_item_checkbox(_L("Draw mate connectors as a face"),
_L("In the Design tab, draw a mate connector as a small face instead of the conventional "
"disc with a roll quadrant. A face's orientation is read without being learned. "
"Turn this off for the conventional CAD representation."), "design_connector_face_glyph");
g_sizer->Add(item_connector_face_glyph);
#endif
std::vector<wxString> ButtonDragActions = {_L("None"), _L("Pan"), _L("Rotate")};
auto item_left_mouse_drag = create_item_combobox(_L("Left Mouse Drag"), _L("Set the action that dragging the left mouse button should perform."), "left_mouse_drag_action", ButtonDragActions);