From b1912e2ef9d078f6bbff8f76cbc714f0388cb814 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Thu, 2 May 2024 15:55:55 +0900 Subject: [PATCH] infra: fix build failure using c++17 (or later) with MSVC. the WIN32_LEAN_AND_MEAN definition will remove the unused features in windows.h that helps to improve the build-speed as well as fixing the issue. Issue: https://github.com/thorvg/thorvg/issues/2225 Co-Authored-By: Hermet Park --- meson.build | 2 ++ src/tools/lottie2gif/lottie2gif.cpp | 1 + src/tools/svg2png/svg2png.cpp | 3 ++- src/tools/svg2tvg/svg2tvg.cpp | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index e10b7fae..5ebfa185 100644 --- a/meson.build +++ b/meson.build @@ -124,6 +124,8 @@ if get_option('log') == true config_h.set10('THORVG_LOG_ENABLED', true) endif +#Miscellaneous +config_h.set10('WIN32_LEAN_AND_MEAN', true) configure_file( output: 'config.h', diff --git a/src/tools/lottie2gif/lottie2gif.cpp b/src/tools/lottie2gif/lottie2gif.cpp index 6653985c..2141e948 100644 --- a/src/tools/lottie2gif/lottie2gif.cpp +++ b/src/tools/lottie2gif/lottie2gif.cpp @@ -25,6 +25,7 @@ #include #include #ifdef _WIN32 + #define WIN32_LEAN_AND_MEAN #include #ifndef PATH_MAX #define PATH_MAX MAX_PATH diff --git a/src/tools/svg2png/svg2png.cpp b/src/tools/svg2png/svg2png.cpp index bbfeee54..3af8fdcc 100644 --- a/src/tools/svg2png/svg2png.cpp +++ b/src/tools/svg2png/svg2png.cpp @@ -24,8 +24,8 @@ #include #include #include -#include "lodepng.h" #ifdef _WIN32 + #define WIN32_LEAN_AND_MEAN #include #ifndef PATH_MAX #define PATH_MAX MAX_PATH @@ -36,6 +36,7 @@ #include #include #endif +#include "lodepng.h" #define WIDTH_8K 7680 #define HEIGHT_8K 4320 diff --git a/src/tools/svg2tvg/svg2tvg.cpp b/src/tools/svg2tvg/svg2tvg.cpp index 68e4b783..c4dc7e81 100644 --- a/src/tools/svg2tvg/svg2tvg.cpp +++ b/src/tools/svg2tvg/svg2tvg.cpp @@ -25,6 +25,7 @@ #include #include #ifdef _WIN32 + #define WIN32_LEAN_AND_MEAN #include #ifndef PATH_MAX #define PATH_MAX MAX_PATH