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',
112 install_headers(glib_sub_headers, subdir : 'glib-2.0/glib')
114 deprecated_sources = files(
115 'deprecated/gallocator.c',
116 'deprecated/gcache.c',
117 'deprecated/gcompletion.c',
119 'deprecated/gthread-deprecated.c'
122 glib_sources = files(
198 'gvariant-serialiser.c',
199 'gvarianttypeinfo.c',
206 if host_system == 'windows'
207 glib_win_rc = configure_file(
210 configuration: glibconfig_conf,
212 glib_win_res = windows.compile_resources(glib_win_rc)
213 glib_sources += [glib_win_res]
214 glib_sources += files('gwin32.c', 'gspawn-win32.c', 'giowin32.c')
215 platform_deps = [winsock2, cc.find_library('winmm')]
217 glib_sources += files('glib-unix.c', 'gspawn.c', 'giounix.c')
221 glib_sources += files('gthread-@0@.c'.format(threads_implementation))
224 glib_dtrace_obj = dtrace_obj_gen.process('glib_probes.d')
225 glib_dtrace_hdr = dtrace_hdr_gen.process('glib_probes.d')
231 pcre_static_args = []
233 if use_pcre_static_flag
234 pcre_static_args = ['-DPCRE_STATIC']
237 libglib = library('glib-2.0',
238 glib_dtrace_obj, glib_dtrace_hdr,
239 sources : [deprecated_sources, glib_sources],
240 version : library_version,
241 soversion : soversion,
243 # intl.lib is not compatible with SAFESEH
244 link_args : [noseh_link_args, glib_link_flags, win32_ldflags],
245 include_directories : configinc,
246 link_with : [charset_lib, gnulib_lib],
247 dependencies : [pcre, thread_dep, libintl, librt] + libiconv + platform_deps,
248 c_args : ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION'] + pcre_static_args + glib_hidden_visibility_args
251 libglib_dep = declare_dependency(
253 # thread_dep doesn't get pulled in from libglib atm,
254 # see https://github.com/mesonbuild/meson/issues/1426
255 dependencies : [thread_dep, libintl],
256 # We sadly need to export configinc here because everyone includes <glib/*.h>
257 include_directories : [configinc, glibinc])
259 pkg.generate(libraries : [libglib, libintl],
260 libraries_private : [osx_ldflags, win32_ldflags],
261 subdirs : ['glib-2.0'],
262 extra_cflags : ['-I${libdir}/glib-2.0/include'] + win32_cflags,
263 variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')),
264 'glib_genmarshal=' + join_paths('${bindir}', 'glib-genmarshal'),
265 'gobject_query=' + join_paths('${bindir}', 'gobject-query'),
266 'glib_mkenums=' + join_paths('${bindir}', 'glib-mkenums')],
267 version : glib_version,
268 install_dir : glib_pkgconfigreldir,
269 filebase : 'glib-2.0',
271 description : 'C Utility Library',
274 # On Windows, glib needs a spawn helper for g_spawn* API
275 if host_system == 'windows'
276 if host_machine.cpu_family() == 'x86'
277 executable('gspawn-win32-helper', 'gspawn-win32-helper.c',
280 include_directories : configinc,
281 dependencies : [libglib_dep])
282 executable('gspawn-win32-helper-console', 'gspawn-win32-helper.c',
284 c_args : ['-DHELPER_CONSOLE'],
285 include_directories : configinc,
286 dependencies : [libglib_dep])
288 executable('gspawn-win64-helper', 'gspawn-win32-helper.c',
291 include_directories : configinc,
292 dependencies : [libglib_dep])
293 executable('gspawn-win64-helper-console', 'gspawn-win32-helper.c',
295 c_args : ['-DHELPER_CONSOLE'],
296 include_directories : configinc,
297 dependencies : [libglib_dep])
300 gtester = executable('gtester', 'gtester.c',
302 include_directories : configinc,
303 dependencies : [libglib_dep])
306 install_data('gtester-report', install_dir : get_option('bindir'))
308 install_data('glib_gdb.py', install_dir : join_paths(glib_pkgdatadir, 'gdb'))
310 gdb_conf = configuration_data()
311 gdb_conf.set('datadir', glib_datadir)
312 # This is also used in gobject/meson.build
313 if host_system != 'windows'
314 # XXX: We add a leading './' because glib_libdir is an absolute path and we
315 # need it to be a relative path so that join_paths appends it to the end.
316 gdb_install_dir = join_paths(glib_datadir, 'gdb', 'auto-load', './' + glib_libdir)
318 # FIXME: Cannot install on Windows because the path will contain a drive
319 # letter and colons are not allowed in paths.
320 gdb_install_dir = false
323 input: 'libglib-gdb.py.in',
324 output: 'libglib-2.0.so.@0@-gdb.py'.format(library_version),
325 configuration: gdb_conf,
326 install_dir: gdb_install_dir,
330 glib_stp = configure_file(input : 'glib.stp.in',
331 output : '@0@.stp'.format(libglib.full_path().split('/').get(-1)),
332 configuration : stp_cdata,
333 install_dir : tapset_install_dir,