diff --git a/src/OrcaSlicer.cpp b/src/OrcaSlicer.cpp index 4db5971f09..992a9c9bc2 100644 --- a/src/OrcaSlicer.cpp +++ b/src/OrcaSlicer.cpp @@ -1,3 +1,25 @@ +#ifdef WIN32 + // Why? + #define _WIN32_WINNT 0x0502 + // The standard Windows includes. + #define WIN32_LEAN_AND_MEAN + #ifndef NOMINMAX + #define NOMINMAX + #endif + #include + #include + #include + #ifdef SLIC3R_GUI + extern "C" + { + // Let the NVIDIA and AMD know we want to use their graphics card + // on a dual graphics card system. + __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; + __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; + } + #endif /* SLIC3R_GUI */ +#endif /* WIN32 */ + #include #include #include "libslic3r/PrintBase.hpp" @@ -40,27 +62,6 @@ #include #include #include -#ifdef WIN32 - // Why? - #define _WIN32_WINNT 0x0502 - // The standard Windows includes. - #define WIN32_LEAN_AND_MEAN - #ifndef NOMINMAX - #define NOMINMAX - #endif - #include - #include - #include - #ifdef SLIC3R_GUI - extern "C" - { - // Let the NVIDIA and AMD know we want to use their graphics card - // on a dual graphics card system. - __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; - __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; - } - #endif /* SLIC3R_GUI */ -#endif /* WIN32 */ #include #include diff --git a/src/dev-utils/OrcaSlicer_profile_validator.cpp b/src/dev-utils/OrcaSlicer_profile_validator.cpp index ccab809c47..bbfa53c262 100644 --- a/src/dev-utils/OrcaSlicer_profile_validator.cpp +++ b/src/dev-utils/OrcaSlicer_profile_validator.cpp @@ -3,6 +3,11 @@ // several of them transitively include nanosvg.h without the implementation macro, and its include // guard would then suppress the implementation if the macro were defined afterwards. Same pattern as // the test mains. +#define NANOSVG_IMPLEMENTATION +#include "nanosvg/nanosvg.h" +#define NANOSVGRAST_IMPLEMENTATION +#include "nanosvg/nanosvgrast.h" + #include #include #include @@ -24,10 +29,6 @@ #include #include #include -#define NANOSVG_IMPLEMENTATION -#include "nanosvg/nanosvg.h" -#define NANOSVGRAST_IMPLEMENTATION -#include "nanosvg/nanosvgrast.h" #include "libslic3r/BoundingBox.hpp" #include "libslic3r/GCode.hpp" diff --git a/tests/fff_print/test_print.cpp b/tests/fff_print/test_print.cpp index 0b93aeeb0e..9417934276 100644 --- a/tests/fff_print/test_print.cpp +++ b/tests/fff_print/test_print.cpp @@ -1,3 +1,13 @@ +#ifdef WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#ifndef NOMINMAX +#define NOMINMAX +#endif +#include +#endif + #include #include #include @@ -11,15 +21,6 @@ #include "libslic3r/TriangleMesh.hpp" #include #include -#ifdef WIN32 -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#ifndef NOMINMAX -#define NOMINMAX -#endif -#include -#endif #include diff --git a/tests/slic3rutils/test_dev_mapping.cpp b/tests/slic3rutils/test_dev_mapping.cpp index 8d051b326f..4e32bcc20d 100644 --- a/tests/slic3rutils/test_dev_mapping.cpp +++ b/tests/slic3rutils/test_dev_mapping.cpp @@ -3,11 +3,6 @@ // makes std::byte a competing candidate (otherwise the Windows COM headers pulled in via // DeviceManager.hpp error with an ambiguous `byte`). wx/timer.h must precede DeviceManager.hpp, // which includes DeviceErrorDialog.hpp (uses wxTimerEvent) before its own wx/timer.h include. -#include -#include "slic3r/GUI/DeviceCore/DevDefs.h" -#include "libslic3r/ProjectTask.hpp" -#include -#include #ifdef WIN32 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN @@ -18,6 +13,12 @@ #include #endif +#include +#include "slic3r/GUI/DeviceCore/DevDefs.h" +#include "libslic3r/ProjectTask.hpp" +#include +#include + #include #include diff --git a/tests/slic3rutils/test_device_progress.cpp b/tests/slic3rutils/test_device_progress.cpp index 459eac4005..3d42b012a2 100644 --- a/tests/slic3rutils/test_device_progress.cpp +++ b/tests/slic3rutils/test_device_progress.cpp @@ -2,8 +2,6 @@ // ambiguity in the Windows COM headers. // why: wx/timer.h must precede DeviceManager.hpp because // DeviceErrorDialog.hpp uses wxTimerEvent. -#include -#include "libslic3r/ProjectTask.hpp" #ifdef WIN32 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN @@ -14,6 +12,9 @@ #include #endif +#include +#include "libslic3r/ProjectTask.hpp" + #include #include diff --git a/tests/slic3rutils/test_filament_bitmap_utils.cpp b/tests/slic3rutils/test_filament_bitmap_utils.cpp index dc34d04e56..df5bba0567 100644 --- a/tests/slic3rutils/test_filament_bitmap_utils.cpp +++ b/tests/slic3rutils/test_filament_bitmap_utils.cpp @@ -1,11 +1,6 @@ // recompute_mixed_slot_colors lives in libslic3r_gui; this is the only suite that links it. // Same Windows include prologue as test_dev_mapping.cpp (wx pulls in ; keep // WIN32_LEAN_AND_MEAN / NOMINMAX ahead of the Catch2 headers). -#include -#include "libslic3r/Config.hpp" -#include -#include -#include #ifdef WIN32 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN @@ -16,6 +11,12 @@ #include #endif +#include +#include "libslic3r/Config.hpp" +#include +#include +#include + #include #include diff --git a/tests/slic3rutils/test_scene_raycaster.cpp b/tests/slic3rutils/test_scene_raycaster.cpp index 20443bf270..a1be46f216 100644 --- a/tests/slic3rutils/test_scene_raycaster.cpp +++ b/tests/slic3rutils/test_scene_raycaster.cpp @@ -1,13 +1,4 @@ // Orca: This suite links libslic3r_gui; navigation raycasts need no wx application or GL context. -#include -#include "slic3r/GUI/MeshUtils.hpp" -#include "libslic3r/Point.hpp" -#include -#include -#include -#include "libslic3r/TriangleMesh.hpp" -#include "libslic3r/Geometry.hpp" -#include #ifdef WIN32 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN @@ -20,6 +11,16 @@ #include #endif +#include +#include "slic3r/GUI/MeshUtils.hpp" +#include "libslic3r/Point.hpp" +#include +#include +#include +#include "libslic3r/TriangleMesh.hpp" +#include "libslic3r/Geometry.hpp" +#include + #include #include "slic3r/GUI/Camera.hpp"