Commit 6c815ebd authored by Mathieu Duponchelle's avatar Mathieu Duponchelle

Add meson build definitions

parent a1bb7bfb
Pipeline #9329 passed with stages
in 11 minutes and 30 seconds
sources = [
'pygboxed.c',
'pygenum.c',
'pygflags.c',
'pyginterface.c',
'pygobject-object.c',
'pygparamspec.c',
'pygpointer.c',
'pygoptioncontext.c',
'pygoptiongroup.c',
'pygspawn.c',
'gimodule.c',
'pygi-repository.c',
'pygi-info.c',
'pygi-foreign.c',
'pygi-struct.c',
'pygi-source.c',
'pygi-argument.c',
'pygi-resulttuple.c',
'pygi-type.c',
'pygi-boxed.c',
'pygi-closure.c',
'pygi-ccallback.c',
'pygi-util.c',
'pygi-property.c',
'pygi-signal-closure.c',
'pygi-invoke.c',
'pygi-cache.c',
'pygi-marshal-cleanup.c',
'pygi-basictype.c',
'pygi-list.c',
'pygi-array.c',
'pygi-error.c',
'pygi-object.c',
'pygi-value.c',
'pygi-enum-marshal.c',
'pygi-struct-marshal.c',
'pygi-hashtable.c']
headers = [
'pygobject.h'
]
install_headers(headers, subdir : 'pygobject-@0@'.format(platform_version))
python_sources = [
'_constants.py',
'docstring.py',
'_error.py',
'importer.py',
'__init__.py',
'module.py',
'_option.py',
'_ossighelper.py',
'_propertyhelper.py',
'pygtkcompat.py',
'_signalhelper.py',
'types.py']
python.install_sources(python_sources,
pure : false,
subdir : 'gi'
)
giext = python.extension_module('_gi', sources,
dependencies : [python_dep, glib_dep, gi_dep, ffi_dep],
include_directories: include_directories('..'),
install: true,
subdir : 'gi',
c_args: ['-DHAVE_CONFIG_H', '-DPY_SSIZE_T_CLEAN'] + python_no_warn_flags
)
if pycairo_dep.found()
gicairoext = python.extension_module('_gi_cairo', ['pygi-foreign-cairo.c'],
dependencies : [python_dep, glib_dep, gi_dep, ffi_dep, pycairo_dep],
c_args: ['-DHAVE_CONFIG_H', '-DPY_SSIZE_T_CLEAN'] + python_no_warn_flags)
endif
subdir('overrides')
subdir('repository')
python_sources = [
'GLib.py',
'Gtk.py',
'Gdk.py',
'GObject.py',
'Gio.py',
'GIMarshallingTests.py',
'Pango.py',
'keysyms.py',
'__init__.py']
python.install_sources(python_sources,
subdir : join_paths('gi', 'overrides')
)
python_sources = ['__init__.py']
python.install_sources(python_sources,
subdir : join_paths('gi', 'repository')
)
project('pygobject', 'c',
version : '3.27.6',
meson_version : '>= 0.36.0',
default_options : [ 'warning_level=1',
'buildtype=debugoptimized'])
pygobject_version = meson.project_version()
version_arr = pygobject_version.split('.')
pygobject_version_major = version_arr[0].to_int()
pygobject_version_minor = version_arr[1].to_int()
pygobject_version_micro = version_arr[2].to_int()
platform_version = '@0@.0'.format(pygobject_version_major)
pymod = import('python')
python = pymod.find_installation(get_option('python'))
python_dep = python.dependency(required : true)
python_no_warn_flags = []
gi_dep = dependency('gobject-introspection-1.0', version : '>= 1.55.0', required : true,
fallback: ['gobject-introspection', 'girepo_dep'])
glib_dep = dependency('glib-2.0', version : '>= 2.55.0', required : true,
fallback: ['glib', 'libglib_dep'])
gobject_dep = dependency('gobject-2.0', version : '>= 2.55.0', required : true,
fallback: ['glib', 'libgobject_dep'])
gio_dep = dependency('gio-2.0', version : '>= 2.55.0', required : true,
fallback: ['glib', 'libgio_dep'])
gmodule_dep = dependency('gmodule-2.0', version : '>= 2.55.0',
fallback: ['glib', 'libgmodule_dep'])
ffi_dep = dependency('libffi', version : '>= 3.0', required : true,
fallback : ['libffi', 'ffi_dep'])
cairo_dep = dependency('cairo', required: false)
cairo_gobject_dep = dependency('cairo-gobject', required: false)
if python.language_version().version_compare('>= 3.0')
pycairo_dep = dependency('py3cairo', required: false)
else
pycairo_dep = dependency('pycairo', required: false)
endif
cdata = configuration_data()
cdata.set('PYGOBJECT_MAJOR_VERSION', pygobject_version_major)
cdata.set('PYGOBJECT_MINOR_VERSION', pygobject_version_minor)
cdata.set('PYGOBJECT_MICRO_VERSION', pygobject_version_micro)
configure_file(output : 'config.h', configuration : cdata)
pkgconf = configuration_data()
pkgconf.set('prefix', join_paths(get_option('prefix')))
pkgconf.set('exec_prefix', '${prefix}')
pkgconf.set('includedir', '${prefix}/include')
pkgconf.set('datarootdir', '${prefix}/share')
pkgconf.set('datadir', '${datarootdir}')
pkgconf.set('VERSION', pygobject_version)
pkg_install_dir = '@0@/pkgconfig'.format(get_option('libdir'))
configure_file(input : 'pygobject-@0@.pc.in'.format(platform_version),
output : 'pygobject-@0@.pc'.format(platform_version),
configuration : pkgconf,
install_dir : pkg_install_dir)
configure_file(input : 'PKG-INFO.in',
output : 'pygobject-@0@-py@1@.egg-info'.format(pygobject_version, python.language_version()),
configuration : pkgconf,
install_dir : python.get_install_dir(subdir : 'gi'))
subdir('gi')
subdir('pygtkcompat')
subdir('tests')
option('python', type : 'string', value : 'python3')
python_sources = [
'__init__.py',
'generictreemodel.py',
'pygtkcompat.py']
python.install_sources(python_sources,
subdir : 'pygtkcompat'
)
......@@ -510,6 +510,9 @@ class build_tests(Command):
"--library=gimarshallingtests",
"--pkg=glib-2.0",
"--pkg=gio-2.0",
"--cflags-begin",
"-I%s" % gi_tests_dir,
"--cflags-end",
"--output=%s" % gir_path,
] + ext.sources + ext.depends)
......
glib
libffi
proxy-libintl
zlib
gobject-introspection
[wrap-git]
directory=glib
url=git://git.gnome.org/glib
push-url=ssh://git.gnome.org/git/glib
revision=master
[wrap-git]
directory=gobject-introspection
url=https://gitlab.gnome.org/GNOME/gobject-introspection.git
push-url=git@gitlab.gnome.org:GNOME/gobject-introspection.git
revision=master
[wrap-git]
directory=libffi
url=https://github.com/centricular/libffi.git
revision=meson
[wrap-git]
directory=proxy-libintl
url=https://github.com/centricular/proxy-libintl.git
revision=master
[wrap-git]
directory=zlib
url=https://github.com/centricular/zlib.git
revision=meson
......@@ -7,8 +7,6 @@ import signal
import subprocess
import atexit
import warnings
import importlib
import sys
import imp
......
......@@ -20,6 +20,7 @@
#define EXTRA_TESTS
#include <glib-object.h>
#include <gitestmacros.h>
typedef enum
{
......@@ -35,22 +36,34 @@ typedef enum
GI_MARSHALLING_TESTS_EXTRA_FLAGS_VALUE2 = (gint)(1 << 31),
} GIMarshallingTestsExtraFlags;
_GI_TEST_EXTERN
GType gi_marshalling_tests_extra_flags_get_type (void) G_GNUC_CONST;
#define GI_MARSHALLING_TESTS_TYPE_EXTRA_FLAGS (gi_marshalling_tests_extra_flags_get_type ())
_GI_TEST_EXTERN
void gi_marshalling_tests_compare_two_gerrors_in_gvalue (GValue *v, GValue *v1);
_GI_TEST_EXTERN
void gi_marshalling_tests_ghashtable_enum_none_in (GHashTable *hash_table);
_GI_TEST_EXTERN
GHashTable * gi_marshalling_tests_ghashtable_enum_none_return (void);
_GI_TEST_EXTERN
gchar * gi_marshalling_tests_filename_copy (gchar *path_in);
_GI_TEST_EXTERN
gboolean gi_marshalling_tests_filename_exists (gchar *path);
_GI_TEST_EXTERN
gchar * gi_marshalling_tests_filename_to_glib_repr (gchar *path_in, gsize *len);
_GI_TEST_EXTERN
GIMarshallingTestsExtraEnum * gi_marshalling_tests_enum_array_return_type (gsize *n_members);
_GI_TEST_EXTERN
void gi_marshalling_tests_extra_flags_large_in (GIMarshallingTestsExtraFlags value);
_GI_TEST_EXTERN
gchar *gi_marshalling_tests_extra_utf8_full_return_invalid (void);
_GI_TEST_EXTERN
void gi_marshalling_tests_extra_utf8_full_out_invalid (gchar **utf8);
#endif /* EXTRA_TESTS */
gnome = import('gnome')
host_system = host_machine.system()
cc = meson.get_compiler('c')
visibility_args = []
if get_option('default_library') != 'static'
if host_system == 'windows'
visibility_args += ['-DDLL_EXPORT']
if cc.get_id() == 'msvc'
visibility_args += ['-D_GI_EXTERN=__declspec(dllexport) extern']
elif cc.has_argument('-fvisibility=hidden')
visibility_args += ['-D_GI_EXTERN=__attribute__((visibility("default"))) __declspec(dllexport) extern']
visibility_args += ['-fvisibility=hidden']
endif
elif cc.has_argument('-fvisibility=hidden')
visibility_args += ['-D_GI_EXTERN=__attribute__((visibility("default"))) extern']
visibility_args += ['-fvisibility=hidden']
endif
endif
if gi_dep.type_name() == 'pkgconfig'
gi_datadir = gi_dep.get_pkgconfig_variable('gidatadir')
regress_sources = [join_paths(gi_datadir, 'tests', 'regress.c')]
regress_headers = [join_paths(gi_datadir, 'tests', 'regress.h')]
regress_incdir = include_directories(join_paths(gi_datadir, 'tests'))
marshalling_sources = [join_paths(gi_datadir, 'tests', 'gimarshallingtests.c')]
marshalling_headers = [join_paths(gi_datadir, 'tests', 'gimarshallingtests.h')]
else
gi_subproject = subproject('gobject-introspection')
regress_sources = gi_subproject.get_variable('test_regress_sources')
regress_headers = gi_subproject.get_variable('test_regress_headers')
regress_incdir = gi_subproject.get_variable('test_regress_incdirs')
marshalling_sources = gi_subproject.get_variable('test_marshalling_sources')
marshalling_headers = gi_subproject.get_variable('test_marshalling_headers')
gi_datadir = join_paths(meson.source_root(), 'subprojects', 'gobject-introspection', 'tests')
endif
marshalling_sources += ['gimarshallingtestsextra.c']
marshalling_headers += ['gimarshallingtestsextra.h']
marshalling_lib = library(
'gimarshallingtests',
sources : marshalling_sources,
dependencies : [glib_dep, gobject_dep, gio_dep, gmodule_dep],
include_directories : regress_incdir,
c_args: visibility_args,
)
gnome.generate_gir(
marshalling_lib,
sources : marshalling_sources + marshalling_headers,
nsversion : '1.0',
namespace : 'GIMarshallingTests',
dependencies : [glib_dep, gobject_dep, gio_dep, gmodule_dep],
symbol_prefix : 'gi_marshalling_tests',
includes : ['Gio-2.0'],
build_by_default : true,
)
regress_sources += ['regressextra.c']
regress_headers += ['regressextra.h']
regress_deps = [glib_dep, gobject_dep, gio_dep, gmodule_dep]
regress_c_args = []
if cairo_dep.found() and cairo_gobject_dep.found()
regress_deps += [cairo_dep, cairo_gobject_dep]
else
regress_c_args += ['-D_GI_DISABLE_CAIRO']
endif
regress_lib = library(
'regress',
sources : regress_sources,
dependencies : regress_deps,
include_directories : regress_incdir,
c_args: regress_c_args + visibility_args,
)
gnome.generate_gir(
regress_lib,
sources : regress_sources + regress_headers,
nsversion : '1.0',
namespace : 'Regress',
includes : ['Gio-2.0', 'cairo-1.0'],
build_by_default : true,
dependencies : regress_deps,
extra_args: regress_c_args,
)
helper_sources = [
'testhelpermodule.c',
'test-floating.c',
'test-thread.c',
'test-unknown.c']
helperext = python.extension_module('testhelper', helper_sources,
dependencies : [python_dep, glib_dep, gobject_dep],
c_args: ['-DPY_SSIZE_T_CLEAN'],
include_directories: include_directories(join_paths('..', 'gi'))
)
schemas = gnome.compile_schemas(build_by_default: true)
envdata = environment()
envdata.append('GI_TYPELIB_PATH', meson.current_build_dir())
if gi_dep.type_name() == 'internal'
envdata.append('GI_TYPELIB_PATH', join_paths(meson.build_root(), 'subprojects', 'gobject-introspection', 'gir'))
endif
if host_machine.system() == 'linux'
envdata.prepend('LD_LIBRARY_PATH', meson.current_build_dir())
endif
if host_machine.system() == 'windows'
envdata.prepend('PATH', join_paths(get_option('prefix'), get_option('bindir')))
endif
envdata.append('PYTHONPATH', join_paths(meson.current_build_dir(), '..'))
envdata.append('TESTS_BUILDDIR', meson.current_build_dir())
test('pygobject-test-suite', python,
args : [join_paths(meson.current_source_dir(), 'runtests.py')],
env : envdata)
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