From 9159e84ce5aa53026ce2c222cb92742a8c3081ff Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 26 Jan 2022 09:46:38 -0500 Subject: [PATCH] Windows: Do not link DLL specific resources when doing a static build Fixes: #2585 --- glib/meson.build | 16 +++++++++------- gobject/meson.build | 2 +- meson.build | 3 +++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/glib/meson.build b/glib/meson.build index 025e448ad..12375d96f 100644 --- a/glib/meson.build +++ b/glib/meson.build @@ -313,13 +313,15 @@ glib_sources = files( platform_deps = [] if host_system == 'windows' - glib_win_rc = configure_file( - input: 'glib.rc.in', - output: 'glib.rc', - configuration: glibconfig_conf, - ) - glib_win_res = windows.compile_resources(glib_win_rc) - glib_sources += [glib_win_res] + if get_option('default_library') == 'shared' + glib_win_rc = configure_file( + input: 'glib.rc.in', + output: 'glib.rc', + configuration: glibconfig_conf, + ) + glib_win_res = windows.compile_resources(glib_win_rc) + glib_sources += [glib_win_res] + endif glib_sources += files('gwin32.c', 'gspawn-win32.c', 'giowin32.c') platform_deps = [winsock2, cc.find_library('winmm')] if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' diff --git a/gobject/meson.build b/gobject/meson.build index 7e5150e6c..018e84d61 100644 --- a/gobject/meson.build +++ b/gobject/meson.build @@ -43,7 +43,7 @@ gobject_sources = files( 'gvaluetypes.c', ) -if host_system == 'windows' +if host_system == 'windows' and get_option('default_library') == 'shared' gobject_win_rc = configure_file( input: 'gobject.rc.in', output: 'gobject.rc', diff --git a/meson.build b/meson.build index 299f832f8..f86a03bee 100644 --- a/meson.build +++ b/meson.build @@ -200,6 +200,9 @@ endif glib_hidden_visibility_args = [] if get_option('default_library') != 'static' if host_system == 'windows' or host_system == 'cygwin' + if get_option('default_library') != 'shared' + error('On Windows default_library must be "shared" or "static" but not "both"') + endif glib_conf.set('DLL_EXPORT', true) if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' glib_conf.set('_GLIB_EXTERN', '__declspec(dllexport) extern')