From b4e03fd79b7f0edf225638306459aba159583a8b Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 26 Aug 2023 21:05:17 +0300 Subject: [PATCH 11/11] Meson: Add svgflags option See osdn #48439 Signed-off-by: Marko Lindqvist --- client/gui-qt/gui_main.cpp | 7 +++++++ client/svgflag.c | 8 +++++++- gen_headers/meson_freeciv_config.h.in | 3 +++ meson.build | 4 ++++ meson_options.txt | 5 +++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/client/gui-qt/gui_main.cpp b/client/gui-qt/gui_main.cpp index e30107a5b7..60265ed518 100644 --- a/client/gui-qt/gui_main.cpp +++ b/client/gui-qt/gui_main.cpp @@ -113,8 +113,11 @@ static void print_usage() fc_fprintf(stderr, _("Other gui-specific options are:\n")); +#ifdef FREECIV_SVG_FLAGS fc_fprintf(stderr, _("-f, --flags\tEnable svgflags features\n")); +#endif // FREECIV_SVG_FLAGS + fc_fprintf(stderr, _("-s, --shortcutreset\tReset shortcut keys to " "default values\n")); @@ -142,7 +145,11 @@ static bool parse_options(int argc, char **argv) if (is_option("--shortcutreset", argv[i])) { shortcutreset(); } else if (is_option("--flags", argv[i])) { +#ifdef FREECI_SVG_FLAGS svg_flag_enable(); +#else // FREECIV_SVG_FLAGS + fc_fprintf(stderr, _("svg flags not enabled in this freeciv build.")); +#endif // FREECIV_SVG_FLAGS } // Can't check against unknown options, as those might be Qt options diff --git a/client/svgflag.c b/client/svgflag.c index a05b194821..9e64c2b8e1 100644 --- a/client/svgflag.c +++ b/client/svgflag.c @@ -32,13 +32,19 @@ bool _prefer_svg = FALSE; static const char **ordered_extensions = NULL; /**********************************************************************//** - Enable svg flag features. + Try to enable svg flag features. + + @return Whether operation succeeded **************************************************************************/ bool svg_flag_enable(void) { +#ifdef FREECIV_SVG_FLAGS _prefer_svg = TRUE; return TRUE; +#else // FREECIV_SVG_FLAGS + return FALSE; +#endif // FREECIV_SVG_FLAGS } /**********************************************************************//** diff --git a/gen_headers/meson_freeciv_config.h.in b/gen_headers/meson_freeciv_config.h.in index 9ed5c9d2f9..87e612ea5f 100644 --- a/gen_headers/meson_freeciv_config.h.in +++ b/gen_headers/meson_freeciv_config.h.in @@ -51,6 +51,9 @@ /* Has thread condition variable implementation */ #define FREECIV_HAVE_THREAD_COND +/* Has svg flags support enabled */ +#mesondefine FREECIV_SVG_FLAGS + /* Max number of AI modules */ #define FREECIV_AI_MOD_LAST @FREECIV_AI_MOD_LAST@ diff --git a/meson.build b/meson.build index f770c9f752..98bad36f09 100644 --- a/meson.build +++ b/meson.build @@ -892,6 +892,10 @@ if crosser pub_conf_data.set('FREECIV_CROSSER', 1) endif +if get_option('svgflags') + pub_conf_data.set('FREECIV_SVG_FLAGS', 1) +endif + if cxx_build and cxx_compiler.compiles(''' class me { void top(); }; diff --git a/meson_options.txt b/meson_options.txt index 4f1416f329..d0cb9daaf1 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -91,3 +91,8 @@ option('min-win-ver', type: 'string', value: '', description: 'Minimum Windows version to support') + +option('svgflags', + type: 'boolean', + value: false, + description: 'svg flags features enabled on build level') -- 2.40.1