From 75994583dd7171c4cae6d55d84e4af56c068ef91 Mon Sep 17 00:00:00 2001 From: Hanif Koh Date: Fri, 2 Oct 2026 21:42:26 +0800 Subject: [PATCH] Keep Windows Setup Ahead of the Added libslic3r Includes Print.cpp and Thread.cpp open with a _WIN32 block that has to come first; without the precompiled header, Print.cpp otherwise reaches windows.h through OCCT with NONLS defined and boost/regex fails. OpenVDBUtils.cpp and SLA/SupportTreeBuilder.cpp had includes inside #ifndef NOMINMAX, which libslic3r defines on Windows, so those were skipped there. .clang-tidy also ignores the MSVC STL and UCRT internals, Boost.Multiprecision's fwd.hpp and CPython's Windows include directory. --- .clang-tidy | 10 ++++++++-- src/libslic3r/OpenVDBUtils.cpp | 3 ++- src/libslic3r/Print.cpp | 11 ++++++----- src/libslic3r/SLA/SupportTreeBuilder.cpp | 3 ++- src/libslic3r/Thread.cpp | 15 ++++++++------- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 381829cf3a..f45561badb 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -7,8 +7,10 @@ CheckOptions: misc-include-cleaner.UnusedIncludes: false # Headers that declare a symbol but are not the one to include: per-platform # implementations of wxWidgets and Boost.Thread (a Linux run would suggest the - # GTK or pthread one), library internals and forward declarations, CPython's - # headers behind Python.h, curl's behind curl.h, oneTBB's behind tbb/, and + # GTK or pthread one), library internals and forward declarations (MSVC's STL + # __msvc_* and the Windows UCRT's corecrt_* included), CPython's headers behind + # Python.h (python3.x/ on Linux and macOS, libpython/include/ on Windows), + # curl's behind curl.h, oneTBB's behind tbb/, and # admesh's stl.h, which the include path also exposes without its directory. # Clipper's own clipper.hpp is only included through libslic3r/clipper.hpp or # clipper_z.hpp, which configure it first, and Boost.Polygon's headers only @@ -27,7 +29,11 @@ CheckOptions: .*[/\\]impl[/\\].*; .*_fwd\.hpp; python3\.[0-9]+[/\\].*; + libpython[/\\]include[/\\].*; bits[/\\].*; + corecrt_.*\.h; + __msvc_.*\.hpp; + boost[/\\]multiprecision[/\\]fwd\.hpp; imconfig\.h; expat_external\.h; admesh[/\\]stl\.h; diff --git a/src/libslic3r/OpenVDBUtils.cpp b/src/libslic3r/OpenVDBUtils.cpp index a7d28dfa4f..d4ac09781d 100644 --- a/src/libslic3r/OpenVDBUtils.cpp +++ b/src/libslic3r/OpenVDBUtils.cpp @@ -1,5 +1,7 @@ #ifndef NOMINMAX #define NOMINMAX +#endif + #include #include #include @@ -12,7 +14,6 @@ #include "libslic3r.h" #include #include -#endif #include "OpenVDBUtils.hpp" #ifdef _MSC_VER diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 6e11f8bc2d..e07dbe9389 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1,3 +1,9 @@ +#ifdef _WIN32 +// Keep this first. A header below reaches boost/regex, whose w32_regex_traits +// needs the Win32 types declared already. +#include +#endif + #include "PrintBase.hpp" #include #include @@ -47,11 +53,6 @@ #include #include #include "TriangleMesh.hpp" -#ifdef _WIN32 -// Keep this first. A header below reaches boost/regex, whose w32_regex_traits -// needs the Win32 types declared already. -#include -#endif #include "Config.hpp" #include "Exception.hpp" #include "Print.hpp" diff --git a/src/libslic3r/SLA/SupportTreeBuilder.cpp b/src/libslic3r/SLA/SupportTreeBuilder.cpp index 68a8a70eb6..635b5452d1 100644 --- a/src/libslic3r/SLA/SupportTreeBuilder.cpp +++ b/src/libslic3r/SLA/SupportTreeBuilder.cpp @@ -1,5 +1,7 @@ #ifndef NOMINMAX #define NOMINMAX +#endif + #include "libslic3r/SLA/SpatIndex.hpp" #include "libslic3r/ExPolygon.hpp" #include "libslic3r/SLA/Pad.hpp" @@ -14,7 +16,6 @@ #include #include "libslic3r/BoundingBox.hpp" #include "libslic3r/SLA/SupportTree.hpp" -#endif #include #include diff --git a/src/libslic3r/Thread.cpp b/src/libslic3r/Thread.cpp index e0d839153e..066656c9ed 100644 --- a/src/libslic3r/Thread.cpp +++ b/src/libslic3r/Thread.cpp @@ -1,10 +1,3 @@ -#include -#include -#include -#include -#include -#include -#include #ifdef _WIN32 #include #include @@ -13,6 +6,14 @@ #include #endif +#include +#include +#include +#include +#include +#include +#include + #include #include #include