Windows: Do not link DLL specific resources when doing a static build

Fixes: #2585
This commit is contained in:
Xavier Claessens 2022-01-26 09:46:38 -05:00
parent 51e6e4fc2f
commit 9159e84ce5
3 changed files with 13 additions and 8 deletions

View File

@ -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'

View File

@ -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',

View File

@ -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')