Commit cf93b27c authored by Christoph Reiter's avatar Christoph Reiter 🐍 Committed by Christoph Reiter

meson: fix static build under Windows

Properly define GLIB/GOBJECT_STATIC_COMPILATION when static build is enabled.
Use library() instead of shared_library() to allow selecting static builds.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
parent aa7c5cbd
......@@ -724,7 +724,7 @@ else
gio_dtrace_hdr = []
endif
libgio = shared_library('gio-2.0',
libgio = library('gio-2.0',
gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources,
gio_dtrace_hdr, gio_dtrace_obj,
version : library_version,
......
......@@ -14,7 +14,7 @@ gdbus_example_objectmanager_generated = custom_target('gdbus-example-objectmanag
'--generate-docbook', 'gdbus-example-objectmanager-generated',
'@INPUT@'])
libgdbus_example_objectmanager = shared_library('libgdbus-example-objectmanager',
libgdbus_example_objectmanager = library('libgdbus-example-objectmanager',
gdbus_example_objectmanager_generated,
c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
dependencies : [libglib_dep, libgmodule_dep, libgobject_dep, libgio_dep],
......
libtestmodulea = shared_library('testmodulea', 'test-module-a.c',
libtestmodulea = library('testmodulea', 'test-module-a.c',
install : false,
dependencies : [libglib_dep, libgobject_dep, libgmodule_dep, libgio_dep],
c_args : [ ]
)
libtestmoduleb = shared_library('testmoduleb', 'test-module-b.c',
libtestmoduleb = library('testmoduleb', 'test-module-b.c',
install : false,
dependencies : [libglib_dep, libgobject_dep, libgmodule_dep, libgio_dep],
c_args : [ ]
......
......@@ -18,6 +18,9 @@
*/
#mesondefine GLIB_USING_SYSTEM_PRINTF
#mesondefine GLIB_STATIC_COMPILATION
#mesondefine GOBJECT_STATIC_COMPILATION
G_BEGIN_DECLS
#define G_MINFLOAT FLT_MIN
......@@ -115,7 +118,6 @@ typedef unsigned @glib_intptr_type_define@ guintptr;
#define GLIB_MICRO_VERSION @GLIB_MICRO_VERSION@
@glib_os@
@glib_static_compilation@
@glib_vacopy@
......
......@@ -227,7 +227,7 @@ if use_pcre_static_flag
pcre_static_args = ['-DPCRE_STATIC']
endif
libglib = shared_library('glib-2.0',
libglib = library('glib-2.0',
glib_dtrace_obj, glib_dtrace_hdr,
sources : [deprecated_sources, glib_sources],
version : library_version,
......
......@@ -95,7 +95,7 @@ if host_system == 'windows'
gmodule_sources += [gmodule_win_res]
endif
libgmodule = shared_library('gmodule-2.0',
libgmodule = library('gmodule-2.0',
sources : gmodule_sources,
version : library_version,
soversion : soversion,
......
......@@ -61,7 +61,7 @@ else
gobject_dtrace_hdr = []
endif
libgobject = shared_library('gobject-2.0',
libgobject = library('gobject-2.0',
gobject_dtrace_obj, gobject_dtrace_hdr,
sources : gobject_sources,
version : library_version,
......
......@@ -12,7 +12,7 @@ if host_system == 'windows'
gthread_sources += [gthread_win_res]
endif
libgthread = shared_library('gthread-2.0',
libgthread = library('gthread-2.0',
sources : gthread_sources,
version : library_version,
soversion : soversion,
......
......@@ -123,6 +123,11 @@ if get_option('default_library') != 'static'
endif
endif
if host_system == 'windows' and get_option('default_library') == 'static'
glibconfig_conf.set('GLIB_STATIC_COMPILATION', '1')
glibconfig_conf.set('GOBJECT_STATIC_COMPILATION', '1')
endif
# FIXME: what about Cygwin (G_WITH_CYGWIN)
if host_system == 'windows'
glib_os = '''#define G_OS_WIN32
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment