summaryrefslogtreecommitdiff
path: root/gobject
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2016-03-07 11:13:24 +0000
committerTim-Philipp Müller <tim@centricular.com>2017-05-13 11:14:45 +0100
commitc50f02038caef1bbb6cc24d90e0bfa037920a3ce (patch)
tree86312e2844c68420f69da441d81c0a8368e17993 /gobject
parentce4217677b457f9d4db6aba4f15449eaf64106fa (diff)
downloadglib-c50f02038caef1bbb6cc24d90e0bfa037920a3ce.tar.gz
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.
Diffstat (limited to 'gobject')
-rw-r--r--gobject/meson.build65
-rwxr-xr-xgobject/tests/gobject_test_marshal.py17
-rw-r--r--gobject/tests/meson.build69
3 files changed, 151 insertions, 0 deletions
diff --git a/gobject/meson.build b/gobject/meson.build
new file mode 100644
index 000000000..cdb644317
--- /dev/null
+++ b/gobject/meson.build
@@ -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')
diff --git a/gobject/tests/gobject_test_marshal.py b/gobject/tests/gobject_test_marshal.py
new file mode 100755
index 000000000..a0f685265
--- /dev/null
+++ b/gobject/tests/gobject_test_marshal.py
@@ -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)
diff --git a/gobject/tests/meson.build b/gobject/tests/meson.build
new file mode 100644
index 000000000..21aefd966
--- /dev/null
+++ b/gobject/tests/meson.build
@@ -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