From def4fff7ac53637e3ef48a1b3bb28193f208a0f4 Mon Sep 17 00:00:00 2001 From: Andrew Potter Date: Wed, 22 Jun 2022 10:03:54 -0700 Subject: [PATCH 1/2] meson: enable static building on windows --- libxml++config.h.meson | 2 ++ meson.build | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libxml++config.h.meson b/libxml++config.h.meson index 2f0264f0..2a5f03b2 100755 --- a/libxml++config.h.meson +++ b/libxml++config.h.meson @@ -16,6 +16,8 @@ /* Micro version number of libxml++. */ #mesondefine LIBXMLXX_MICRO_VERSION +#mesondefine LIBXMLXX_STATIC + // Enable DLL-specific stuff only when not building a static library #if !defined(__CYGWIN__) && (defined(__MINGW32__) || defined(_MSC_VER)) && !defined(LIBXMLXX_STATIC) # define LIBXMLPP_DLL 1 diff --git a/meson.build b/meson.build index 259069ab..c9441449 100644 --- a/meson.build +++ b/meson.build @@ -325,10 +325,12 @@ endif # Static library? library_build_type = get_option('default_library') +pkg_conf_data.set('LIBXMLXX_STATIC', library_build_type == 'static') + if cpp_compiler.get_argument_syntax() == 'msvc' - if library_build_type == 'static' or library_build_type == 'both' - error('Static builds are not supported by MSVC-style builds') + if library_build_type == 'both' + error('Dynamic+Static builds are not supported by MSVC-style builds') endif endif From f5bb005e8aa1e80d5e30daca42ceaa70baa8e075 Mon Sep 17 00:00:00 2001 From: Andrew Potter Date: Wed, 22 Jun 2022 13:32:08 -0700 Subject: [PATCH 2/2] meson: no _WINDLL when static --- libxml++/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libxml++/meson.build b/libxml++/meson.build index a3960ff9..27269559 100644 --- a/libxml++/meson.build +++ b/libxml++/meson.build @@ -88,7 +88,7 @@ endforeach xmlxx_cpp_args = [ '-DLIBXMLPP_BUILD=1' ] # Make sure we are exporting the symbols from the DLL -if is_msvc +if is_msvc and get_option('default_library') != 'static' xmlxx_cpp_args += ['-D_WINDLL'] endif