Meson: Add missing flags on Windows

win32_cflags gets used globally as cflags and exposed in the .pc file.
win32_ldflags gets passed to glib-2.0 and exposed in the .pc file.

This should match what the autotools build is currently doing with
GLIB_EXTRA_CFLAGS and G_LIBS_EXTRA.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
This commit is contained in:
Xavier Claessens 2018-05-15 15:17:28 -04:00
parent cf28bf1f11
commit 4b82738f0a
2 changed files with 19 additions and 4 deletions

View File

@ -234,7 +234,7 @@ libglib = library('glib-2.0',
soversion : soversion,
install : true,
# intl.lib is not compatible with SAFESEH
link_args : [noseh_link_args, glib_link_flags],
link_args : [noseh_link_args, glib_link_flags, win32_ldflags],
include_directories : configinc,
link_with : [charset_lib, gnulib_lib],
dependencies : [pcre, thread_dep, libintl, librt] + libiconv + platform_deps,
@ -250,9 +250,9 @@ libglib_dep = declare_dependency(
include_directories : [configinc, glibinc])
pkg.generate(libraries : [libglib, libintl],
libraries_private : [osx_ldflags],
libraries_private : [osx_ldflags, win32_ldflags],
subdirs : ['glib-2.0'],
extra_cflags : ['-I${libdir}/glib-2.0/include'],
extra_cflags : ['-I${libdir}/glib-2.0/include'] + win32_cflags,
variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')),
'glib_genmarshal=' + join_paths('${bindir}', 'glib-genmarshal'),
'gobject_query=' + join_paths('${bindir}', 'gobject-query'),

View File

@ -1765,7 +1765,22 @@ if libmount_dep.length() != 0
glib_conf.set('HAVE_LIBMOUNT', 1)
endif
glib_conf.set('GIO_MODULE_DIR', glib_giomodulesdir)
# FIXME: Missing: @G_LIBS_EXTRA@ @GLIB_EXTRA_CFLAGS@ @G_MODULE_LDFLAGS@
# FIXME: Missing: @G_MODULE_LDFLAGS@
win32_cflags = []
win32_ldflags = []
if host_system == 'windows' and cc.get_id() != 'msvc'
# Ensure MSVC-compatible struct packing convention is used when
# compiling for Win32 with gcc. It is used for the whole project and exposed
# in glib-2.0.pc.
win32_cflags = ['-mms-bitfields']
add_project_arguments(win32_cflags, language : 'c')
# Win32 API libs, used only by libglib and exposed in glib-2.0.pc
win32_ldflags = ['-lws2_32', '-lole32', '-lwinmm', '-lshlwapi']
elif host_system == 'cygwin'
win32_ldflags = ['-luser32', '-lkernel32']
endif
# Tracing: dtrace
want_dtrace = get_option('dtrace')