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.
This commit is contained in:
Hanif Koh
2026-10-02 21:46:20 +08:00
parent 145a7e5f80
commit 75994583dd
5 changed files with 26 additions and 16 deletions
+8 -2
View File
@@ -7,8 +7,10 @@ CheckOptions:
misc-include-cleaner.UnusedIncludes: false misc-include-cleaner.UnusedIncludes: false
# Headers that declare a symbol but are not the one to include: per-platform # 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 # implementations of wxWidgets and Boost.Thread (a Linux run would suggest the
# GTK or pthread one), library internals and forward declarations, CPython's # GTK or pthread one), library internals and forward declarations (MSVC's STL
# headers behind Python.h, curl's behind curl.h, oneTBB's behind tbb/, and # __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. # 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'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 # clipper_z.hpp, which configure it first, and Boost.Polygon's headers only
@@ -27,7 +29,11 @@ CheckOptions:
.*[/\\]impl[/\\].*; .*[/\\]impl[/\\].*;
.*_fwd\.hpp; .*_fwd\.hpp;
python3\.[0-9]+[/\\].*; python3\.[0-9]+[/\\].*;
libpython[/\\]include[/\\].*;
bits[/\\].*; bits[/\\].*;
corecrt_.*\.h;
__msvc_.*\.hpp;
boost[/\\]multiprecision[/\\]fwd\.hpp;
imconfig\.h; imconfig\.h;
expat_external\.h; expat_external\.h;
admesh[/\\]stl\.h; admesh[/\\]stl\.h;
+2 -1
View File
@@ -1,5 +1,7 @@
#ifndef NOMINMAX #ifndef NOMINMAX
#define NOMINMAX #define NOMINMAX
#endif
#include <cstddef> #include <cstddef>
#include <openvdb/Types.h> #include <openvdb/Types.h>
#include <Eigen/Core> #include <Eigen/Core>
@@ -12,7 +14,6 @@
#include "libslic3r.h" #include "libslic3r.h"
#include <utility> #include <utility>
#include <openvdb/Metadata.h> #include <openvdb/Metadata.h>
#endif
#include "OpenVDBUtils.hpp" #include "OpenVDBUtils.hpp"
#ifdef _MSC_VER #ifdef _MSC_VER
+6 -5
View File
@@ -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 <Windows.h>
#endif
#include "PrintBase.hpp" #include "PrintBase.hpp"
#include <utility> #include <utility>
#include <string> #include <string>
@@ -47,11 +53,6 @@
#include <boost/thread/lock_types.hpp> #include <boost/thread/lock_types.hpp>
#include <iterator> #include <iterator>
#include "TriangleMesh.hpp" #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 <Windows.h>
#endif
#include "Config.hpp" #include "Config.hpp"
#include "Exception.hpp" #include "Exception.hpp"
#include "Print.hpp" #include "Print.hpp"
+2 -1
View File
@@ -1,5 +1,7 @@
#ifndef NOMINMAX #ifndef NOMINMAX
#define NOMINMAX #define NOMINMAX
#endif
#include "libslic3r/SLA/SpatIndex.hpp" #include "libslic3r/SLA/SpatIndex.hpp"
#include "libslic3r/ExPolygon.hpp" #include "libslic3r/ExPolygon.hpp"
#include "libslic3r/SLA/Pad.hpp" #include "libslic3r/SLA/Pad.hpp"
@@ -14,7 +16,6 @@
#include <algorithm> #include <algorithm>
#include "libslic3r/BoundingBox.hpp" #include "libslic3r/BoundingBox.hpp"
#include "libslic3r/SLA/SupportTree.hpp" #include "libslic3r/SLA/SupportTree.hpp"
#endif
#include <libslic3r/SLA/SupportTreeBuilder.hpp> #include <libslic3r/SLA/SupportTreeBuilder.hpp>
#include <libslic3r/SLA/SupportTreeBuildsteps.hpp> #include <libslic3r/SLA/SupportTreeBuildsteps.hpp>
+8 -7
View File
@@ -1,10 +1,3 @@
#include <optional>
#include <string>
#include <cstddef>
#include <cassert>
#include <sstream>
#include <locale.h>
#include <clocale>
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include <boost/nowide/convert.hpp> #include <boost/nowide/convert.hpp>
@@ -13,6 +6,14 @@
#include <pthread.h> #include <pthread.h>
#endif #endif
#include <optional>
#include <string>
#include <cstddef>
#include <cassert>
#include <sstream>
#include <locale.h>
#include <clocale>
#include <atomic> #include <atomic>
#include <condition_variable> #include <condition_variable>
#include <mutex> #include <mutex>