mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
meson: Fix glib, add gobject, gio, gthread, gmodule, etc
Several small fixes to the build files. Lots of tests have also been added, and glib tests pass now.
This commit is contained in:
committed by
Matthias Clasen
parent
98e641424b
commit
213957970e
65
gobject/meson.build
Normal file
65
gobject/meson.build
Normal file
@@ -0,0 +1,65 @@
|
||||
#FIXME
|
||||
#if host_machine.system() == 'windows'
|
||||
# plat_src = []
|
||||
#else
|
||||
# plat_src = []
|
||||
#endif
|
||||
|
||||
gobject_install_headers = [
|
||||
'gobject-autocleanups.h',
|
||||
'glib-types.h',
|
||||
'gbinding.h',
|
||||
'gboxed.h',
|
||||
'gclosure.h',
|
||||
'genums.h',
|
||||
'gmarshal.h',
|
||||
'gobject.h',
|
||||
'gparam.h',
|
||||
'gparamspecs.h',
|
||||
'gsignal.h',
|
||||
'gsourceclosure.h',
|
||||
'gtype.h',
|
||||
'gtypemodule.h',
|
||||
'gtypeplugin.h',
|
||||
'gvalue.h',
|
||||
'gvaluearray.h',
|
||||
'gvaluecollector.h',
|
||||
'gvaluetypes.h',
|
||||
'gobjectnotifyqueue.c', # sic
|
||||
]
|
||||
install_headers(gobject_install_headers, subdir : 'glib-2.0/gobject/')
|
||||
|
||||
gobject_c_sources = [
|
||||
# 'gobject_probes.d',
|
||||
'gatomicarray.c',
|
||||
'gbinding.c',
|
||||
'gboxed.c',
|
||||
'gclosure.c',
|
||||
'genums.c',
|
||||
'gmarshal.c',
|
||||
'gobject.c',
|
||||
'gobject_trace.h',
|
||||
'gparam.c',
|
||||
'gparamspecs.c',
|
||||
'gsignal.c',
|
||||
'gsourceclosure.c',
|
||||
'gtype.c',
|
||||
'gtypemodule.c',
|
||||
'gtypeplugin.c',
|
||||
'gvalue.c',
|
||||
'gvaluearray.c',
|
||||
'gvaluetransform.c',
|
||||
'gvaluetypes.c',
|
||||
]
|
||||
|
||||
libgobject = shared_library('gobject',
|
||||
sources : [ gobject_c_sources ],
|
||||
version : glib_version,
|
||||
soversion : interface_version,
|
||||
install : true,
|
||||
include_directories : inc_dirs,
|
||||
link_with : libglib,
|
||||
dependencies : libffi_dep,
|
||||
c_args : ['-DG_LOG_DOMAIN="GLib-GObject"', '-DGOBJECT_COMPILATION' ])
|
||||
|
||||
subdir('tests')
|
17
gobject/tests/gobject_test_marshal.py
Executable file
17
gobject/tests/gobject_test_marshal.py
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# FIXME: where does the #include "marshalers.h" go?
|
||||
|
||||
import sys, subprocess
|
||||
|
||||
assert(len(sys.argv) == 3)
|
||||
|
||||
_, listname, outname = sys.argv
|
||||
|
||||
if outname.endswith('.h'):
|
||||
arg = '--header'
|
||||
else:
|
||||
arg = '--body'
|
||||
|
||||
output = subprocess.check_output(['glib-genmarshal', '--prefix=test', '--valist-marshallers', arg, listname])
|
||||
open(outname, 'wb').write(output)
|
69
gobject/tests/meson.build
Normal file
69
gobject/tests/meson.build
Normal file
@@ -0,0 +1,69 @@
|
||||
gobject_tests = [
|
||||
'qdata',
|
||||
'boxed',
|
||||
'enums',
|
||||
'param',
|
||||
'threadtests',
|
||||
'dynamictests',
|
||||
'binding',
|
||||
'properties',
|
||||
'reference',
|
||||
'value',
|
||||
'type',
|
||||
'private',
|
||||
'closure',
|
||||
'object',
|
||||
'signal-handler',
|
||||
'ifaceproperties',
|
||||
]
|
||||
|
||||
test_env = [
|
||||
'G_TEST_SRCDIR=' + meson.current_source_dir(),
|
||||
'G_TEST_BUILDDIR=' + meson.current_build_dir(),
|
||||
]
|
||||
|
||||
foreach test_name : gobject_tests
|
||||
deps = [ libm, thread_dep ]
|
||||
test_src = '@0@.c'.format(test_name)
|
||||
# private is an existing or reserved target it seems
|
||||
if test_name == 'private'
|
||||
test_name = 'gobject-private'
|
||||
endif
|
||||
exe = executable(test_name, test_src,
|
||||
include_directories : inc_dirs,
|
||||
c_args : [ '-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib-GObject"' ],
|
||||
link_with : [ libglib, libgobject ],
|
||||
dependencies : deps,
|
||||
)
|
||||
test(test_name, exe, env : test_env)
|
||||
endforeach
|
||||
|
||||
# The marshalers test requires running a binary, so we cannot build it when
|
||||
# cross-compiling
|
||||
if not meson.is_cross_build()
|
||||
# FIXME: need to pass this as argument to the genmarshal script
|
||||
# and somehow we need to specify it as build dep of the custom targets
|
||||
# lib_genmarshal = meson.build_root() + '/gobject/glib-genmarshal'
|
||||
|
||||
genmarshal = find_program('gobject_test_marshal.py')
|
||||
|
||||
marshalers_h = custom_target('marshalers_h',
|
||||
output : 'marshalers.h',
|
||||
input : 'marshalers.list',
|
||||
command : [ genmarshal, '@INPUT@', '@OUTPUT@' ],
|
||||
)
|
||||
marshalers_c = custom_target('marshalers_c',
|
||||
output : 'marshalers.c',
|
||||
input : 'marshalers.list',
|
||||
command : [ genmarshal, '@INPUT@', '@OUTPUT@' ],
|
||||
)
|
||||
|
||||
exe = executable('signals',
|
||||
'signals.c', marshalers_h, marshalers_c,
|
||||
include_directories : inc_dirs,
|
||||
c_args : [ '-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib-GObject"' ],
|
||||
link_with : [ libglib, libgobject ],
|
||||
dependencies : deps,
|
||||
)
|
||||
test('signals', exe, env : test_env)
|
||||
endif
|
Reference in New Issue
Block a user