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
+1
View File
@@ -1,5 +1,6 @@
#pragma once
#include <boost/filesystem/path.hpp>
#include <libslic3r/Utils.hpp>
#include <boost/filesystem.hpp>
@@ -4,7 +4,9 @@
// interpreter (test_plugin_host_api.cpp, test_slicing_pipeline_bindings.cpp, ...).
#include <boost/dll/runtime_symbol_info.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/operations.hpp>
#include <memory.h>
#include <memory>
#include <stdexcept>
#include <string>
#include <pybind11/embed.h>
@@ -1,5 +1,6 @@
#include <catch2/catch_all.hpp>
#include <catch2/catch_test_macros.hpp>
#include "slic3r/Utils/Http.hpp"
TEST_CASE("Check SSL certificates paths", "[Http][NotWorking]") {
+4
View File
@@ -1,11 +1,15 @@
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_message.hpp>
#include "slic3r/GUI/ActionRegistry.hpp"
#include "slic3r/GUI/NativeCommands.hpp"
#include "slic3r/GUI/SettingsIndex.hpp"
#include <boost/filesystem.hpp>
#include "libslic3r/Config.hpp"
#include <memory>
#include <set>
#include <string>
@@ -2,7 +2,9 @@
#include <boost/filesystem.hpp>
#include <boost/nowide/fstream.hpp>
#include <nlohmann/json.hpp>
#include <string>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/Utils.hpp"
#include "slic3r/Utils/BBLPrinterAgent.hpp"
#include "slic3r/Utils/OrcaPrinterAgent.hpp"
@@ -1,4 +1,6 @@
#include <algorithm>
#include <catch2/catch_test_macros.hpp>
#include <vector>
#include "libslic3r/Preset.hpp"
#include "libslic3r/PresetBundle.hpp"
+6
View File
@@ -13,6 +13,12 @@
#include <Windows.h>
#endif
#include <catch2/catch_test_macros.hpp>
#include "slic3r/GUI/DeviceCore/DevDefs.h"
#include "libslic3r/ProjectTask.hpp"
#include <vector>
#include <catch2/catch_message.hpp>
#include <catch2/catch_all.hpp>
#include <wx/timer.h>
@@ -1,8 +1,11 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_all.hpp>
#include <slic3r/GUI/DeviceCore/DevManager.h>
#include <slic3r/GUI/DeviceManager.hpp>
#include <libslic3r/AppConfig.hpp>
#include "slic3r/Utils/IPrinterAgent.hpp"
#include "slic3r/Utils/CloudProvider.hpp"
#include <slic3r/Utils/NetworkAgent.hpp>
#include <slic3r/Utils/OrcaCloudServiceAgent.hpp>
#include <slic3r/Utils/OrcaPrinterAgent.hpp>
@@ -12,6 +12,9 @@
#include <Windows.h>
#endif
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/ProjectTask.hpp"
#include <catch2/catch_all.hpp>
#include <stdexcept>
@@ -11,6 +11,12 @@
#include <Windows.h>
#endif
#include <string>
#include "libslic3r/Config.hpp"
#include <vector>
#include <catch2/catch_test_macros.hpp>
#include <cstddef>
#include <catch2/catch_all.hpp>
#include <cmath>
+3
View File
@@ -1,10 +1,13 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include <catch2/catch_message.hpp>
#include "slic3r/GUI/GUI.hpp"
#include <boost/filesystem/path.hpp>
#include <string>
#include <wx/string.h>
#include <wx/uri.h>
using namespace Slic3r::GUI;
+3
View File
@@ -2,9 +2,12 @@
#include <functional>
#include <memory>
#include "slic3r/GUI/StagedBuild.hpp"
#include <stdexcept>
#include <utility>
#include <vector>
#include <catch2/catch_test_macros.hpp>
#include "slic3r/GUI/Lazy.hpp"
using Slic3r::GUI::Lazy;
@@ -1,8 +1,13 @@
#include <boost/filesystem/operations.hpp>
#include <catch2/catch_all.hpp>
#include <boost/filesystem.hpp>
#include <boost/nowide/fstream.hpp>
#include <vector>
#include "libslic3r/AppConfig.hpp"
#include <cstddef>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/Utils.hpp"
#include "slic3r/Utils/bambu_networking.hpp"
@@ -1,3 +1,5 @@
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <catch2/catch_all.hpp>
#include <boost/filesystem.hpp>
@@ -6,6 +8,7 @@
#include <memory>
#include <string>
#include <catch2/catch_test_macros.hpp>
#include "slic3r/Utils/OrcaCloudServiceAgent.hpp"
#include "test_utils.hpp"
+4
View File
@@ -1,3 +1,5 @@
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <catch2/catch_all.hpp>
#include <libslic3r/Utils.hpp>
@@ -5,6 +7,8 @@
#include <slic3r/plugin/PluginAuditManager.hpp>
#include <slic3r/Utils/OrcaCloudServiceAgent.hpp> // secret_constants::USER_SECRET_FILENAME
#include <catch2/catch_test_macros.hpp>
#include "libslic3r_version.h"
#include "plugin_test_utils.hpp"
#include <boost/filesystem.hpp>
@@ -1,5 +1,7 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_all.hpp>
#include "libslic3r/Config.hpp"
#include <libslic3r/Preset.hpp>
#include <libslic3r/PrintConfig.hpp>
#include <slic3r/plugin/PluginResolver.hpp>
@@ -1,5 +1,6 @@
#include <catch2/catch_all.hpp>
#include <exception>
#include <libslic3r/Utils.hpp>
#include <slic3r/plugin/PluginConfig.hpp>
#include <slic3r/plugin/PluginManager.hpp>
@@ -7,7 +8,11 @@
#include <slic3r/plugin/PythonPluginBridge.hpp>
#include <slic3r/plugin/PythonPluginInterface.hpp>
#include <catch2/catch_test_macros.hpp>
#include "plugin_test_utils.hpp"
#include <pybind11/pytypes.h>
#include <pybind11/eval.h>
#include <pybind11/gil.h>
#include <nlohmann/json.hpp>
#include <pybind11/embed.h>
@@ -1,5 +1,8 @@
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <catch2/catch_all.hpp>
#include <ios>
#include <libslic3r/Utils.hpp>
#include <slic3r/plugin/PluginConfig.hpp>
#include <slic3r/plugin/PluginDescriptor.hpp>
@@ -8,6 +11,8 @@
#include <slic3r/plugin/PythonInterpreter.hpp>
#include <slic3r/plugin/PythonPluginInterface.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_message.hpp>
#include "plugin_test_utils.hpp"
#include <boost/filesystem.hpp>
+5
View File
@@ -1,15 +1,20 @@
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <catch2/catch_all.hpp>
#include <ios>
#include <libslic3r/Utils.hpp>
#include <slic3r/plugin/PluginConfig.hpp>
#include <slic3r/plugin/PluginManager.hpp>
#include <catch2/catch_test_macros.hpp>
#include "plugin_test_utils.hpp"
#include <boost/filesystem.hpp>
#include <boost/nowide/fstream.hpp>
#include <nlohmann/json.hpp>
#include "slic3r/plugin/PythonPluginInterface.hpp"
#include <string>
using namespace Slic3r;
@@ -1,5 +1,6 @@
#include <catch2/catch_all.hpp>
#include <cstddef>
#include <libslic3r/Model.hpp>
#include <libslic3r/PresetBundle.hpp>
#include <libslic3r/TriangleMesh.hpp>
@@ -8,7 +9,13 @@
#include <slic3r/GUI/Widgets/WebHosting.hpp>
#include <slic3r/plugin/PythonPluginBridge.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_message.hpp>
#include <catch2/matchers/catch_matchers_floating_point.hpp>
#include <catch2/matchers/catch_matchers.hpp>
#include "plugin_test_utils.hpp"
#include <pybind11/pytypes.h>
#include <pybind11/cast.h>
#include "python_test_support.hpp"
#include <pybind11/embed.h>
@@ -16,6 +23,7 @@
#include <string>
#include <wx/string.h>
#include <wx/uri.h>
namespace py = pybind11;
@@ -1,10 +1,16 @@
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <catch2/catch_all.hpp>
#include <ios>
#include <libslic3r/Utils.hpp>
#include <slic3r/plugin/PluginLoader.hpp>
#include <slic3r/plugin/PluginDescriptor.hpp>
#include <slic3r/plugin/PluginFsUtils.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers.hpp>
#include <catch2/matchers/catch_matchers_string.hpp>
#include "plugin_test_utils.hpp"
#include <boost/filesystem.hpp>
@@ -1,13 +1,19 @@
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <catch2/catch_all.hpp>
#include <ios>
#include <libslic3r/LifecycleEvents.hpp>
#include <libslic3r/Utils.hpp>
#include <memory>
#include <slic3r/Utils/NetworkAgentFactory.hpp>
#include <slic3r/plugin/PluginDescriptor.hpp>
#include <slic3r/plugin/PluginManager.hpp>
#include <slic3r/plugin/PluginFsUtils.hpp>
#include <slic3r/plugin/PythonInterpreter.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_message.hpp>
#include "plugin_test_utils.hpp"
#include <boost/filesystem.hpp>
@@ -17,8 +23,10 @@
#include <condition_variable>
#include <fstream>
#include <mutex>
#include "slic3r/plugin/PythonPluginInterface.hpp"
#include <string>
#include <thread>
#include <utility>
#include <vector>
using namespace Slic3r;
@@ -1,5 +1,6 @@
#include <catch2/catch_all.hpp>
#include "slic3r/Utils/bambu_networking.hpp"
#include <slic3r/plugin/PluginManager.hpp>
#include <slic3r/plugin/PythonInterpreter.hpp>
#include <slic3r/plugin/PythonPluginBridge.hpp>
@@ -12,7 +13,11 @@
#include <memory>
#include <string>
#include <catch2/catch_test_macros.hpp>
#include "plugin_test_utils.hpp"
#include <pybind11/pytypes.h>
#include <pybind11/eval.h>
#include <pybind11/gil.h>
namespace py = pybind11;
using namespace Slic3r;
+3
View File
@@ -1,7 +1,10 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_all.hpp>
#include <slic3r/GUI/PluginSort.hpp>
#include "slic3r/GUI/PluginSource.hpp"
#include "slic3r/GUI/PluginStatus.hpp"
#include <string>
#include <vector>
+1
View File
@@ -1,3 +1,4 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_all.hpp>
#include <slic3r/GUI/PluginStatus.hpp>
@@ -1,8 +1,10 @@
#include <catch2/catch_all.hpp>
#include "slic3r/GUI/Lazy.hpp"
#include <string>
#include <vector>
#include <catch2/catch_test_macros.hpp>
#include "slic3r/GUI/PrebuildQueue.hpp"
using Slic3r::GUI::LazyBase;
@@ -1,7 +1,11 @@
#include <catch2/catch_all.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/Model.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include <pybind11/gil.h>
#include <pybind11/pytypes.h>
#include <pybind11/cast.h>
#include "python_test_support.hpp"
#include <pybind11/embed.h>
+6
View File
@@ -1,8 +1,14 @@
#include <catch2/catch_all.hpp>
#include <memory>
#include "slic3r/Utils/ICloudServiceAgent.hpp"
#include "slic3r/Utils/IPrinterAgent.hpp"
#include <slic3r/Utils/NetworkAgentFactory.hpp>
#include <slic3r/plugin/PythonPluginBridge.hpp>
#include <catch2/catch_test_macros.hpp>
#include <pybind11/pytypes.h>
#include <catch2/catch_message.hpp>
#include "python_test_support.hpp"
#include <pybind11/embed.h>
+8
View File
@@ -3,10 +3,18 @@
#include <memory>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
#include <nlohmann/json.hpp>
#include <wx/string.h>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_message.hpp>
#include <catch2/matchers/catch_matchers.hpp>
#include <catch2/matchers/catch_matchers_string.hpp>
#include <catch2/generators/catch_generators_range.hpp>
#include <catch2/generators/catch_generators.hpp>
#include "libslic3r/LifecycleEvents.hpp"
#include "slic3r/Utils/PrintHost.hpp"
#include "slic3r/Utils/Flashforge.hpp"
@@ -11,6 +11,16 @@
#include <CommCtrl.h>
#endif
#include <catch2/catch_test_macros.hpp>
#include "slic3r/GUI/MeshUtils.hpp"
#include "libslic3r/Point.hpp"
#include <catch2/matchers/catch_matchers.hpp>
#include <catch2/matchers/catch_matchers_floating_point.hpp>
#include <catch2/generators/catch_generators.hpp>
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/Geometry.hpp"
#include <catch2/generators/catch_generators_range.hpp>
#include <catch2/catch_all.hpp>
#include "slic3r/GUI/Camera.hpp"
+6
View File
@@ -1,10 +1,16 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include <catch2/catch_message.hpp>
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/KeyChord.hpp"
#include "slic3r/GUI/Shortcuts.hpp"
#include <wx/accel.h>
#include <string>
#include <vector>
#include <cstddef>
#include <optional>
#include <wx/event.h>
using namespace Slic3r;
@@ -1,4 +1,18 @@
#include <catch2/catch_test_macros.hpp>
#include <pybind11/gil.h>
#include <pybind11/pybind11.h>
#include <pybind11/pytypes.h>
#include "libslic3r/libslic3r.h"
#include <pybind11/cast.h>
#include <pybind11/eval.h>
#include <catch2/matchers/catch_matchers.hpp>
#include "libslic3r/Config.hpp"
#include "libslic3r/Print.hpp"
#include <cstddef>
#include "libslic3r/SurfaceCollection.hpp"
#include "libslic3r/Polygon.hpp"
#include <initializer_list>
#include <utility>
#include "slic3r/plugin/PythonPluginInterface.hpp"
using namespace Slic3r;
@@ -1,13 +1,26 @@
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <catch2/catch_all.hpp>
#include <ios>
#include <chrono>
#include "libslic3r/Print.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/Config.hpp"
#include <libslic3r/Utils.hpp>
#include <slic3r/plugin/PluginConfig.hpp>
#include "slic3r/plugin/PluginFsUtils.hpp"
#include <slic3r/plugin/PluginManager.hpp>
#include <slic3r/plugin/PythonInterpreter.hpp>
#include <slic3r/plugin/PythonPluginInterface.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_message.hpp>
#include "fff_print/test_helpers.hpp"
#include "plugin_test_utils.hpp"
#include <pybind11/pybind11.h>
#include <pybind11/pytypes.h>
#include <boost/filesystem.hpp>
#include <nlohmann/json.hpp>
+1
View File
@@ -2,6 +2,7 @@
#include <vector>
#include <catch2/catch_test_macros.hpp>
#include "slic3r/GUI/StagedBuild.hpp"
using Slic3r::GUI::StagedBuild;
+2
View File
@@ -2,6 +2,8 @@
#include <string>
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include "slic3r/GUI/UserManager.hpp"
using namespace Slic3r;
@@ -1,7 +1,15 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_all.hpp>
#include <slic3r/GUI/WebMediaController.hpp>
#include <wx/colour.h>
#include <wx/gdicmn.h>
#include <wx/string.h>
#include <wx/sharedptr.h>
#include <wx/vector.h>
#include "slic3r/Utils/IPrinterAgent.hpp"
#include <wx/uri.h>
#include <wx/webview.h>
#include <string>