summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2017-04-26 17:04:20 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2017-05-03 15:10:57 +0100
commit17518ef89bdc6af016c2f0811e5ba0f9c7cfcdca (patch)
tree6e14aee0181d2e6f4831abc2b859252511a1c22b /meson.build
parent1afd41558340053b7649aa01a1eb1fc5937a79b2 (diff)
downloadgtk+-17518ef89bdc6af016c2f0811e5ba0f9c7cfcdca.tar.gz
build: Improve consistency of the "coding" style
We're mixing a lot of styles in the Meson build files. This is an attempt at making everything slightly more consistent in terms of whitespace and indentation.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build114
1 files changed, 55 insertions, 59 deletions
diff --git a/meson.build b/meson.build
index e1d29309f1..153f1353ab 100644
--- a/meson.build
+++ b/meson.build
@@ -56,7 +56,7 @@ gtk_major_version = gtk_version.split('.')[0].to_int()
gtk_minor_version = gtk_version.split('.')[1].to_int()
gtk_micro_version = gtk_version.split('.')[2].to_int()
gtk_interface_age = 0
-add_project_arguments('-DGTK_VERSION="' + meson.project_version() + '"', language: 'c')
+add_project_arguments('-DGTK_VERSION="@0@"'.format(meson.project_version()), language: 'c')
add_project_arguments('-D_GNU_SOURCE', language : 'c')
@@ -77,8 +77,8 @@ x11_enabled = get_option('enable-x11-backend')
wayland_enabled = get_option('enable-wayland-backend')
broadway_enabled = get_option('enable-broadway-backend')
mir_enabled = get_option('enable-mir-backend')
-quartz_enabled = false # FIXME
-win32_enabled = false # FIXME
+quartz_enabled = get_option('enable-quartz-backend')
+win32_enabled = get_option('enable-win32-backend')
os_unix = false
os_linux = false
@@ -324,13 +324,16 @@ backend_immodules = []
pc_gdk_extra_libs = []
cairo_backends = []
-foreach backend : [['cairo-xlib', x11_enabled],
- ['cairo-win32', win32_enabled],
- ['cairo-quartz', quartz_enabled],
- ['cairo', broadway_enabled or wayland_enabled or mir_enabled]]
- if backend[1]
- dependency(backend[0], version: cairo_req)
- cairo_backends += [backend[0]]
+foreach backend: [ ['cairo-xlib', cairo_req, x11_enabled],
+ ['cairo-win32', cairo_req, win32_enabled],
+ ['cairo-quartz', cairo_req, quartz_enabled],
+ ['cairo', cairo_req, broadway_enabled or wayland_enabled or mir_enabled], ]
+ backend_enabled = backend.get(2)
+ cairo_backend_req = backend.get(1)
+ cairo_backend = backend.get(0)
+ if backend_enabled
+ dependency(cairo_backend, version: cairo_backend_req)
+ cairo_backends += [ cairo_backend ]
endif
endforeach
@@ -391,28 +394,31 @@ if x11_enabled
cdata.set('HAVE_XCOMPOSITE', xcomposite_dep.found())
cdata.set('HAVE_XFIXES', xfixes_dep.found())
- if cc.has_function('XkbQueryExtension', dependencies : x11_dep,
+ if cc.has_function('XkbQueryExtension', dependencies: x11_dep,
prefix : '#include <X11/XKBlib.h>')
cdata.set('HAVE_XKB', 1)
endif
- if cc.has_function('XSyncQueryExtension', dependencies : xext_dep,
- prefix : '''#include <X11/Xlib.h>
- #include <X11/extensions/sync.h>''')
+ if cc.has_function('XSyncQueryExtension', dependencies: xext_dep,
+ prefix: '''#include <X11/Xlib.h>
+ #include <X11/extensions/sync.h>''')
cdata.set('HAVE_XSYNC', 1)
endif
- if cc.has_function('XGetEventData', dependencies : x11_dep)
+ if cc.has_function('XGetEventData', dependencies: x11_dep)
cdata.set('HAVE_XGENERICEVENTS', 1)
endif
- if xi_dep.found() and cc.has_header('X11/extensions/XInput2.h', dependencies : xi_dep)
+ if xi_dep.found() and cc.has_header('X11/extensions/XInput2.h', dependencies: xi_dep)
cdata.set('XINPUT_2', 1)
# Note that we also check that the XIScrollClassInfo struct is defined,
# because at least Ubuntu Oneiric seems to have XIAllowTouchEvents(),
# but not the XIScrollClassInfo struct
- prefix = '#include<X11/Xlib.h>\n#include<X11/extensions/XInput2.h>'
- if cc.has_function('XIAllowTouchEvents', dependencies : xi_dep) and cc.has_member('XIScrollClassInfo', 'number', prefix: prefix, dependencies : xi_dep)
+ has_allow_touch_evens = cc.has_function('XIAllowTouchEvents', dependencies: xi_dep)
+ has_scroll_class_info = cc.has_member('XIScrollClassInfo', 'number', dependencies: xi_dep,
+ prefix: '''#include <X11/Xlib.h>
+ #include <X11/extensions/XInput2.h>''')
+ if has_allow_touch_evens and has_scroll_class_info
cdata.set('XINPUT_2_2', 1)
endif
endif
@@ -420,12 +426,10 @@ if x11_enabled
enable_xinerama = get_option('enable-xinerama')
if enable_xinerama != 'no'
want_xinerama = enable_xinerama == 'yes'
- xinerama_dep = dependency('xinerama', required : want_xinerama)
- if xinerama_dep.found() and cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies : xinerama_dep)
+ xinerama_dep = dependency('xinerama', required: want_xinerama)
+ if xinerama_dep.found() and cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies: xinerama_dep)
cdata.set('HAVE_XFREE_XINERAMA', 1)
x11_pkgs += ['xinerama']
- elif want_xinerama
- error('No function XineramaQueryExtension in xinerama dependency which was explicitly requested.')
endif
else
xinerama_dep = []
@@ -437,8 +441,8 @@ endif
mir_pkgs = []
if mir_enabled
- mirclient_dep = dependency('mirclient', version : mirclient_req)
- mircookie_dep = dependency('mircookie', version : mircookie_req)
+ mirclient_dep = dependency('mirclient', version: mirclient_req)
+ mircookie_dep = dependency('mircookie', version: mircookie_req)
libcontent_hub_glib_dep = dependency('libcontenthub-glib')
mir_pkgs = [
@@ -478,8 +482,8 @@ have_vulkan = false
vulkan_lib = []
enable_vulkan = get_option('enable-vulkan')
if enable_vulkan != 'no'
- vulkan_lib = cc.find_library('vulkan', required : false)
- if vulkan_lib.found() and cc.has_function('vkCreateInstance', dependencies : vulkan_lib) and cc.has_header('vulkan/vulkan.h')
+ vulkan_lib = cc.find_library('vulkan', required: false)
+ if vulkan_lib.found() and cc.has_function('vkCreateInstance', dependencies: vulkan_lib) and cc.has_header('vulkan/vulkan.h')
have_vulkan = true
pc_gdk_extra_libs += ['-lvulkan']
elif enable_vulkan == 'yes'
@@ -500,13 +504,11 @@ subdir('testsuite')
subdir('examples')
# config.h
-
configure_file(input: 'config.h.meson',
output: 'config.h',
configuration: cdata)
# pkg-config files - bit of a mess all of this
-
pkgconf = configuration_data()
pkgconf.set('prefix', get_option('prefix'))
@@ -520,29 +522,23 @@ pkgconf.set('host', '@0@-@1@'.format(host_machine.cpu_family(), host_machine.sys
# Requires
pango_pkgname = win32_enabled ? 'pangowin32' : 'pango'
-pkgconf.set('GDK_PACKAGES', ' '.join([
- pango_pkgname, pango_req,
- 'pangocairo', pango_req,
- 'gdk-pixbuf-2.0', gdk_pixbuf_req,
- 'cairo', cairo_req,
- 'cairo-gobject', cairo_req]))
-pkgconf.set('GSK_PACKAGES', ' '.join([
- #'gdk-pixbuf-2.0', gdk_pixbuf_req,
- #'cairo', cairo_req,
- #'cairo-gobject', cairo_req,
- 'graphene-gobject-1.0', graphene_req]))
-pkgconf.set('GTK_PACKAGES', ' '.join([
- 'atk', atk_req,
- #'cairo', cairo_req,
- #'cairo-gobject', cairo_req,
- #'gdk-pixbuf-2.0', gdk_pixbuf_req,
- 'gio-2.0', glib_req]))
+pkgconf.set('GDK_PACKAGES',
+ ' '.join([ pango_pkgname, pango_req,
+ 'pangocairo', pango_req,
+ 'gdk-pixbuf-2.0', gdk_pixbuf_req,
+ 'cairo', cairo_req,
+ 'cairo-gobject', cairo_req ]))
+pkgconf.set('GSK_PACKAGES',
+ ' '.join([ 'graphene-gobject-1.0', graphene_req ]))
+pkgconf.set('GTK_PACKAGES',
+ ' '.join([ 'atk', atk_req,
+ 'gio-2.0', glib_req ]))
# Requires.private
gio_pkgname = os_unix ? 'gio-unix-2.0' : 'gio-2.0'
-pkgconf.set('GDK_PRIVATE_PACKAGES', ' '.join([
- gio_pkgname, glib_req,
- 'epoxy', epoxy_req] + x11_pkgs + wayland_pkgs + mir_pkgs + cairo_backends))
+pkgconf.set('GDK_PRIVATE_PACKAGES',
+ ' '.join([ gio_pkgname, glib_req,
+ 'epoxy', epoxy_req ] + x11_pkgs + wayland_pkgs + mir_pkgs + cairo_backends))
pkgconf.set('GSK_PRIVATE_PACKAGES', '') # all already in GDK_PRIVATE_PACKAGES
pangoft2_pkgs = (wayland_enabled or x11_enabled) ? ['pangoft2'] : []
pkgconf.set('GTK_PRIVATE_PACKAGES', ' '.join(atk_pkgs + pangoft2_pkgs))
@@ -557,10 +553,10 @@ pkgconf.set('GTK_EXTRA_CFLAGS', '')
pkg_install_dir = join_paths(get_option('libdir'), 'pkgconfig')
-pkgs = ['gtk+-4.0.pc']
+pkgs = [ 'gtk+-4.0.pc' ]
pkg_targets = ''
-foreach backend : ['broadway', 'mir', 'quartz', 'wayland', 'win32', 'x11']
+foreach backend: [ 'broadway', 'mir', 'quartz', 'wayland', 'win32', 'x11', ]
if get_variable('@0@_enabled'.format(backend))
pkgs += ['gtk+-@0@-4.0.pc'.format(backend)]
pkg_targets += ' ' + backend
@@ -568,18 +564,18 @@ foreach backend : ['broadway', 'mir', 'quartz', 'wayland', 'win32', 'x11']
endforeach
pkgconf.set('GDK_BACKENDS', pkg_targets.strip())
-foreach pkg : pkgs
- configure_file(input : 'gtk+-4.0.pc.in',
- output : pkg,
- configuration : pkgconf,
- install_dir : pkg_install_dir)
+foreach pkg: pkgs
+ configure_file(input: 'gtk+-4.0.pc.in',
+ output: pkg,
+ configuration: pkgconf,
+ install_dir: pkg_install_dir)
endforeach
if host_machine.system() != 'windows'
- configure_file(input : 'gtk+-unix-print-4.0.pc.in',
- output : 'gtk+-unix-print-4.0.pc',
- configuration : pkgconf,
- install_dir : pkg_install_dir)
+ configure_file(input: 'gtk+-unix-print-4.0.pc.in',
+ output: 'gtk+-unix-print-4.0.pc',
+ configuration: pkgconf,
+ install_dir: pkg_install_dir)
endif
subdir('po')