summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2017-05-22 11:13:07 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2017-05-26 12:57:34 +0100
commitc9e7f76415e81dd1bc23632a670dad5cfa1890a6 (patch)
tree0ba77a837e7a6f59d69e4dd24499106c4c870d6d
parent40ea12a3f4ba41cc59602c65205f647f8023bf9d (diff)
downloadclutter-gtk-c9e7f76415e81dd1bc23632a670dad5cfa1890a6.tar.gz
Add Meson build
Meson is a meta-build system that has various advantages over Autotools: - it is fast - it is portable - it is easy to understand - it is well maintained Various projects in the GNOME stack already moved to Meson, including GTK+.
-rw-r--r--clutter-gtk/meson.build66
-rw-r--r--doc/meson.build40
-rw-r--r--doc/xml/gtkdocentities.ent.in7
-rw-r--r--doc/xml/meson.build9
-rw-r--r--examples/meson.build16
-rw-r--r--meson.build189
-rw-r--r--meson_options.txt4
-rw-r--r--po/meson.build3
8 files changed, 334 insertions, 0 deletions
diff --git a/clutter-gtk/meson.build b/clutter-gtk/meson.build
new file mode 100644
index 0000000..73fca24
--- /dev/null
+++ b/clutter-gtk/meson.build
@@ -0,0 +1,66 @@
+clutter_gtk_sources = [
+ 'gtk-clutter-actor.c',
+ 'gtk-clutter-embed.c',
+ 'gtk-clutter-offscreen.c',
+ 'gtk-clutter-texture.c',
+ 'gtk-clutter-util.c',
+ 'gtk-clutter-window.c',
+]
+
+clutter_gtk_headers = [
+ 'clutter-gtk.h',
+
+ 'gtk-clutter-actor.h',
+ 'gtk-clutter-embed.h',
+ 'gtk-clutter-texture.h',
+ 'gtk-clutter-util.h',
+ 'gtk-clutter-window.h',
+]
+
+install_headers(clutter_gtk_headers, subdir: gtk_clutter_api_path)
+
+gtk_clutter_version_conf = configuration_data()
+gtk_clutter_version_conf.set('CLUTTER_GTK_MAJOR_VERSION', gtk_clutter_major_version)
+gtk_clutter_version_conf.set('CLUTTER_GTK_MINOR_VERSION', gtk_clutter_minor_version)
+gtk_clutter_version_conf.set('CLUTTER_GTK_MICRO_VERSION', gtk_clutter_micro_version)
+gtk_clutter_version_conf.set('CLUTTER_GTK_VERSION', meson.project_version())
+configure_file(input: 'gtk-clutter-version.h.in',
+ output: 'gtk-clutter-version.h',
+ configuration: gtk_clutter_version_conf,
+ install: true,
+ install_dir: join_paths(gtk_clutter_includedir, gtk_clutter_api_path))
+
+clutter_gtk = shared_library(gtk_clutter_api_name, clutter_gtk_sources,
+ soversion: soversion,
+ version: libversion,
+ dependencies: [ mathlib_dep, clutter_dep, gtk_dep ],
+ include_directories: root_inc,
+ c_args: common_cflags + gtk_clutter_debug_cflags + [
+ '-DPREFIX="@0@"'.format(gtk_clutter_prefix),
+ '-DLIBDIR="@0@"'.format(gtk_clutter_libdir),
+ '-DG_LOG_DOMAIN="Clutter-Gtk"',
+ '-DG_LOG_USE_STRUCTURED=1',
+ '-DCLUTTER_GTK_COMPILATION',
+ ],
+ link_args: common_ldflags,
+ install: true)
+
+clutter_gtk_dep = declare_dependency(link_with: clutter_gtk,
+ dependencies: [ mathlib_dep, clutter_dep, gtk_dep ],
+ include_directories: include_directories('.'))
+
+if not meson.is_cross_build()
+ gnome.generate_gir(clutter_gtk,
+ sources: clutter_gtk_headers + clutter_gtk_sources,
+ namespace: 'GtkClutter',
+ nsversion: gtk_clutter_api_version,
+ identifier_prefix: 'GtkClutter',
+ symbol_prefix: 'gtk_clutter',
+ export_packages: gtk_clutter_api_name,
+ includes: [ 'Clutter-1.0', 'Gtk-3.0' ],
+ install: true,
+ extra_args: [
+ '--c-include="clutter-gtk/clutter-gtk.h"',
+ '-DCLUTTER_GTK_COMPILATION',
+ ])
+endif
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..026a4ee
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,40 @@
+subdir('xml')
+
+private_headers = [
+ 'gtk-clutter-actor-internal.h',
+ 'gtk-clutter-offscreen.h',
+]
+
+glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
+glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
+gtk_prefix = dependency('gtk+-3.0').get_pkgconfig_variable('prefix')
+gtk_docpath = join_paths(gtk_prefix, 'share', 'gtk-doc', 'html')
+clutter_prefix = dependency('clutter-1.0').get_pkgconfig_variable('prefix')
+clutter_docpath = join_paths(clutter_prefix, 'share', 'gtk-doc', 'html')
+
+docpath = join_paths(gtk_clutter_datadir, 'gtk-doc', 'html')
+
+gnome.gtkdoc(gtk_clutter_api_name,
+ main_xml: '@0@-docs.xml'.format(gtk_clutter_api_name),
+ src_dir: [
+ join_paths(meson.source_root(), 'clutter-gtk'),
+ join_paths(meson.build_root(), 'clutter-gtk'),
+ ],
+ dependencies: clutter_gtk_dep,
+ gobject_typesfile: gtk_clutter_api_name + '.types',
+ scan_args: [
+ '--rebuild-types',
+ '--ignore-decorators=CLUTTER_GTK_EXTERN',
+ '--ignore-headers=' + ' '.join(private_headers),
+ ],
+ fixxref_args: [
+ '--html-dir=@0@'.format(docpath),
+ '--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
+ '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
+ '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
+ '--extra-dir=@0@'.format(join_paths(gtk_docpath, 'gtk3')),
+ '--extra-dir=@0@'.format(join_paths(gtk_docpath, 'gdk3')),
+ '--extra-dir=@0@'.format(join_paths(clutter_docpath, 'clutter-1.0')),
+ ],
+ install: true)
+
diff --git a/doc/xml/gtkdocentities.ent.in b/doc/xml/gtkdocentities.ent.in
new file mode 100644
index 0000000..fd86c16
--- /dev/null
+++ b/doc/xml/gtkdocentities.ent.in
@@ -0,0 +1,7 @@
+<!ENTITY package "@PACKAGE@">
+<!ENTITY package_bugreport "@PACKAGE_BUGREPORT@">
+<!ENTITY package_name "@PACKAGE_NAME@">
+<!ENTITY package_string "@PACKAGE_STRING@">
+<!ENTITY package_tarname "@PACKAGE_TARNAME@">
+<!ENTITY package_url "@PACKAGE_URL@">
+<!ENTITY package_version "@PACKAGE_VERSION@">
diff --git a/doc/xml/meson.build b/doc/xml/meson.build
new file mode 100644
index 0000000..5e1c7da
--- /dev/null
+++ b/doc/xml/meson.build
@@ -0,0 +1,9 @@
+ent_conf = configuration_data()
+ent_conf.set('PACKAGE', 'Clutter-GTK')
+ent_conf.set('PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/enter_bug.cgi?product=clutter-gtk')
+ent_conf.set('PACKAGE_NAME', 'Clutter-GTK')
+ent_conf.set('PACKAGE_STRING', 'clutter-gtk')
+ent_conf.set('PACKAGE_TARNAME', '@0@-@1@'.format(meson.project_name(), meson.project_version()))
+ent_conf.set('PACKAGE_URL', '')
+ent_conf.set('PACKAGE_VERSION', meson.project_version())
+configure_file(input: 'gtkdocentities.ent.in', output: 'gtkdocentities.ent', configuration: ent_conf)
diff --git a/examples/meson.build b/examples/meson.build
new file mode 100644
index 0000000..fe1923e
--- /dev/null
+++ b/examples/meson.build
@@ -0,0 +1,16 @@
+examples = [
+ 'gtk-clutter-events',
+ 'gtk-clutter-multistage',
+ 'gtk-clutter-test',
+ 'gtk-clutter-test-actor',
+ 'gtk-clutter-window-test',
+]
+
+foreach e: examples
+ executable(e, e + '.c',
+ dependencies: clutter_gtk_dep,
+ include_directories: root_inc,
+ c_args: common_cflags + [
+ '-DEXAMPLES_DATADIR="@0@"'.format(meson.current_source_dir()),
+ ])
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..4ca7996
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,189 @@
+project('clutter-gtk', 'c', version: '1.8.3',
+ license: 'LGPLv2.1+',
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'c_std=c99',
+ 'warning_level=1',
+ ],
+ meson_version: '>= 0.40.1')
+
+add_project_arguments([ '-D_XOPEN_SOURCE=500' ], language: 'c')
+
+cc = meson.get_compiler('c')
+host_system = host_machine.system()
+
+version = meson.project_version().split('.')
+gtk_clutter_major_version = version[0].to_int()
+gtk_clutter_minor_version = version[1].to_int()
+gtk_clutter_micro_version = version[2].to_int()
+
+gtk_clutter_api_version = '@0@.0'.format(gtk_clutter_major_version)
+
+if gtk_clutter_minor_version.is_odd()
+ gtk_clutter_interface_age = 0
+else
+ gtk_clutter_interface_age = gtk_clutter_micro_version
+endif
+
+gtk_clutter_api_name = '@0@-@1@'.format(meson.project_name(), gtk_clutter_api_version)
+gtk_clutter_api_path = join_paths(meson.project_name(), gtk_clutter_api_name)
+
+gtk_clutter_prefix = get_option('prefix')
+gtk_clutter_libdir = join_paths(gtk_clutter_prefix, get_option('libdir'))
+gtk_clutter_includedir = join_paths(gtk_clutter_prefix, get_option('includedir'))
+gtk_clutter_datadir = join_paths(gtk_clutter_prefix, get_option('datadir'))
+
+# maintaining compatibility with the previous libtool versioning
+# current = minor * 100 + micro - interface
+# revision = interface
+soversion = 0
+current = 100 * gtk_clutter_minor_version + gtk_clutter_micro_version - gtk_clutter_interface_age
+revision = gtk_clutter_interface_age
+libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
+
+config_h = configuration_data()
+config_h.set_quoted('GETTEXT_PACKAGE', 'cluttergtk-@0@'.format(gtk_clutter_api_version))
+
+# Compiler flags
+common_cflags = []
+common_ldflags = []
+
+if cc.get_id() == 'msvc'
+ # Make MSVC more pedantic, this is a recommended pragma list
+ # from _Win32_Programming_ by Rector and Newcomer. Taken from
+ # glib's msvc_recommended_pragmas.h--please see that file for
+ # the meaning of the warning codes used here
+ test_cflags = [
+ '-we4002',
+ '-we4003',
+ '-w14010',
+ '-we4013',
+ '-w14016',
+ '-we4020',
+ '-we4021',
+ '-we4027',
+ '-we4029',
+ '-we4033',
+ '-we4035',
+ '-we4045',
+ '-we4047',
+ '-we4049',
+ '-we4053',
+ '-we4071',
+ '-we4150',
+ '-we4819'
+ ]
+elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
+ test_cflags = [
+ '-ffast-math',
+ '-fstrict-aliasing',
+ '-Wpointer-arith',
+ '-Wmissing-declarations',
+ '-Wformat=2',
+ '-Wstrict-prototypes',
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+ '-Wold-style-definition',
+ '-Wunused',
+ '-Wuninitialized',
+ '-Wshadow',
+ '-Wmissing-noreturn',
+ '-Wmissing-format-attribute',
+ '-Wredundant-decls',
+ '-Wlogical-op',
+ '-Wcast-align',
+ '-Wno-unused-local-typedefs',
+ '-Werror=implicit',
+ '-Werror=init-self',
+ '-Werror=main',
+ '-Werror=missing-braces',
+ '-Werror=return-type',
+ '-Werror=array-bounds',
+ '-Werror=write-strings',
+ ]
+else
+ test_cflags = []
+endif
+
+# Symbol visibility
+if get_option('default_library') != 'static'
+ if host_system == 'windows'
+ config_h.set('DLL_EXPORT', true)
+ config_h.set('CLUTTER_GTK_EXTERN', '__declspec(dllexport) extern')
+ if cc.get_id() != 'msvc'
+ test_cflags += ['-fvisibility=hidden']
+ endif
+ else
+ config_h.set('CLUTTER_GTK_EXTERN', '__attribute__((visibility("default"))) extern')
+ test_cflags += ['-fvisibility=hidden']
+ endif
+endif
+
+foreach cflag: test_cflags
+ if cc.has_argument(cflag)
+ common_cflags += cflag
+ endif
+endforeach
+
+if host_system == 'linux'
+ foreach ldflag: [ '-Wl,-Bsymbolic-functions', '-Wl,-z,relro', '-Wl,-z,now' ]
+ if cc.has_argument(ldflag)
+ common_ldflags += ldflag
+ endif
+ endforeach
+endif
+
+if host_system == 'darwin'
+ common_ldflags += [ '-compatibility_version=1', '-current_version=1.0', ]
+endif
+
+gtk_clutter_debug_cflags = []
+if get_option('buildtype').startswith('debug')
+ gtk_clutter_debug_cflags += '-DCLUTTER_GTK_ENABLE_DEBUG'
+elif get_option('buildtype') == 'release'
+ gtk_clutter_debug_cflags += '-DG_DISABLE_CAST_CHECKS'
+endif
+
+if gtk_clutter_minor_version.is_even()
+ gtk_clutter_debug_cflags += [
+ '-DGLIB_DISABLE_DEPRECATION_WARNINGS',
+ '-DCLUTTER_DISABLE_DEPRECATION_WARNINGS',
+ '-DGDK_DISABLE_DEPRECATION_WARNINGS',
+ ]
+endif
+
+# Dependencies
+clutter_req_version = '>= 1.23.7'
+gtk_req_version = '>= 3.21.0'
+
+mathlib_dep = cc.find_library('m', required: false)
+clutter_dep = dependency('clutter-1.0', version: clutter_req_version)
+gtk_dep = dependency('gtk+-3.0', version: gtk_req_version)
+
+configure_file(output: 'config.h', configuration: config_h)
+
+pkgconf = configuration_data()
+pkgconf.set('prefix', gtk_clutter_prefix)
+pkgconf.set('exec_prefix', gtk_clutter_prefix)
+pkgconf.set('libdir', gtk_clutter_libdir)
+pkgconf.set('includedir', gtk_clutter_includedir)
+pkgconf.set('CLUTTER_GTK_API_VERSION', gtk_clutter_api_version)
+pkgconf.set('VERSION', meson.project_version())
+configure_file(input: 'clutter-gtk.pc.in',
+ output: 'clutter-gtk-@0@.pc'.format(gtk_clutter_api_version),
+ configuration: pkgconf,
+ install: true,
+ install_dir: join_paths(gtk_clutter_libdir, 'pkgconfig'))
+
+root_inc = include_directories('.')
+
+gnome = import('gnome')
+
+subdir('clutter-gtk')
+subdir('po')
+
+subdir('examples')
+
+if get_option('enable_docs')
+ subdir('doc')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..aaf59f1
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,4 @@
+option('enable_docs',
+ type: 'boolean',
+ value: false,
+ description: 'Enable generating the API reference (depends on GTK-Doc)')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..56eb9fd
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,3 @@
+i18n = import('i18n')
+
+i18n.gettext('cluttergtk-1.0', preset: 'glib')