Add Missing Includes Across the Remaining Sources and Tests (#16071)

* Ignore Clipper, libpng, mcut and Boost.Polygon Internals in clang-tidy

Each only works through a wrapper or umbrella header: libslic3r/clipper.hpp or clipper_z.hpp configure Clipper before including it, png.h pulls in libpng's config headers, and Boost.Polygon's headers only compile through polygon.hpp or voronoi.hpp.

* Ignore minilzo's Config Headers in clang-tidy

lzoconf.h and lzodefs.h are internal to minilzo.h, which is what the code includes.

* Add Missing Includes Across the Remaining Sources and Tests

Covers src/slic3r/Utils, src/slic3r/plugin, src/slic3r/Config, src/libvgcode, src/dev-utils, src/OrcaSlicer.cpp and tests/, the directories left after src/slic3r/GUI and src/libslic3r. Generated with clang-tidy misc-include-cleaner. libvgcode's own headers are included by relative path as in the rest of that library, and Catch2 and pybind11 with angle brackets as elsewhere in the repo.

* Make the GUI and Test Headers Compile on Their Own

Each now includes, or forward-declares, what it uses instead of relying on what its includers happened to include first. Headers that only compile on one platform, or that nothing built includes, are left alone.

* Keep Windows and nanosvg Setup Ahead of the Added Includes

OrcaSlicer.cpp and several tests set _WIN32_WINNT, WIN32_LEAN_AND_MEAN or NOMINMAX before including Windows.h, and the profile validator defines NANOSVG_IMPLEMENTATION before any libslic3r header. The added includes had landed above those blocks, which broke the Windows build.

* Add the GUI Includes the First Pass Missed

Covers headers that only became editable once they compiled on their own, and wx symbols whose suggested header changed as the clang-tidy ignore list grew after the src/slic3r/GUI pass.

* Keep the Added Test Includes Below the NOMINMAX Guard

test_marchingsquares.cpp and test_texture_displacement.cpp had includes inside #ifndef NOMINMAX, which the tests inherit as defined on Windows from libslic3r, 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, as in #16068.
This commit is contained in:
HanifKoh
2026-10-03 13:45:21 +08:00
committed by GitHub
parent 00bb4202fe
commit 84657ff11e
384 changed files with 2308 additions and 3 deletions
+4
View File
@@ -4,9 +4,13 @@
#include "slic3r/Utils/Http.hpp"
#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/log/trivial.hpp>
#include <boost/nowide/fstream.hpp>
#include <cstddef>
#include <memory>
#include <ios>
#include <slic3r/plugin/PluginDescriptor.hpp>
#include <string>
#include <unordered_map>
+9
View File
@@ -3,24 +3,33 @@
#include "../Utils/OrcaCloudServiceAgent.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/libslic3r.h" // GCODEVIEWER_APP_KEY, and SLIC3R_APP_KEY via libslic3r_version.h
#include "libslic3r_version.h"
#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/log/trivial.hpp>
#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <future>
#include <mutex>
#include <memory>
#include <slic3r/GUI/BindDialog.hpp>
#include <slic3r/GUI/GUI_App.hpp>
#include <slic3r/plugin/PluginFsUtils.hpp>
#include <slic3r/plugin/PluginManager.hpp>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <wx/app.h>
#include <wx/event.h>
#include <wx/msgdlg.h>
#include <wx/string.h>
#include <wx/thread.h>
namespace Slic3r {
+1
View File
@@ -2,6 +2,7 @@
#define slic3r_PluginAuditManager_hpp_
// Via pybind11 so this file requests the same python3xx.lib as everything else.
#include <boost/filesystem/path.hpp>
#include <pybind11/conduit/wrap_include_python_h.h>
#include <memory>
#include <mutex>
+3
View File
@@ -1,8 +1,11 @@
#pragma once
#include "libslic3r/libslic3r.h"
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
#include "libslic3r/Config.hpp" // ConfigBase
#include "libslic3r/Point.hpp" // Point/Point3 packing asserts, Vec3d, Transform3d
#include <pybind11/pytypes.h>
#include <pybind11/cast.h>
#include <string>
#include <utility>
#include <vector>
+14
View File
@@ -1,24 +1,38 @@
#include "PluginConfig.hpp"
#include <algorithm>
#include <boost/filesystem/operations.hpp>
#include <boost/format.hpp>
#include <boost/log/trivial.hpp>
#include <boost/nowide/fstream.hpp>
#include <exception>
#include <libslic3r/Config.hpp>
#include "libslic3r/Preset.hpp"
#include <libslic3r/PresetBundle.hpp>
#include <libslic3r/PrintConfig.hpp>
#include <optional>
#include <set>
#include <mutex>
#include "libslic3r/Utils.hpp"
#include "libslic3r/libslic3r.h"
#include <slic3r/GUI/GUI.hpp>
#include <slic3r/GUI/GUI_App.hpp>
#include <slic3r/GUI/I18N.hpp>
#include <slic3r/GUI/format.hpp>
#include "slic3r/plugin/PluginDescriptor.hpp"
#include <slic3r/plugin/PluginLoader.hpp>
#include <slic3r/plugin/PluginManager.hpp>
#include <slic3r/plugin/PythonInterpreter.hpp>
#include <slic3r/plugin/PythonPluginInterface.hpp>
#include <stdexcept>
#include <string>
#include <utility>
#include <system_error>
#include <vector>
#include <wx/app.h>
#include <wx/busycursor.h>
#include <wx/utils.h>
namespace Slic3r {
+1
View File
@@ -1,5 +1,6 @@
#pragma once
#include <boost/filesystem/path.hpp>
#include <libslic3r/Utils.hpp>
#include <boost/filesystem.hpp>
#include <nlohmann/json.hpp>
+1
View File
@@ -4,6 +4,7 @@
#include <algorithm>
#include <cctype>
#include <cstddef>
#include <map>
#include <optional>
#include <string>
+8
View File
@@ -4,16 +4,24 @@
#include "libslic3r/miniz_extension.hpp"
#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/directory.hpp>
#include <boost/filesystem/file_status.hpp>
#include <boost/log/trivial.hpp>
#include <boost/nowide/fstream.hpp>
#include "PluginAuditManager.hpp"
#include "PythonInterpreter.hpp"
#include <exception>
#include <miniz.h>
#include <nlohmann/json.hpp>
#include <chrono>
#include <filesystem>
#include <string>
#include "slic3r/plugin/PluginDescriptor.hpp"
#include <utility>
#include <algorithm>
#include <cctype>
+2
View File
@@ -1,6 +1,7 @@
#pragma once
#include "PluginDescriptor.hpp"
#include <pybind11/pytypes.h>
#include <nlohmann/json.hpp>
#include <pybind11/pybind11.h>
@@ -9,6 +10,7 @@
#include <cstdint>
#include <string>
#include <utility>
#include <vector>
#define PLUGIN_SUBSCRIBED_DIR "_subscribed"
+3
View File
@@ -13,7 +13,10 @@
#include <boost/log/trivial.hpp>
#include <exception>
#include <cstddef>
#include <memory>
#include "slic3r/plugin/PluginDescriptor.hpp"
#include <string>
#include <stdexcept>
+17
View File
@@ -11,9 +11,26 @@
#include "libslic3r/Utils.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/directory.hpp>
#include <boost/filesystem/file_status.hpp>
#include <boost/log/trivial.hpp>
#include <boost/process.hpp>
#include "slic3r/plugin/PluginDescriptor.hpp"
#include <optional>
#include <vector>
#include <memory>
#include "slic3r/plugin/PythonPluginInterface.hpp"
#include <cstddef>
#include <functional>
#include <boost/process/pipe.hpp>
#include <boost/process/args.hpp>
#include <boost/process/io.hpp>
#include <system_error>
#ifdef _WIN32
#include <boost/process/windows.hpp>
#endif
+11
View File
@@ -1,8 +1,14 @@
#include "PluginManager.hpp"
#include <atomic>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <exception>
#include <functional>
#include "libslic3r/LifecycleEvents.hpp"
#include <libslic3r/Utils.hpp>
#include <memory>
#include <optional>
#include <pybind11/embed.h>
#include "PluginFsUtils.hpp"
@@ -21,14 +27,19 @@
#include <algorithm>
#include <chrono>
#include <mutex>
#include "slic3r/plugin/CloudPluginService.hpp"
#include <slic3r/plugin/PluginConfig.hpp>
#include <slic3r/plugin/PluginDescriptor.hpp>
#include <slic3r/plugin/PluginLoader.hpp>
#include <slic3r/plugin/PythonPluginInterface.hpp>
#include <slic3r/plugin/pluginTypes/script/ScriptPluginCapability.hpp>
#include <stdexcept>
#include <thread>
#include <unordered_set>
#include <utility>
#include <vector>
#include <wx/app.h>
#include <wx/thread.h>
namespace Slic3r {
namespace {
+4
View File
@@ -1,9 +1,11 @@
#ifndef slic3r_PluginManager_hpp_
#define slic3r_PluginManager_hpp_
#include <atomic>
#include <boost/filesystem/path.hpp>
#include <algorithm>
#include <boost/log/trivial.hpp>
#include <chrono>
#include <condition_variable>
#include <functional>
@@ -13,9 +15,11 @@
#include <memory>
#include <mutex>
#include <optional>
#include "slic3r/plugin/PluginFsUtils.hpp"
#include <slic3r/plugin/PythonPluginInterface.hpp>
#include <string>
#include <unordered_set>
#include <utility>
#include <vector>
#include <pybind11/embed.h>
+6
View File
@@ -11,9 +11,15 @@
#include "../GUI/NotificationManager.hpp"
#include <boost/log/trivial.hpp>
#include <cstddef>
#include <libslic3r/Config.hpp>
#include "libslic3r/Preset.hpp"
#include <libslic3r/PresetBundle.hpp>
#include <memory>
#include <slic3r/plugin/PluginLoader.hpp>
#include <string>
#include "slic3r/plugin/PythonPluginInterface.hpp"
#include <utility>
#include <vector>
#include <wx/utils.h>
+5
View File
@@ -1,17 +1,22 @@
#ifndef slic3r_PyPluginTrampoline_hpp_
#define slic3r_PyPluginTrampoline_hpp_
#include "libslic3r/LifecycleEvents.hpp"
#include <pybind11/embed.h>
#include <boost/log/trivial.hpp>
#include <optional>
#include <stdexcept>
#include <string>
#include "PythonPluginInterface.hpp"
#include "PythonInterpreter.hpp"
#include "PluginFsUtils.hpp"
#include "PluginAuditManager.hpp"
#include <pybind11/pybind11.h>
#include <pybind11/gil.h>
#include <pybind11/pytypes.h>
// Trampoline variants of pybind11's override macros. Every C++->Python plugin call crosses a
// trampoline method, so this single boundary is where we (1) log the full Python traceback and
+9
View File
@@ -2,9 +2,15 @@
#include "GeneratedConfig.hpp"
#include "libslic3r/Utils.hpp"
#include "PluginAuditManager.hpp"
#include <atomic>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <cstdlib>
#include <memory>
#include <exception>
#include <pytypedefs.h>
#include "PluginFsUtils.hpp"
#include <pybind11/pybind11.h>
#include <pybind11/embed.h>
@@ -16,7 +22,10 @@
#include <ctime>
#include <iomanip>
#include <mutex>
#include <shared_mutex>
#include <sstream>
#include <utility>
#include <string>
#include <vector>
namespace Slic3r {
+1
View File
@@ -2,6 +2,7 @@
#define slic3r_PythonInterpreter_hpp_
// Via pybind11 so this file requests the same python3xx.lib as everything else.
#include <cstddef>
#include <pybind11/conduit/wrap_include_python_h.h>
#include <pytypedefs.h>
#include <atomic>
+6
View File
@@ -3,15 +3,19 @@
#include <algorithm>
#include <boost/log/trivial.hpp>
#include <exception>
#include "libslic3r/LifecycleEvents.hpp"
#include <memory>
#include <mutex>
#include <slic3r/plugin/PluginAuditManager.hpp>
#include "slic3r/plugin/PythonPluginInterface.hpp"
#include <string>
#include <unordered_map>
#include <pybind11/embed.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <vector>
#include <utility>
#include "PythonInterpreter.hpp"
#include "PluginFsUtils.hpp"
@@ -23,6 +27,8 @@
#include "pluginTypes/pages/PagesPluginCapability.hpp"
#include "pluginTypes/script/ScriptPluginCapability.hpp"
#include "pluginTypes/slicingPipeline/SlicingPipelinePluginCapability.hpp"
#include <pybind11/pytypes.h>
#include <pybind11/gil.h>
namespace py = pybind11;
+2
View File
@@ -1,10 +1,12 @@
#include "PluginHost.hpp"
#include "PluginHostBindings.hpp"
#include "PluginHostUi.hpp"
#include <pybind11/pybind11.h>
#include <slic3r/plugin/PluginAuditManager.hpp>
#include <slic3r/plugin/PluginManager.hpp>
#include <stdexcept>
#include <string>
namespace Slic3r {
+3
View File
@@ -1,4 +1,5 @@
#include "PluginHostBindings.hpp"
#include <pybind11/pybind11.h>
#include <libslic3r/Model.hpp>
#include <libslic3r/PresetBundle.hpp>
@@ -8,6 +9,8 @@
#include <memory>
#include <stdexcept>
#include <wx/app.h>
#include <string>
namespace py = pybind11;
@@ -1,10 +1,18 @@
#include "PluginHostBindings.hpp"
#include <pybind11/pytypes.h>
#include <pybind11/numpy.h>
#include <pybind11/pybind11.h>
#include <pybind11/cast.h>
#include "slic3r/plugin/PluginBindingUtils.hpp"
#include <cstddef>
#include <libslic3r/BoundingBox.hpp>
#include <libslic3r/ClipperUtils.hpp> // offset/offset_ex/union_ex/diff_ex/intersection_ex
#include <libslic3r/ExPolygon.hpp>
#include "libslic3r/Polygon.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Point.hpp"
#include <pybind11/stl.h>
#include <string>
@@ -1,11 +1,18 @@
#include "PluginHostBindings.hpp"
#include "PluginHostMesh.hpp"
#include <pybind11/pybind11.h>
#include <pybind11/pytypes.h>
#include <pybind11/cast.h>
#include "slic3r/plugin/PluginBindingUtils.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/Point.hpp"
#include <cstddef>
#include <pybind11/numpy.h>
#include <cstdint>
#include <memory>
#include <utility>
#include <vector>
namespace py = pybind11;
@@ -1,7 +1,11 @@
#include "PluginHostBindings.hpp"
#include "PluginHostMesh.hpp"
#include <pybind11/pybind11.h>
#include <pybind11/pytypes.h>
#include <pybind11/cast.h>
#include "slic3r/plugin/PluginBindingUtils.hpp"
#include <cstddef>
#include <libslic3r/Model.hpp>
#include <pybind11/stl.h>
@@ -1,9 +1,14 @@
#include "PluginHostBindings.hpp"
#include <pybind11/pytypes.h>
#include <pybind11/cast.h>
#include <pybind11/pybind11.h>
#include "slic3r/plugin/PluginBindingUtils.hpp"
#include <cstddef>
#include <libslic3r/Preset.hpp>
#include <libslic3r/PresetBundle.hpp>
#include <memory>
#include <pybind11/stl.h>
#include <string>
@@ -1,4 +1,7 @@
#include "PluginHostBindings.hpp"
#include <pybind11/pybind11.h>
#include <pybind11/cast.h>
#include <pybind11/pytypes.h>
#include "slic3r/plugin/PluginBindingUtils.hpp"
#include "libslic3r/BoundingBox.hpp"
@@ -10,8 +13,12 @@
#include "libslic3r/Layer.hpp" // LayerRegion, Layer, SupportLayer
#include "libslic3r/Print.hpp" // PrintRegion, PrintObject, Print
#include "libslic3r/Point.hpp"
#include "libslic3r/libslic3r.h"
#include "libslic3r/Model.hpp"
#include <pybind11/stl.h>
#include <memory>
#include <string>
#include <vector>
namespace py = pybind11;
+11
View File
@@ -1,9 +1,14 @@
#include "PluginHostUi.hpp"
#include <pybind11/pytypes.h>
#include <pybind11/gil.h>
#include <pybind11/cast.h>
#include "slic3r/plugin/PluginAuditManager.hpp"
#include "slic3r/plugin/PythonInterpreter.hpp" // PythonGILState
#include "slic3r/plugin/PluginFsUtils.hpp" // json_to_py / py_to_json
#include <functional>
#include <exception>
#include <slic3r/GUI/GUI_App.hpp>
#include <slic3r/GUI/MainFrame.hpp>
#include <slic3r/GUI/MsgDialog.hpp>
@@ -18,8 +23,14 @@
#include <boost/log/trivial.hpp>
#include <utility>
#include <string>
#include <wx/app.h>
#include <wx/defs.h>
#include <wx/thread.h>
#include <wx/toplevel.h>
#include <wx/event.h>
#include <wx/progdlg.h>
#include <wx/window.h>
#include <algorithm>
+14
View File
@@ -9,16 +9,30 @@
#include <algorithm>
#include <atomic>
#include <boost/filesystem/path.hpp>
#include <boost/log/trivial.hpp>
#include <memory>
#include <exception>
#include <cstddef>
#include <nlohmann/json.hpp>
#include "slic3r/plugin/pluginTypes/pages/PagesPluginCapability.hpp"
#include "slic3r/GUI/WebPanel.hpp"
#include <optional>
#include "slic3r/plugin/PythonPluginInterface.hpp"
#include <stdexcept>
#include <string>
#include <wx/app.h>
#include <vector>
#include <wx/bookctrl.h>
#include <wx/event.h>
#include <wx/menu.h>
#include <wx/sizer.h>
#include <utility>
#include <wx/webview.h>
#include <wx/string.h>
namespace Slic3r {
namespace {
+1
View File
@@ -12,6 +12,7 @@
#include <vector>
#include <wx/bitmap.h>
#include <wx/string.h>
#include <wx/webview.h>
class Notebook;
@@ -2,10 +2,17 @@
#include "PagesPluginCapabilityTrampoline.hpp"
#include "../../PluginFsUtils.hpp"
#include <pybind11/pytypes.h>
#include <pybind11/cast.h>
#include <boost/log/trivial.hpp>
#include <memory>
#include <functional>
#include <mutex>
#include <pybind11/pybind11.h>
#include "slic3r/plugin/PythonPluginInterface.hpp"
#include <string>
#include <utility>
namespace py = pybind11;
@@ -3,8 +3,14 @@
#include "PagesPluginCapability.hpp"
#include "../../PluginFsUtils.hpp"
#include "../../PyPluginTrampoline.hpp"
#include <pybind11/pytypes.h>
#include <pybind11/pybind11.h>
#include <nlohmann/json.hpp>
#include <string>
#include "slic3r/plugin/PythonPluginInterface.hpp"
#include "slic3r/plugin/PythonInterpreter.hpp"
#include <stdexcept>
namespace Slic3r {
@@ -2,11 +2,16 @@
#include "PrinterAgentPluginCapabilityTrampoline.hpp"
#include "IPrinterAgent.hpp"
#include <pybind11/cast.h>
#include "slic3r/Utils/bambu_networking.hpp"
#include <memory>
#include <pybind11/functional.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <string>
#include "slic3r/plugin/PythonPluginInterface.hpp"
#include <utility>
namespace py = pybind11;
@@ -4,6 +4,8 @@
#include "../../PythonPluginInterface.hpp"
#include "IPrinterAgent.hpp"
#include <pybind11/pybind11.h>
#include "slic3r/Utils/bambu_networking.hpp"
#include <memory>
#include <string>
@@ -5,9 +5,16 @@
#include "../../PyPluginTrampoline.hpp"
#include "IPrinterAgent.hpp"
#include "slic3r/Utils/bambu_networking.hpp"
#include "pybind11/pybind11.h"
#include <exception>
#include <functional>
#include <pybind11/pytypes.h>
#include <boost/log/trivial.hpp>
#include <slic3r/plugin/PluginAuditManager.hpp>
#include "slic3r/plugin/PythonInterpreter.hpp"
#include <slic3r/plugin/PythonPluginInterface.hpp>
#include <stdexcept>
#include <string>
#include <type_traits>
@@ -3,8 +3,10 @@
#include "ScriptPluginCapabilityTrampoline.hpp"
#include <boost/log/trivial.hpp>
#include <memory>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "slic3r/plugin/PythonPluginInterface.hpp"
namespace py = pybind11;
@@ -2,6 +2,7 @@
#define slic3r_ScriptPluginCapability_hpp_
#include "../../PythonPluginInterface.hpp"
#include <pybind11/pybind11.h>
namespace Slic3r {
class ScriptPluginCapability : public PluginCapabilityInterface
@@ -3,6 +3,8 @@
#include "ScriptPluginCapability.hpp"
#include "../../PyPluginTrampoline.hpp"
#include "slic3r/plugin/PythonPluginInterface.hpp"
#include <pybind11/pybind11.h>
namespace Slic3r {
class PyScriptPluginCapabilityTrampoline : public PyPluginCommonTrampoline<ScriptPluginCapability>
@@ -1,7 +1,14 @@
#include "SlicingPipelinePluginCapability.hpp"
#include "SlicingPipelinePluginCapabilityTrampoline.hpp"
#include <pybind11/pybind11.h>
#include <pybind11/cast.h>
#include <pybind11/pytypes.h>
#include "slic3r/plugin/PluginBindingUtils.hpp" // config_value_or_none
#include "libslic3r/libslic3r.h" // unscale<>, live SCALING_FACTOR
#include "libslic3r/Print.hpp"
#include <string>
#include "slic3r/plugin/PythonPluginInterface.hpp"
#include <memory>
namespace py = pybind11;
namespace Slic3r {
@@ -1,6 +1,7 @@
#pragma once
#include "slic3r/plugin/PythonPluginInterface.hpp"
#include "libslic3r/Print.hpp" // SlicingPipelineStepPlugin, Print, PrintObject
#include "libslic3r/PrintConfig.hpp"
#include <pybind11/pybind11.h>
#include <map>
#include <string>
@@ -1,8 +1,10 @@
#pragma once
#include "SlicingPipelinePluginCapability.hpp"
#include <pybind11/pybind11.h>
#include "slic3r/plugin/PyPluginTrampoline.hpp"
#include "slic3r/plugin/PluginAuditManager.hpp"
#include <boost/filesystem.hpp>
#include "slic3r/plugin/PythonPluginInterface.hpp"
namespace Slic3r {
class PySlicingPipelinePluginCapabilityTrampoline : public PyPluginCommonTrampoline<SlicingPipelinePluginCapability> {