1 configure_file(input : 'glibconfig.h.in', output : 'glibconfig.h',
3 install_dir : join_paths(get_option('libdir'), 'glib-2.0/include'),
4 configuration : glibconfig_conf)
10 if have_good_vsnprintf and have_good_snprintf
21 install_headers(glib_headers, subdir : 'glib-2.0')
23 glib_deprecated_headers = files(
24 'deprecated/gallocator.h',
25 'deprecated/gcache.h',
26 'deprecated/gcompletion.h',
29 'deprecated/gthread.h',
31 install_headers(glib_deprecated_headers, subdir : 'glib-2.0/glib/deprecated')
33 glib_sub_headers = files(
34 'glib-autocleanups.h',
110 install_headers(glib_sub_headers, subdir : 'glib-2.0/glib')
112 deprecated_sources = files(
113 'deprecated/gallocator.c',
114 'deprecated/gcache.c',
115 'deprecated/gcompletion.c',
117 'deprecated/gthread-deprecated.c'
120 glib_sources = files(
193 'gvariant-serialiser.c',
194 'gvarianttypeinfo.c',
201 if host_system == 'windows'
202 glib_win_rc = configure_file(
205 configuration: glibconfig_conf,
207 glib_win_res = windows.compile_resources(glib_win_rc)
208 glib_sources += [glib_win_res]
209 glib_sources += files('gwin32.c', 'gspawn-win32.c', 'giowin32.c')
210 platform_deps = [winsock2, cc.find_library('winmm')]
212 glib_sources += files('glib-unix.c', 'gspawn.c', 'giounix.c')
216 glib_sources += files('gthread-@0@.c'.format(threads_implementation))
219 glib_dtrace_obj = dtrace_obj_gen.process('glib_probes.d')
220 glib_dtrace_hdr = dtrace_hdr_gen.process('glib_probes.d')
226 pcre_static_args = []
228 if use_pcre_static_flag
229 pcre_static_args = ['-DPCRE_STATIC']
232 libglib = library('glib-2.0',
233 glib_dtrace_obj, glib_dtrace_hdr,
234 sources : [deprecated_sources, glib_sources],
235 version : library_version,
236 soversion : soversion,
238 # intl.lib is not compatible with SAFESEH
239 link_args : [noseh_link_args, glib_link_flags, win32_ldflags],
240 include_directories : configinc,
241 link_with : [charset_lib, gnulib_lib],
242 dependencies : [pcre, thread_dep, libintl, librt] + libiconv + platform_deps,
243 c_args : ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION'] + pcre_static_args + glib_hidden_visibility_args
246 libglib_dep = declare_dependency(
248 # thread_dep doesn't get pulled in from libglib atm,
249 # see https://github.com/mesonbuild/meson/issues/1426
250 dependencies : [thread_dep, libintl],
251 # We sadly need to export configinc here because everyone includes <glib/*.h>
252 include_directories : [configinc, glibinc])
254 pkg.generate(libraries : [libglib, libintl],
255 libraries_private : [osx_ldflags, win32_ldflags],
256 subdirs : ['glib-2.0'],
257 extra_cflags : ['-I${libdir}/glib-2.0/include'] + win32_cflags,
258 variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')),
259 'glib_genmarshal=' + join_paths('${bindir}', 'glib-genmarshal'),
260 'gobject_query=' + join_paths('${bindir}', 'gobject-query'),
261 'glib_mkenums=' + join_paths('${bindir}', 'glib-mkenums')],
262 version : glib_version,
263 install_dir : glib_pkgconfigreldir,
264 filebase : 'glib-2.0',
266 description : 'C Utility Library',
269 # On Windows, glib needs a spawn helper for g_spawn* API
270 if host_system == 'windows'
271 if host_machine.cpu_family() == 'x86'
272 executable('gspawn-win32-helper', 'gspawn-win32-helper.c',
275 include_directories : configinc,
276 dependencies : [libglib_dep])
277 executable('gspawn-win32-helper-console', 'gspawn-win32-helper.c',
279 c_args : ['-DHELPER_CONSOLE'],
280 include_directories : configinc,
281 dependencies : [libglib_dep])
283 executable('gspawn-win64-helper', 'gspawn-win32-helper.c',
286 include_directories : configinc,
287 dependencies : [libglib_dep])
288 executable('gspawn-win64-helper-console', 'gspawn-win32-helper.c',
290 c_args : ['-DHELPER_CONSOLE'],
291 include_directories : configinc,
292 dependencies : [libglib_dep])
295 gtester = executable('gtester', 'gtester.c',
297 include_directories : configinc,
298 dependencies : [libglib_dep])
301 install_data('gtester-report', install_dir : get_option('bindir'))
303 install_data('glib_gdb.py', install_dir : join_paths(glib_pkgdatadir, 'gdb'))
305 gdb_conf = configuration_data()
306 gdb_conf.set('datadir', glib_datadir)
307 # This is also used in gobject/meson.build
308 if host_system != 'windows'
309 # XXX: We add a leading './' because glib_libdir is an absolute path and we
310 # need it to be a relative path so that join_paths appends it to the end.
311 gdb_install_dir = join_paths(glib_datadir, 'gdb', 'auto-load', './' + glib_libdir)
313 # FIXME: Cannot install on Windows because the path will contain a drive
314 # letter and colons are not allowed in paths.
315 gdb_install_dir = false
318 input: 'libglib-gdb.py.in',
319 output: 'libglib-2.0.so.@0@-gdb.py'.format(library_version),
320 configuration: gdb_conf,
321 install_dir: gdb_install_dir,
325 glib_stp = configure_file(input : 'glib.stp.in',
326 output : '@0@.stp'.format(libglib.full_path().split('/').get(-1)),
327 configuration : stp_cdata,
328 install_dir : tapset_install_dir,