From d039f043005d4d542e6327c6928b177b9b49913f Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 18 Jul 2022 07:13:11 +0300 Subject: [PATCH 53/53] Meson: Detect MagickWand See osdn #45007 Signed-off-by: Marko Lindqvist --- doc/INSTALL.meson | 4 ++++ gen_headers/meson_fc_config.h.in | 3 +++ gen_headers/meson_freeciv_config.h.in | 3 +++ meson.build | 19 ++++++++++++++++++- meson_options.txt | 5 +++++ windows/installer_cross/meson-winbuild.sh | 2 +- 6 files changed, 34 insertions(+), 2 deletions(-) diff --git a/doc/INSTALL.meson b/doc/INSTALL.meson index a0580b6a11..99af3deb3c 100644 --- a/doc/INSTALL.meson +++ b/doc/INSTALL.meson @@ -129,6 +129,10 @@ syslua ('try'/'true'/'false') source tree. The default is 'try' to use lua from the system if possible, but fallback to using freeciv's included one if not found from system. +mwand ('try'/'true'/'false') + Whether to build against MagickWand to have support for additional + mapimg formats. The default is 'try' to enable the support if possible. + audio (boolean): Build sound support to the clients. Defaults to true. diff --git a/gen_headers/meson_fc_config.h.in b/gen_headers/meson_fc_config.h.in index f524c74b43..787a69405f 100644 --- a/gen_headers/meson_fc_config.h.in +++ b/gen_headers/meson_fc_config.h.in @@ -76,6 +76,9 @@ /* Can run programs as root */ #mesondefine ALWAYS_ROOT +/* Have magickwand mapimg toolkit */ +#mesondefine HAVE_MAPIMG_MAGICKWAND + /* struct ip_mreqn available */ #mesondefine HAVE_IP_MREQN diff --git a/gen_headers/meson_freeciv_config.h.in b/gen_headers/meson_freeciv_config.h.in index 077762c7ec..d47c58ed80 100644 --- a/gen_headers/meson_freeciv_config.h.in +++ b/gen_headers/meson_freeciv_config.h.in @@ -67,6 +67,9 @@ /* This is crosser-based build */ #mesondefine FREECIV_CROSSER +/* MagickWand version 7 API in use */ +#mesondefine FREECIV_MWAND7 + /* Produce debug version */ #mesondefine FREECIV_DEBUG diff --git a/meson.build b/meson.build index 55d801cbce..14fb531026 100644 --- a/meson.build +++ b/meson.build @@ -387,6 +387,23 @@ if zstd_dep.found() pub_conf_data.set('FREECIV_HAVE_LIBZSTD', 1) endif +mw_req = get_option('mwand') +if mw_req != 'false' + mw_dep = dependency('MagickWand', version : '>= 7.0', required : false) + if mw_dep.found() + pub_conf_data.set('FREECIV_MWAND7', '1') + else + mw_dep = dependency('MagickWand', version : '>= 6.0', required : false) + endif + if mw_dep.found() + priv_conf_data.set('HAVE_MAPIMG_MAGICKWAND', '1') + elif mw_req == 'true' + error('MagickWand support requested but not found.') + endif +else + mw_dep = [] +endif + syslua = get_option('syslua') lua_dep_tmp = dependency('lua-5.4', required:false) @@ -833,7 +850,7 @@ common_lib = library('freeciv', m_dep, sqlite3_dep, net_dep, jansson_dep, lua_dep, lzma_dep, zstd_dep, bcrypt_lib_dep, iconv_lib_dep, - gettext_dep, charset_dep, + gettext_dep, charset_dep, mw_dep, dependency('threads')], install : true ) diff --git a/meson_options.txt b/meson_options.txt index 75e0d82429..7c5c925e24 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -30,6 +30,11 @@ option('syslua', choices: ['try', 'true', 'false'], description: 'Use lua from system') +option('mwand', + type: 'combo', + choices: ['try', 'true', 'false'], + description: 'Build MagickWand support to mapimg') + option('audio', type: 'boolean', value: true, diff --git a/windows/installer_cross/meson-winbuild.sh b/windows/installer_cross/meson-winbuild.sh index c5b3910596..372930a50a 100755 --- a/windows/installer_cross/meson-winbuild.sh +++ b/windows/installer_cross/meson-winbuild.sh @@ -125,7 +125,7 @@ export PKG_CONFIG_PATH=${DLLSPATH}/lib/pkgconfig export PATH="$DLLSPATH/linux/libexec:$PATH" if ! meson --cross-file=cross.txt -Dprefix=$MESON_INSTALL_DIR -Dclients=$CLIENT -Dfcmp=$FCMP \ - ${NLS} -Dsyslua=false -Druledit=$RULEDIT $QTPARAMS \ + ${NLS} -Dsyslua=false -Dmwand=false -Druledit=$RULEDIT $QTPARAMS \ ../../.. $EXTRA_CONFIG ; then echo "Meson run failed!" >&2 exit 1 -- 2.35.1