2019-02-06 09:42:50 +00:00
|
|
|
project('gtk', 'c',
|
2021-08-22 17:06:29 +00:00
|
|
|
version: '4.5.0',
|
2016-08-15 08:03:57 +00:00
|
|
|
default_options: [
|
|
|
|
'buildtype=debugoptimized',
|
2017-04-18 13:29:48 +00:00
|
|
|
'warning_level=1',
|
2017-09-07 18:23:41 +00:00
|
|
|
# We only need c99, but glib needs GNU-specific features
|
|
|
|
# https://github.com/mesonbuild/meson/issues/2289
|
|
|
|
'c_std=gnu99',
|
2016-08-15 08:03:57 +00:00
|
|
|
],
|
2021-06-25 15:11:12 +00:00
|
|
|
meson_version : '>= 0.55',
|
2021-07-16 08:46:53 +00:00
|
|
|
license: 'LGPL-2.1-or-later')
|
2016-08-15 08:03:57 +00:00
|
|
|
|
2020-11-23 12:55:05 +00:00
|
|
|
glib_req = '>= 2.66.0'
|
2021-09-04 13:41:20 +00:00
|
|
|
pango_req = '>= 1.49.1' # keep this in sync with .gitlab-ci/test-msys.sh
|
2019-02-04 23:07:14 +00:00
|
|
|
fribidi_req = '>= 0.19.7'
|
2017-08-10 20:30:36 +00:00
|
|
|
cairo_req = '>= 1.14.0'
|
|
|
|
gdk_pixbuf_req = '>= 2.30.0'
|
|
|
|
introspection_req = '>= 1.39.0'
|
2020-12-02 16:22:41 +00:00
|
|
|
wayland_proto_req = '>= 1.21'
|
2021-08-11 09:01:55 +00:00
|
|
|
wayland_req = '>= 1.16.91'
|
2019-03-22 12:33:13 +00:00
|
|
|
graphene_req = '>= 1.9.1'
|
2017-02-16 00:03:05 +00:00
|
|
|
epoxy_req = '>= 1.4'
|
2020-06-09 14:46:32 +00:00
|
|
|
cloudproviders_req = '>= 0.3.1'
|
2017-08-10 20:30:36 +00:00
|
|
|
xkbcommon_req = '>= 0.2.0'
|
2020-10-08 23:23:23 +00:00
|
|
|
sysprof_req = '>= 3.38.0'
|
2017-03-22 00:15:31 +00:00
|
|
|
|
2021-04-01 19:29:41 +00:00
|
|
|
fs = import('fs')
|
2016-08-21 14:00:37 +00:00
|
|
|
gnome = import('gnome')
|
2020-12-27 05:27:59 +00:00
|
|
|
pkg_config = import('pkgconfig')
|
2016-08-21 14:00:37 +00:00
|
|
|
|
2017-03-12 16:28:11 +00:00
|
|
|
add_project_arguments('-DG_LOG_USE_STRUCTURED=1', language: 'c')
|
2020-11-23 12:55:05 +00:00
|
|
|
add_project_arguments('-DGLIB_DISABLE_DEPRECATION_WARNINGS', language: 'c')
|
2016-08-21 14:00:37 +00:00
|
|
|
|
2017-03-22 00:15:31 +00:00
|
|
|
# Making releases:
|
2020-11-23 17:58:43 +00:00
|
|
|
# 1. new development cycle:
|
|
|
|
# a. gtk_minor_version += 1
|
|
|
|
# b. gtk_micro_version = 0
|
|
|
|
# 2. new stable cycle:
|
|
|
|
# a. gtk_minor_version += 1
|
|
|
|
# b. gtk_micro_version = 0
|
|
|
|
# 3. every new release:
|
|
|
|
# a. gtk_micro_version += 1
|
2017-03-22 00:15:31 +00:00
|
|
|
gtk_version = meson.project_version()
|
|
|
|
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()
|
2020-11-23 17:58:43 +00:00
|
|
|
|
|
|
|
# Interface age gets reset during development cycles, when
|
|
|
|
# we add new API; new micro versions of the same minor
|
|
|
|
# stable cycle will have the same interface age
|
|
|
|
#
|
|
|
|
# If new API is added during a stable cycle, reset to 0
|
|
|
|
gtk_interface_age = gtk_minor_version.is_odd() ? 0 : gtk_micro_version
|
|
|
|
|
2017-04-26 16:04:20 +00:00
|
|
|
add_project_arguments('-DGTK_VERSION="@0@"'.format(meson.project_version()), language: 'c')
|
2016-09-24 06:15:28 +00:00
|
|
|
|
2017-05-10 11:03:01 +00:00
|
|
|
add_project_arguments('-D_GNU_SOURCE', language: 'c')
|
|
|
|
|
2020-04-03 12:02:51 +00:00
|
|
|
# Use debug/optimization flags to determine whether to enable debug or disable
|
|
|
|
# cast checks
|
2017-05-10 11:03:01 +00:00
|
|
|
gtk_debug_cflags = []
|
2020-04-03 12:02:51 +00:00
|
|
|
debug = get_option('debug')
|
|
|
|
optimization = get_option('optimization')
|
|
|
|
if debug
|
2017-05-10 11:03:01 +00:00
|
|
|
gtk_debug_cflags += '-DG_ENABLE_DEBUG'
|
2020-04-03 12:02:51 +00:00
|
|
|
if optimization in ['0', 'g']
|
2017-05-10 11:03:01 +00:00
|
|
|
gtk_debug_cflags += '-DG_ENABLE_CONSISTENCY_CHECKS'
|
|
|
|
endif
|
2020-04-03 12:02:51 +00:00
|
|
|
elif optimization in ['2', '3', 's']
|
2021-04-12 10:29:24 +00:00
|
|
|
gtk_debug_cflags += ['-DG_DISABLE_CAST_CHECKS', '-DG_DISABLE_ASSERT']
|
2017-05-10 11:03:01 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
add_project_arguments(gtk_debug_cflags, language: 'c')
|
2017-03-11 22:06:07 +00:00
|
|
|
|
2016-09-24 06:15:28 +00:00
|
|
|
# Define a string for the earliest version that this release has
|
|
|
|
# backwards binary compatibility with for all interfaces a module
|
|
|
|
# might. Unless we add module-only API with lower stability
|
|
|
|
# guarantees, this should be unchanged until we break binary compat
|
|
|
|
# for GTK+.
|
2017-03-22 00:15:31 +00:00
|
|
|
gtk_binary_version = '4.0.0'
|
2016-08-15 08:03:57 +00:00
|
|
|
|
2016-09-24 15:35:10 +00:00
|
|
|
gtk_binary_age = 100 * gtk_minor_version + gtk_micro_version
|
2017-03-22 00:15:31 +00:00
|
|
|
|
2020-11-23 18:02:12 +00:00
|
|
|
gtk_soversion = '1'
|
|
|
|
gtk_library_version = '1.@0@.@1@'.format(gtk_binary_age - gtk_interface_age, gtk_interface_age)
|
2017-04-18 13:51:25 +00:00
|
|
|
|
2017-03-22 00:15:31 +00:00
|
|
|
gtk_api_version = '4.0'
|
2016-08-15 08:03:57 +00:00
|
|
|
|
2021-02-05 21:56:14 +00:00
|
|
|
module_suffix = []
|
|
|
|
# GModule requires file extension to be .so, not .dylib on Mac.
|
|
|
|
# https://gitlab.gnome.org/GNOME/glib/issues/520
|
|
|
|
if ['darwin', 'ios'].contains(host_machine.system())
|
|
|
|
module_suffix = 'so'
|
|
|
|
endif
|
|
|
|
|
2020-04-17 04:53:23 +00:00
|
|
|
x11_enabled = get_option('x11-backend')
|
|
|
|
wayland_enabled = get_option('wayland-backend')
|
|
|
|
broadway_enabled = get_option('broadway-backend')
|
2020-04-23 23:36:46 +00:00
|
|
|
macos_enabled = get_option('macos-backend')
|
2020-04-17 04:53:23 +00:00
|
|
|
win32_enabled = get_option('win32-backend')
|
2016-08-21 15:16:03 +00:00
|
|
|
|
2016-09-20 14:29:14 +00:00
|
|
|
os_unix = false
|
|
|
|
os_linux = false
|
|
|
|
os_win32 = false
|
|
|
|
os_darwin = false
|
|
|
|
|
2018-02-14 14:04:04 +00:00
|
|
|
# Some windowing system backends depend on the platform we're
|
|
|
|
# building for, so we need to ensure they are disabled; in other
|
|
|
|
# cases, they are the only windowing system available, so we need
|
|
|
|
# to ensure they are enabled
|
|
|
|
if host_machine.system() == 'darwin'
|
2016-09-20 14:29:14 +00:00
|
|
|
os_darwin = true
|
2017-08-01 08:49:08 +00:00
|
|
|
elif host_machine.system() == 'windows'
|
2016-09-20 14:29:14 +00:00
|
|
|
os_win32 = true
|
2018-02-14 14:04:04 +00:00
|
|
|
elif host_machine.system() == 'linux'
|
2016-09-20 14:29:14 +00:00
|
|
|
os_linux = true
|
2018-04-22 12:47:32 +00:00
|
|
|
endif
|
|
|
|
os_unix = not os_win32
|
|
|
|
|
|
|
|
if os_darwin
|
|
|
|
wayland_enabled = false
|
|
|
|
else
|
2020-04-23 23:36:46 +00:00
|
|
|
macos_enabled = false
|
2016-09-20 14:29:14 +00:00
|
|
|
endif
|
|
|
|
|
2018-04-22 12:47:32 +00:00
|
|
|
if os_win32
|
|
|
|
wayland_enabled = false
|
|
|
|
x11_enabled = false
|
|
|
|
else
|
|
|
|
win32_enabled = false
|
|
|
|
endif
|
2016-09-20 14:29:14 +00:00
|
|
|
|
2017-04-18 13:21:05 +00:00
|
|
|
gtk_prefix = get_option('prefix')
|
2017-04-26 14:59:43 +00:00
|
|
|
gtk_includedir = join_paths(gtk_prefix, get_option('includedir'))
|
2017-04-18 13:21:05 +00:00
|
|
|
gtk_libdir = join_paths(gtk_prefix, get_option('libdir'))
|
|
|
|
gtk_datadir = join_paths(gtk_prefix, get_option('datadir'))
|
|
|
|
gtk_localedir = join_paths(gtk_prefix, get_option('localedir'))
|
2017-04-18 13:22:23 +00:00
|
|
|
gtk_sysconfdir = join_paths(gtk_prefix, get_option('sysconfdir'))
|
2020-12-20 16:33:25 +00:00
|
|
|
gtk_bindir = join_paths(gtk_prefix, get_option('bindir'))
|
2017-04-26 14:59:43 +00:00
|
|
|
gtk_applicationsdir = join_paths(gtk_datadir, 'applications')
|
|
|
|
gtk_schemasdir = join_paths(gtk_datadir, 'glib-2.0/schemas')
|
2018-03-20 23:40:30 +00:00
|
|
|
gtk_appdatadir = join_paths(gtk_datadir, 'metainfo')
|
2016-08-22 19:26:38 +00:00
|
|
|
|
2016-08-15 08:03:57 +00:00
|
|
|
cc = meson.get_compiler('c')
|
2017-04-18 13:21:05 +00:00
|
|
|
|
2016-08-15 08:03:57 +00:00
|
|
|
cdata = configuration_data()
|
2017-04-18 13:21:05 +00:00
|
|
|
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
|
|
|
|
cdata.set_quoted('GTK_LOCALEDIR', gtk_localedir)
|
|
|
|
cdata.set_quoted('GTK_DATADIR', gtk_datadir)
|
|
|
|
cdata.set_quoted('GTK_LIBDIR', gtk_libdir)
|
2017-04-18 13:22:23 +00:00
|
|
|
cdata.set_quoted('GTK_SYSCONFDIR', gtk_sysconfdir)
|
2017-04-18 13:21:05 +00:00
|
|
|
cdata.set_quoted('GETTEXT_PACKAGE', 'gtk40')
|
2017-03-23 19:15:44 +00:00
|
|
|
|
2016-08-15 08:03:57 +00:00
|
|
|
check_headers = [
|
2017-03-23 19:15:44 +00:00
|
|
|
'crt/externs.h',
|
2018-05-01 14:28:57 +00:00
|
|
|
'dev/evdev/input.h',
|
2017-03-23 19:15:44 +00:00
|
|
|
'dlfcn.h',
|
|
|
|
'ftw.h',
|
|
|
|
'inttypes.h',
|
2018-05-01 14:28:57 +00:00
|
|
|
'linux/input.h',
|
2017-03-23 19:15:44 +00:00
|
|
|
'linux/memfd.h',
|
|
|
|
'locale.h',
|
|
|
|
'memory.h',
|
|
|
|
'stdint.h',
|
|
|
|
'stdlib.h',
|
|
|
|
'strings.h',
|
|
|
|
'string.h',
|
|
|
|
'sys/mman.h',
|
|
|
|
'sys/param.h',
|
|
|
|
'sys/stat.h',
|
|
|
|
'sys/sysinfo.h',
|
|
|
|
'sys/systeminfo.h',
|
|
|
|
'sys/time.h',
|
|
|
|
'sys/types.h',
|
|
|
|
'unistd.h',
|
2021-05-04 11:49:45 +00:00
|
|
|
'gio/gdesktopappinfo.h'
|
2016-08-15 08:03:57 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
foreach h : check_headers
|
2017-03-23 19:15:44 +00:00
|
|
|
if cc.has_header(h)
|
|
|
|
cdata.set('HAVE_' + h.underscorify().to_upper(), 1)
|
2016-08-15 08:03:57 +00:00
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2017-03-11 22:30:35 +00:00
|
|
|
# Maths functions might be implemented in libm
|
2017-04-18 13:25:44 +00:00
|
|
|
libm = cc.find_library('m', required: false)
|
2017-03-11 22:30:35 +00:00
|
|
|
|
2017-03-23 19:36:59 +00:00
|
|
|
check_functions = [
|
|
|
|
'dcgettext',
|
|
|
|
'getpagesize',
|
|
|
|
'getresuid',
|
|
|
|
'lstat',
|
2021-04-27 16:37:16 +00:00
|
|
|
'memfd_create',
|
2017-03-23 19:36:59 +00:00
|
|
|
'mmap',
|
|
|
|
'posix_fallocate',
|
|
|
|
'_lock_file',
|
|
|
|
'flockfile',
|
|
|
|
'mkstemp',
|
2021-02-12 07:36:21 +00:00
|
|
|
'mallinfo2',
|
2017-03-23 19:36:59 +00:00
|
|
|
'sincos',
|
2020-01-08 09:05:44 +00:00
|
|
|
'sincosf',
|
2016-08-15 08:03:57 +00:00
|
|
|
]
|
|
|
|
|
2017-03-23 19:36:59 +00:00
|
|
|
foreach func : check_functions
|
2017-04-18 13:25:44 +00:00
|
|
|
if cc.has_function(func, dependencies: libm)
|
2017-03-23 19:36:59 +00:00
|
|
|
cdata.set('HAVE_' + func.underscorify().to_upper(), 1)
|
2016-08-15 08:03:57 +00:00
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2021-09-10 16:44:43 +00:00
|
|
|
# We use links() because sigsetjmp() is often a macro hidden behind other macros
|
|
|
|
cdata.set('HAVE_SIGSETJMP',
|
|
|
|
cc.links('''#define _POSIX_SOURCE
|
|
|
|
#include <setjmp.h>
|
|
|
|
int main (void) {
|
|
|
|
sigjmp_buf env;
|
|
|
|
sigsetjmp (env, 0);
|
|
|
|
return 0;
|
|
|
|
}''', name: 'sigsetjmp'),
|
|
|
|
)
|
|
|
|
|
2020-07-27 19:49:57 +00:00
|
|
|
# Check for __uint128_t (gcc) by checking for 128-bit division
|
|
|
|
uint128_t_src = '''int main() {
|
|
|
|
static __uint128_t v1 = 100;
|
|
|
|
static __uint128_t v2 = 10;
|
|
|
|
static __uint128_t u;
|
|
|
|
u = v1 / v2;
|
|
|
|
}'''
|
|
|
|
if cc.compiles(uint128_t_src, name : '__uint128_t available')
|
|
|
|
cdata.set('HAVE_UINT128_T', 1)
|
|
|
|
endif
|
|
|
|
|
2021-04-17 23:28:36 +00:00
|
|
|
# Check for mlock and madvise
|
2020-09-08 16:50:39 +00:00
|
|
|
if cc.has_function('mlock', prefix: '#include <sys/mman.h>')
|
|
|
|
cdata.set('HAVE_MLOCK', 1)
|
|
|
|
endif
|
2021-04-17 23:28:36 +00:00
|
|
|
if cc.has_function('madvise', prefix: '#include <sys/mman.h>')
|
|
|
|
cdata.set('HAVE_MADVISE', 1)
|
|
|
|
endif
|
2020-09-08 16:50:39 +00:00
|
|
|
|
2016-09-24 15:35:10 +00:00
|
|
|
# Disable deprecation checks for all libraries we depend on on stable branches.
|
|
|
|
# This is so newer versions of those libraries don't cause more warnings with
|
|
|
|
# a stable GTK version.
|
2020-06-18 16:36:44 +00:00
|
|
|
#
|
|
|
|
# We don't ever want to turn off deprecation warnings for development cycles,
|
|
|
|
# however, because that's where we get rid of deprecated API we use.
|
2017-04-18 13:28:11 +00:00
|
|
|
if gtk_minor_version.is_even()
|
2016-09-24 15:35:10 +00:00
|
|
|
cdata.set('GLIB_DISABLE_DEPRECATION_WARNINGS', 1)
|
|
|
|
endif
|
|
|
|
|
2017-04-18 13:28:11 +00:00
|
|
|
# Compiler flags
|
|
|
|
if cc.get_id() == 'msvc'
|
|
|
|
# Compiler options taken from msvc_recommended_pragmas.h
|
|
|
|
# in GLib, based on _Win32_Programming_ by Rector and Newcomer
|
2020-01-15 07:27:59 +00:00
|
|
|
test_cflags = [
|
|
|
|
'-FImsvc_recommended_pragmas.h',
|
|
|
|
'-D_USE_MATH_DEFINES',
|
|
|
|
'-utf-8',
|
|
|
|
]
|
|
|
|
add_project_arguments(cc.get_supported_arguments(test_cflags), language: 'c')
|
|
|
|
|
2020-03-31 04:00:26 +00:00
|
|
|
add_languages('cpp')
|
2020-01-15 07:27:59 +00:00
|
|
|
cxx = meson.get_compiler('cpp')
|
|
|
|
if cxx.get_id() == 'msvc'
|
|
|
|
add_project_arguments(cxx.get_supported_arguments(test_cflags), language: 'cpp')
|
|
|
|
endif
|
2017-04-18 13:28:11 +00:00
|
|
|
elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
|
|
|
test_cflags = [
|
|
|
|
'-fno-strict-aliasing',
|
2020-07-18 00:59:09 +00:00
|
|
|
'-Wno-c++11-extensions',
|
|
|
|
'-Wno-missing-include-dirs',
|
2020-03-12 07:32:34 +00:00
|
|
|
'-Wno-typedef-redefinition',
|
2020-03-05 02:58:29 +00:00
|
|
|
'-Wduplicated-branches',
|
|
|
|
'-Wduplicated-cond',
|
2017-04-18 13:28:11 +00:00
|
|
|
'-Wformat=2',
|
|
|
|
'-Wformat-nonliteral',
|
|
|
|
'-Wformat-security',
|
2019-01-20 15:09:36 +00:00
|
|
|
'-Wignored-qualifiers',
|
|
|
|
'-Wimplicit-function-declaration',
|
|
|
|
'-Wlogical-op',
|
2020-03-05 02:58:29 +00:00
|
|
|
'-Wmisleading-indentation',
|
2019-01-20 15:09:36 +00:00
|
|
|
'-Wmissing-format-attribute',
|
|
|
|
'-Wmissing-include-dirs',
|
|
|
|
'-Wmissing-noreturn',
|
2017-04-18 13:28:11 +00:00
|
|
|
'-Wnested-externs',
|
|
|
|
'-Wold-style-definition',
|
2019-01-20 15:09:36 +00:00
|
|
|
'-Wpointer-arith',
|
2019-01-22 03:30:47 +00:00
|
|
|
'-Wshadow',
|
2019-01-20 15:09:36 +00:00
|
|
|
'-Wstrict-prototypes',
|
2017-10-06 19:19:42 +00:00
|
|
|
'-Wswitch-default',
|
|
|
|
'-Wswitch-enum',
|
2019-01-20 15:09:36 +00:00
|
|
|
'-Wundef',
|
2019-01-22 03:30:47 +00:00
|
|
|
'-Wuninitialized',
|
2019-01-20 15:09:36 +00:00
|
|
|
'-Wunused',
|
|
|
|
'-Werror=address',
|
|
|
|
'-Werror=array-bounds',
|
|
|
|
'-Werror=empty-body',
|
2017-04-18 13:28:11 +00:00
|
|
|
'-Werror=implicit',
|
2019-01-26 14:09:55 +00:00
|
|
|
'-Werror=implicit-fallthrough',
|
2017-04-18 13:28:11 +00:00
|
|
|
'-Werror=init-self',
|
2019-01-20 15:09:36 +00:00
|
|
|
'-Werror=int-to-pointer-cast',
|
2017-04-18 13:28:11 +00:00
|
|
|
'-Werror=main',
|
|
|
|
'-Werror=missing-braces',
|
2019-01-22 03:30:47 +00:00
|
|
|
'-Werror=missing-declarations',
|
|
|
|
'-Werror=missing-prototypes',
|
2019-01-20 15:09:36 +00:00
|
|
|
'-Werror=nonnull',
|
|
|
|
'-Werror=pointer-to-int-cast',
|
|
|
|
'-Werror=redundant-decls',
|
2017-04-18 13:28:11 +00:00
|
|
|
'-Werror=return-type',
|
2019-01-20 15:09:36 +00:00
|
|
|
'-Werror=sequence-point',
|
2017-04-18 13:28:11 +00:00
|
|
|
'-Werror=trigraphs',
|
2019-01-26 14:09:55 +00:00
|
|
|
'-Werror=vla',
|
2017-04-18 13:28:11 +00:00
|
|
|
'-Werror=write-strings',
|
|
|
|
]
|
2020-10-10 06:43:52 +00:00
|
|
|
|
|
|
|
if cc.get_id() == 'gcc'
|
|
|
|
test_cflags += ['-Wcast-align'] # This warns too much on clang
|
|
|
|
endif
|
2021-04-13 02:11:05 +00:00
|
|
|
|
|
|
|
if not gtk_debug_cflags.contains('-DG_DISABLE_ASSERT')
|
|
|
|
test_cflags += ['-Wnull-dereference'] # Too noisy when assertions are disabled
|
|
|
|
endif
|
2017-04-18 13:28:11 +00:00
|
|
|
else
|
|
|
|
test_cflags = []
|
|
|
|
endif
|
|
|
|
|
2018-02-20 13:18:28 +00:00
|
|
|
common_cflags = cc.get_supported_arguments(test_cflags)
|
2016-08-15 08:03:57 +00:00
|
|
|
|
2017-04-18 13:28:46 +00:00
|
|
|
# Symbol visibility
|
2020-06-04 08:27:56 +00:00
|
|
|
|
|
|
|
if os_win32
|
|
|
|
visibility_define = '__declspec(dllexport) extern'
|
|
|
|
else
|
|
|
|
visibility_define = '__attribute__((visibility("default"))) extern'
|
|
|
|
endif
|
|
|
|
|
2017-04-18 13:28:46 +00:00
|
|
|
if get_option('default_library') != 'static'
|
2020-06-04 08:27:56 +00:00
|
|
|
cdata.set('_GDK_EXTERN', visibility_define)
|
2018-04-22 12:47:32 +00:00
|
|
|
if os_win32
|
2017-04-18 13:28:46 +00:00
|
|
|
cdata.set('DLL_EXPORT', true)
|
2020-06-04 08:27:56 +00:00
|
|
|
endif
|
|
|
|
if cc.get_id() != 'msvc'
|
2017-04-18 13:28:46 +00:00
|
|
|
common_cflags += ['-fvisibility=hidden']
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-12-15 11:19:39 +00:00
|
|
|
common_ldflags = cc.get_supported_link_arguments([
|
|
|
|
'-Wl,-Bsymbolic',
|
|
|
|
'-Wl,-z,relro',
|
|
|
|
'-Wl,-z,now',
|
|
|
|
])
|
2017-04-18 13:51:25 +00:00
|
|
|
|
2016-08-15 08:03:57 +00:00
|
|
|
confinc = include_directories('.')
|
|
|
|
gdkinc = include_directories('gdk')
|
2017-04-19 10:35:45 +00:00
|
|
|
gskinc = include_directories('gsk')
|
2016-08-23 06:21:54 +00:00
|
|
|
gtkinc = include_directories('gtk')
|
2017-04-19 10:35:45 +00:00
|
|
|
testinc = include_directories('tests')
|
2016-08-23 06:21:54 +00:00
|
|
|
|
2017-04-26 15:51:46 +00:00
|
|
|
# Dependencies
|
2017-09-07 18:23:41 +00:00
|
|
|
glib_dep = dependency('glib-2.0', version: glib_req,
|
|
|
|
fallback : ['glib', 'libglib_dep'])
|
|
|
|
gobject_dep = dependency('gobject-2.0', version: glib_req,
|
|
|
|
fallback : ['glib', 'libgobject_dep'])
|
2018-04-22 12:47:32 +00:00
|
|
|
if os_win32
|
2017-08-01 08:49:08 +00:00
|
|
|
giowin32_dep = dependency('gio-windows-2.0', version: glib_req, required: win32_enabled,
|
|
|
|
fallback : ['glib', 'libgio_dep'])
|
2018-04-22 12:47:32 +00:00
|
|
|
endif
|
|
|
|
if os_unix
|
2017-08-01 08:49:08 +00:00
|
|
|
giounix_dep = dependency('gio-unix-2.0', version: glib_req, required: false,
|
2017-09-07 18:23:41 +00:00
|
|
|
fallback : ['glib', 'libgio_dep'])
|
2017-08-01 08:49:08 +00:00
|
|
|
endif
|
2017-09-07 18:23:41 +00:00
|
|
|
gmodule_dep = dependency('gmodule-2.0', version: glib_req,
|
|
|
|
fallback : ['glib', 'libgmodule_dep'])
|
2020-10-16 21:26:15 +00:00
|
|
|
cairo_dep = dependency('cairo', version: cairo_req,
|
2021-01-03 16:24:26 +00:00
|
|
|
fallback : ['cairo', 'libcairo_dep'],
|
2021-01-29 16:30:19 +00:00
|
|
|
default_options: ['zlib=enabled', 'tests=disabled'])
|
2020-10-16 21:26:15 +00:00
|
|
|
cairogobj_dep = dependency('cairo-gobject', version: cairo_req,
|
|
|
|
fallback : ['cairo', 'libcairogobject_dep'])
|
2017-09-07 18:23:41 +00:00
|
|
|
pango_dep = dependency('pango', version: pango_req,
|
|
|
|
fallback : ['pango', 'libpango_dep'])
|
2019-02-04 23:07:14 +00:00
|
|
|
fribidi_dep = dependency('fribidi', version: fribidi_req,
|
|
|
|
fallback : ['fribidi', 'libfribidi_dep'])
|
2017-08-01 08:49:08 +00:00
|
|
|
|
2018-01-11 17:49:43 +00:00
|
|
|
# Require PangoFT2 if on X11 or wayland
|
|
|
|
require_pangoft2 = wayland_enabled or x11_enabled
|
2017-08-01 08:49:08 +00:00
|
|
|
|
2019-03-29 08:47:31 +00:00
|
|
|
if require_pangoft2
|
2020-05-30 15:13:55 +00:00
|
|
|
pangoft_dep = dependency('pangoft2', version: pango_req,
|
|
|
|
fallback : ['pango', 'libpangoft2_dep'])
|
2020-05-29 14:52:38 +00:00
|
|
|
else
|
|
|
|
pangoft_dep = dependency('pangoft2', required: false)
|
2019-03-29 08:47:31 +00:00
|
|
|
endif
|
|
|
|
|
2018-03-04 02:48:10 +00:00
|
|
|
if win32_enabled
|
|
|
|
# for GTK_IM_CONTEXT_IME
|
2020-12-15 11:20:19 +00:00
|
|
|
pangowin32_dep = dependency('pangowin32')
|
2018-03-04 02:48:10 +00:00
|
|
|
endif
|
|
|
|
|
2020-05-30 15:13:55 +00:00
|
|
|
pangocairo_dep = dependency('pangocairo', version: pango_req,
|
2017-09-07 18:23:41 +00:00
|
|
|
fallback : ['pango', 'libpangocairo_dep'])
|
|
|
|
pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
|
2020-12-17 20:50:16 +00:00
|
|
|
fallback : ['gdk-pixbuf', 'gdkpixbuf_dep'],
|
2021-05-05 20:40:57 +00:00
|
|
|
default_options: ['png=enabled', 'jpeg=enabled', 'builtin_loaders=png,jpeg', 'man=false'])
|
2021-09-30 08:17:48 +00:00
|
|
|
png_dep = dependency(cc.get_argument_syntax() == 'msvc' ? 'png' : 'libpng',
|
2021-09-10 16:44:43 +00:00
|
|
|
fallback: ['libpng', 'libpng_dep'],
|
|
|
|
required: true)
|
2021-09-10 16:47:14 +00:00
|
|
|
tiff_dep = dependency('libtiff-4',
|
|
|
|
fallback: ['libtiff', 'libtiff4_dep'],
|
|
|
|
required: true)
|
2021-09-14 11:48:49 +00:00
|
|
|
jpeg_dep = dependency('libjpeg',
|
|
|
|
fallback: ['libjpeg-turbo', 'jpeg_dep'],
|
|
|
|
required: true)
|
2021-09-10 16:44:43 +00:00
|
|
|
|
2017-08-22 09:20:45 +00:00
|
|
|
epoxy_dep = dependency('epoxy', version: epoxy_req,
|
|
|
|
fallback: ['libepoxy', 'libepoxy_dep'])
|
2021-07-31 19:22:49 +00:00
|
|
|
harfbuzz_dep = dependency('harfbuzz', version: '>= 2.1.0', required: false,
|
2021-01-04 02:11:56 +00:00
|
|
|
fallback: ['harfbuzz', 'libharfbuzz_dep'],
|
|
|
|
default_options: ['coretext=enabled'])
|
2017-08-01 08:49:08 +00:00
|
|
|
xkbdep = dependency('xkbcommon', version: xkbcommon_req, required: wayland_enabled)
|
2021-02-12 21:04:15 +00:00
|
|
|
graphene_dep = dependency('graphene-gobject-1.0', version: graphene_req,
|
|
|
|
fallback: ['graphene', 'graphene_dep'])
|
2018-01-06 19:39:22 +00:00
|
|
|
iso_codes_dep = dependency('iso-codes', required: false)
|
2017-03-22 18:25:09 +00:00
|
|
|
|
2021-02-10 13:41:53 +00:00
|
|
|
gidocgen_dep = dependency('gi-docgen', version: '>= 2021.1',
|
|
|
|
fallback: ['gi-docgen', 'dummy_dep'],
|
|
|
|
required: get_option('gtk_doc'))
|
2021-07-08 02:33:16 +00:00
|
|
|
gi_dep = dependency('gobject-introspection-1.0', version: introspection_req,
|
|
|
|
required: get_option('introspection').enabled() and
|
|
|
|
get_option('build-tests'))
|
2020-09-04 13:52:37 +00:00
|
|
|
|
2017-03-22 00:15:31 +00:00
|
|
|
fontconfig_dep = [] # only used in x11 backend
|
|
|
|
|
2018-04-22 12:47:32 +00:00
|
|
|
if os_win32
|
2017-08-01 08:49:08 +00:00
|
|
|
platform_gio_dep = giowin32_dep
|
2018-04-22 12:47:32 +00:00
|
|
|
endif
|
|
|
|
if os_unix
|
2017-08-01 08:49:08 +00:00
|
|
|
platform_gio_dep = giounix_dep
|
|
|
|
endif
|
|
|
|
|
2020-08-21 23:36:17 +00:00
|
|
|
tracker3_dep = dependency('tracker-sparql-3.0', required: get_option('tracker'))
|
|
|
|
cdata.set('HAVE_TRACKER3', tracker3_dep.found())
|
|
|
|
|
|
|
|
colord_dep = dependency('colord', version: '>= 0.1.9', required: get_option('colord'))
|
|
|
|
cdata.set('HAVE_COLORD', colord_dep.found())
|
2020-05-16 22:04:56 +00:00
|
|
|
|
2018-01-06 19:39:22 +00:00
|
|
|
if iso_codes_dep.found()
|
|
|
|
cdata.set_quoted('ISO_CODES_PREFIX', iso_codes_dep.get_pkgconfig_variable('prefix'))
|
|
|
|
else
|
|
|
|
cdata.set_quoted('ISO_CODES_PREFIX', '/usr')
|
|
|
|
endif
|
|
|
|
|
2020-08-21 23:36:17 +00:00
|
|
|
|
2017-03-22 00:15:31 +00:00
|
|
|
pc_gdk_extra_libs = []
|
|
|
|
|
|
|
|
cairo_backends = []
|
2017-04-26 16:04:20 +00:00
|
|
|
foreach backend: [ ['cairo-xlib', cairo_req, x11_enabled],
|
|
|
|
['cairo-win32', cairo_req, win32_enabled],
|
2020-10-10 03:08:23 +00:00
|
|
|
['cairo-quartz', cairo_req, macos_enabled],
|
2018-02-05 06:46:01 +00:00
|
|
|
['cairo', cairo_req, broadway_enabled or wayland_enabled], ]
|
2017-04-26 16:04:20 +00:00
|
|
|
backend_enabled = backend.get(2)
|
|
|
|
cairo_backend_req = backend.get(1)
|
|
|
|
cairo_backend = backend.get(0)
|
|
|
|
if backend_enabled
|
2020-10-16 21:26:15 +00:00
|
|
|
if dependency(cairo_backend, version: cairo_backend_req).found()
|
2017-09-12 05:34:36 +00:00
|
|
|
cairo_backends += [ cairo_backend ]
|
|
|
|
endif
|
2017-03-22 00:15:31 +00:00
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2017-09-12 05:34:36 +00:00
|
|
|
cairo_pkg_found = false
|
|
|
|
cairogobj_pkg_found = false
|
|
|
|
|
|
|
|
if cairo_dep.found()
|
|
|
|
cairo_pkg_found = true
|
|
|
|
endif
|
|
|
|
if cairogobj_dep.found()
|
|
|
|
cairogobj_pkg_found = true
|
|
|
|
endif
|
|
|
|
|
2020-10-16 21:26:15 +00:00
|
|
|
cairo_csi_dep = dependency('cairo-script-interpreter', required: false)
|
|
|
|
if not cairo_csi_dep.found()
|
|
|
|
cairo_csi_dep = cc.find_library('cairo-script-interpreter', required: get_option('build-tests'))
|
2019-04-12 10:08:36 +00:00
|
|
|
endif
|
|
|
|
|
2021-10-05 02:14:57 +00:00
|
|
|
have_egl = epoxy_dep.get_variable(
|
|
|
|
pkgconfig: 'epoxy_has_egl',
|
|
|
|
internal: 'epoxy_has_egl',
|
|
|
|
default_value: '0') == '1'
|
|
|
|
|
2019-05-28 03:51:20 +00:00
|
|
|
cdata.set('HAVE_CAIRO_SCRIPT_INTERPRETER', cairo_csi_dep.found())
|
2021-10-05 02:14:57 +00:00
|
|
|
if have_egl
|
|
|
|
cdata.set('HAVE_EGL', 1)
|
|
|
|
endif
|
2018-03-28 03:32:53 +00:00
|
|
|
cdata.set('HAVE_HARFBUZZ', harfbuzz_dep.found())
|
|
|
|
cdata.set('HAVE_PANGOFT', pangoft_dep.found())
|
|
|
|
|
2017-03-22 00:15:31 +00:00
|
|
|
wayland_pkgs = []
|
2016-09-24 15:35:10 +00:00
|
|
|
if wayland_enabled
|
2017-03-22 00:15:31 +00:00
|
|
|
wlclientdep = dependency('wayland-client', version: wayland_req)
|
2020-02-16 19:09:42 +00:00
|
|
|
wlprotocolsdep = dependency('wayland-protocols', version: wayland_proto_req, required: false)
|
2016-09-24 15:35:10 +00:00
|
|
|
wlegldep = dependency('wayland-egl')
|
2017-03-22 00:15:31 +00:00
|
|
|
|
2020-02-16 19:09:42 +00:00
|
|
|
if not wlprotocolsdep.found()
|
|
|
|
wlproto_dir = subproject('wayland-protocols').get_variable('wayland_protocols_srcdir')
|
|
|
|
else
|
|
|
|
wlproto_dir = wlprotocolsdep.get_pkgconfig_variable('pkgdatadir')
|
|
|
|
endif
|
|
|
|
|
2017-03-22 00:15:31 +00:00
|
|
|
wayland_pkgs = [
|
2020-12-27 05:27:59 +00:00
|
|
|
'wayland-client @0@'.format(wayland_req),
|
|
|
|
'xkbcommon @0@'.format(xkbcommon_req),
|
2017-03-22 00:15:31 +00:00
|
|
|
'wayland-egl',
|
|
|
|
]
|
2016-08-15 08:03:57 +00:00
|
|
|
endif
|
|
|
|
|
2017-03-22 00:15:31 +00:00
|
|
|
x11_pkgs = []
|
2016-09-24 15:35:10 +00:00
|
|
|
if x11_enabled
|
|
|
|
xrandr_dep = dependency('xrandr', version: '>= 1.2.99')
|
|
|
|
xrandr15_dep = dependency('xrandr', version: '>= 1.5', required: false)
|
|
|
|
x11_dep = dependency('x11')
|
|
|
|
xrender_dep = dependency('xrender')
|
|
|
|
xi_dep = dependency('xi')
|
|
|
|
xext_dep = dependency('xext')
|
2021-04-02 00:13:49 +00:00
|
|
|
xcursor_dep = dependency('xcursor')
|
|
|
|
xdamage_dep = dependency('xdamage')
|
|
|
|
xfixes_dep = dependency('xfixes')
|
2017-03-22 00:15:31 +00:00
|
|
|
fontconfig_dep = dependency('fontconfig')
|
2016-09-24 15:35:10 +00:00
|
|
|
|
2021-04-02 01:05:40 +00:00
|
|
|
x11_pkgs = ['fontconfig', 'x11', 'xext', 'xi', 'xrandr', 'xcursor', 'xdamage', 'xfixes', 'xinerama']
|
2016-09-24 10:46:10 +00:00
|
|
|
|
2021-04-02 00:13:49 +00:00
|
|
|
cdata.set('HAVE_XCURSOR', 1)
|
|
|
|
cdata.set('HAVE_XDAMAGE', 1)
|
|
|
|
cdata.set('HAVE_XFIXES', 1)
|
2017-03-22 00:15:31 +00:00
|
|
|
|
2021-04-02 00:13:49 +00:00
|
|
|
if not cc.has_function('XkbQueryExtension', dependencies: x11_dep,
|
|
|
|
prefix : '#include <X11/XKBlib.h>')
|
|
|
|
error('X11 backend enabled, but Xkb not found.')
|
2017-03-11 22:30:35 +00:00
|
|
|
endif
|
2021-04-02 00:13:49 +00:00
|
|
|
cdata.set('HAVE_XKB', 1)
|
2017-03-11 22:30:35 +00:00
|
|
|
|
2021-04-02 00:13:49 +00:00
|
|
|
if not cc.has_function('XSyncQueryExtension', dependencies: xext_dep,
|
|
|
|
prefix: '''#include <X11/Xlib.h>
|
|
|
|
#include <X11/extensions/sync.h>''')
|
|
|
|
error('X11 backend enabled, but Xsync not found.')
|
2017-03-11 22:30:35 +00:00
|
|
|
endif
|
2021-04-02 00:13:49 +00:00
|
|
|
cdata.set('HAVE_XSYNC', 1)
|
2016-09-24 10:46:10 +00:00
|
|
|
|
2021-04-02 00:13:49 +00:00
|
|
|
if not cc.has_function('XGetEventData', dependencies: x11_dep)
|
|
|
|
error('X11 backend enabled, but no generic event support.')
|
2017-03-11 22:30:35 +00:00
|
|
|
endif
|
2021-04-02 00:13:49 +00:00
|
|
|
cdata.set('HAVE_XGENERICEVENTS', 1)
|
2016-09-24 10:46:10 +00:00
|
|
|
|
2019-05-14 21:48:58 +00:00
|
|
|
if not xi_dep.found() or not cc.has_header('X11/extensions/XInput2.h', dependencies: xi_dep)
|
|
|
|
error('X11 backend enabled, but XInput2 not found.')
|
|
|
|
endif
|
|
|
|
|
|
|
|
# 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
|
2020-08-21 23:36:17 +00:00
|
|
|
has_allow_touch_events = cc.has_function('XIAllowTouchEvents', dependencies: xi_dep)
|
2019-05-14 21:48:58 +00:00
|
|
|
has_scroll_class_info = cc.has_member('XIScrollClassInfo', 'number', dependencies: xi_dep,
|
|
|
|
prefix: '''#include <X11/Xlib.h>
|
|
|
|
#include <X11/extensions/XInput2.h>''')
|
2021-04-02 00:13:49 +00:00
|
|
|
if not has_allow_touch_events or not has_scroll_class_info
|
|
|
|
error('X11 backend enabled, but XInput2.2 not found.')
|
2016-09-24 10:46:10 +00:00
|
|
|
endif
|
2021-04-02 00:13:49 +00:00
|
|
|
cdata.set('XINPUT_2_2', 1)
|
2016-09-24 10:46:10 +00:00
|
|
|
|
2021-04-02 00:13:49 +00:00
|
|
|
xinerama_dep = dependency('xinerama')
|
|
|
|
if not cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies: xinerama_dep)
|
|
|
|
error('X11 backend enabled, but Xinerama extension does not work.')
|
2017-03-24 11:34:49 +00:00
|
|
|
endif
|
2021-04-02 00:13:49 +00:00
|
|
|
cdata.set('HAVE_XFREE_XINERAMA', 1)
|
2017-03-24 11:34:49 +00:00
|
|
|
|
2017-03-22 00:15:31 +00:00
|
|
|
cdata.set('HAVE_RANDR', xrandr_dep.found())
|
|
|
|
cdata.set('HAVE_RANDR15', xrandr15_dep.found())
|
2016-09-24 10:46:10 +00:00
|
|
|
endif
|
|
|
|
|
2017-03-22 00:15:31 +00:00
|
|
|
if broadway_enabled
|
|
|
|
pc_gdk_extra_libs += ['-lz']
|
2016-09-24 15:35:10 +00:00
|
|
|
endif
|
|
|
|
|
2020-10-10 03:08:23 +00:00
|
|
|
if macos_enabled
|
2017-03-22 00:15:31 +00:00
|
|
|
pc_gdk_extra_libs += ['-framework Cocoa', '-framework Carbon']
|
2016-09-24 15:35:10 +00:00
|
|
|
endif
|
|
|
|
|
2018-03-28 04:13:08 +00:00
|
|
|
extra_demo_ldflags = []
|
2017-03-22 00:15:31 +00:00
|
|
|
if win32_enabled
|
2017-08-01 08:49:08 +00:00
|
|
|
pc_gdk_extra_libs += ['-lgdi32', '-limm32', '-lshell32', '-lole32']
|
2018-03-28 04:13:08 +00:00
|
|
|
if cc.get_id() == 'msvc'
|
|
|
|
# Since the demo programs are now built as pure GUI programs, we
|
|
|
|
# need to pass in /entry:mainCRTStartup so that they will properly
|
|
|
|
# link on Visual Studio builds
|
|
|
|
extra_demo_ldflags = ['/entry:mainCRTStartup']
|
|
|
|
else
|
2017-08-01 08:49:08 +00:00
|
|
|
pc_gdk_extra_libs += ['-Wl,-luuid']
|
|
|
|
endif
|
|
|
|
pc_gdk_extra_libs += ['-lwinmm', '-ldwmapi', '-lsetupapi', '-lcfgmgr32']
|
2018-06-22 07:02:24 +00:00
|
|
|
|
|
|
|
# Check whether libepoxy is built with EGL support on Windows
|
2016-09-24 15:35:10 +00:00
|
|
|
endif
|
2016-09-24 10:46:10 +00:00
|
|
|
|
2017-09-07 18:23:41 +00:00
|
|
|
# Check for bind_textdomain_codeset, including -lintl if GLib brings it in by
|
|
|
|
# doing the same check as glib. We can't check that by linking to glib because
|
|
|
|
# it might be a subproject and hence not built yet.
|
2018-07-06 18:50:41 +00:00
|
|
|
if cc.has_function('ngettext')
|
|
|
|
libintl_dep = []
|
2017-03-23 20:50:03 +00:00
|
|
|
cdata.set('HAVE_BIND_TEXTDOMAIN_CODESET', 1)
|
2018-07-06 18:50:41 +00:00
|
|
|
else
|
|
|
|
libintl_dep = cc.find_library('intl', required : false)
|
|
|
|
if cc.has_function('bind_textdomain_codeset', dependencies: libintl_dep)
|
|
|
|
cdata.set('HAVE_BIND_TEXTDOMAIN_CODESET', 1)
|
|
|
|
else
|
|
|
|
# Don't use subproject('proxy-libintl').get_variable('intl_dep') because that
|
|
|
|
# makes the dependency unconditional. This way, people have the option of
|
|
|
|
# either not providing the subproject or disabling it entirely with
|
|
|
|
# --wrap-mode=nodownload or nofallback.
|
|
|
|
libintl_dep = dependency('', required : false,
|
|
|
|
fallback: ['proxy-libintl', 'intl_dep'])
|
|
|
|
if libintl_dep.found()
|
|
|
|
cdata.set('HAVE_BIND_TEXTDOMAIN_CODESET', 1)
|
|
|
|
endif
|
|
|
|
endif
|
2017-03-23 20:50:03 +00:00
|
|
|
endif
|
|
|
|
|
2018-04-22 12:47:32 +00:00
|
|
|
if os_unix
|
2017-08-01 08:49:08 +00:00
|
|
|
cdata.set('HAVE_GIO_UNIX', giounix_dep.found())
|
|
|
|
endif
|
2017-03-22 00:15:31 +00:00
|
|
|
|
2017-03-17 23:43:36 +00:00
|
|
|
# Check for Vulkan support
|
2020-09-04 06:02:35 +00:00
|
|
|
# Uses meson's custom vulkan dependency searching. Set the VULKAN_SDK env var
|
|
|
|
# to use a custom path for the Vulkan SDK. Bugs that are found with it should
|
|
|
|
# be reported upstream and fixed.
|
2020-08-21 23:36:17 +00:00
|
|
|
vulkan_dep = dependency('vulkan', required: get_option('vulkan'))
|
|
|
|
if vulkan_dep.found()
|
|
|
|
have_vulkan = true
|
2020-09-04 06:02:35 +00:00
|
|
|
vulkan_pkg_found = vulkan_dep.type_name() == 'pkgconfig'
|
2018-02-05 11:42:02 +00:00
|
|
|
else
|
2020-08-21 23:36:17 +00:00
|
|
|
have_vulkan = false
|
|
|
|
vulkan_pkg_found = false
|
2017-03-17 23:43:36 +00:00
|
|
|
endif
|
|
|
|
|
2020-08-21 23:36:17 +00:00
|
|
|
cloudproviders_dep = dependency('cloudproviders',
|
|
|
|
required: get_option('cloudproviders'),
|
|
|
|
version: cloudproviders_req,
|
|
|
|
fallback: [
|
|
|
|
'libcloudproviders',
|
|
|
|
'libcloudproviders_dep',
|
|
|
|
],
|
|
|
|
default_options: [
|
|
|
|
'vapigen=false',
|
|
|
|
])
|
|
|
|
cdata.set('HAVE_CLOUDPROVIDERS', cloudproviders_dep.found())
|
2017-08-10 20:30:36 +00:00
|
|
|
|
2020-08-21 23:36:17 +00:00
|
|
|
# libsysprof-capture support
|
2020-09-04 11:02:15 +00:00
|
|
|
if not get_option('sysprof').disabled()
|
2020-10-08 23:23:23 +00:00
|
|
|
libsysprof_capture_dep = dependency('sysprof-capture-4', version: sysprof_req,
|
2020-09-04 11:02:15 +00:00
|
|
|
required: get_option('sysprof'),
|
|
|
|
default_options: [
|
|
|
|
'enable_examples=false',
|
|
|
|
'enable_gtk=false',
|
|
|
|
'enable_tests=false',
|
|
|
|
'enable_tools=false',
|
|
|
|
'libsysprof=true',
|
|
|
|
'with_sysprofd=none',
|
|
|
|
'help=false',
|
|
|
|
],
|
|
|
|
fallback: ['sysprof', 'libsysprof_capture_dep'],
|
|
|
|
)
|
|
|
|
cdata.set('HAVE_SYSPROF', libsysprof_capture_dep.found())
|
|
|
|
libsysprof_dep = dependency('sysprof-4',
|
|
|
|
required: false,
|
|
|
|
default_options: [
|
|
|
|
'enable_examples=false',
|
|
|
|
'enable_gtk=false',
|
|
|
|
'enable_tests=false',
|
|
|
|
'enable_tools=false',
|
|
|
|
'libsysprof=true',
|
|
|
|
'with_sysprofd=none',
|
|
|
|
'help=false',
|
|
|
|
],
|
|
|
|
fallback: ['sysprof', 'libsysprof_dep'],
|
|
|
|
)
|
|
|
|
profiler_enabled = true
|
|
|
|
else
|
|
|
|
libsysprof_capture_dep = disabler()
|
|
|
|
libsysprof_dep = disabler()
|
|
|
|
profiler_enabled = false
|
|
|
|
endif
|
2019-05-30 02:02:30 +00:00
|
|
|
|
2018-07-06 18:53:06 +00:00
|
|
|
graphene_dep_type = graphene_dep.type_name()
|
|
|
|
if graphene_dep_type == 'pkgconfig'
|
|
|
|
graphene_has_sse2 = graphene_dep.get_pkgconfig_variable('graphene_has_sse2') == '1'
|
|
|
|
graphene_has_gcc = graphene_dep.get_pkgconfig_variable('graphene_has_gcc') == '1'
|
|
|
|
else
|
|
|
|
graphene_simd = subproject('graphene').get_variable('graphene_simd')
|
|
|
|
graphene_has_sse2 = graphene_simd.contains('sse2')
|
|
|
|
graphene_has_gcc = graphene_simd.contains('gcc')
|
|
|
|
endif
|
2018-06-09 13:52:42 +00:00
|
|
|
|
|
|
|
if graphene_has_sse2 or graphene_has_gcc
|
|
|
|
message('Need aligned memory due to the use of SSE2 or GCC vector instructions')
|
|
|
|
|
|
|
|
if os_win32 and cc.get_id() == 'gcc'
|
2019-06-24 14:00:21 +00:00
|
|
|
add_project_arguments(['-mstackrealign'], language: 'c')
|
2018-06-09 13:52:42 +00:00
|
|
|
endif
|
|
|
|
endif
|
2018-03-01 20:46:16 +00:00
|
|
|
|
2021-04-07 23:41:54 +00:00
|
|
|
f16c_cflags = []
|
|
|
|
if get_option('f16c').enabled()
|
|
|
|
f16c_prog = '''
|
|
|
|
#if defined(__GNUC__)
|
|
|
|
# if !defined(__amd64__) && !defined(__x86_64__)
|
|
|
|
# error "F16C intrinsics are only available on x86_64"
|
|
|
|
# endif
|
2021-10-22 14:31:40 +00:00
|
|
|
#if !defined __has_attribute
|
|
|
|
# error "No __has_attribute() support"
|
|
|
|
#endif
|
|
|
|
#if !__has_attribute(ifunc)
|
|
|
|
# error "ifunc not supported"
|
|
|
|
#endif
|
|
|
|
static int resolved_ifunc (void) { return 0; }
|
|
|
|
static void *resolve_ifunc (void) { return resolved_ifunc; }
|
|
|
|
int ifunc_test (void) __attribute__((ifunc ("resolve_ifunc")));
|
|
|
|
#else
|
|
|
|
int ifunc_test (void) { return 0; }
|
2021-04-07 23:41:54 +00:00
|
|
|
#endif
|
2021-04-12 09:58:46 +00:00
|
|
|
#if defined(__SSE__) || defined(_MSC_VER)
|
2021-04-07 23:41:54 +00:00
|
|
|
# include <immintrin.h>
|
|
|
|
#else
|
|
|
|
# error "No F16C intrinsics available"
|
|
|
|
#endif
|
2021-10-22 14:31:40 +00:00
|
|
|
|
2021-04-07 23:41:54 +00:00
|
|
|
int main () {
|
|
|
|
float f[4] = { 0, };
|
|
|
|
unsigned short h[4] = { 0, };
|
|
|
|
__m128 s = _mm_loadu_ps (f);
|
|
|
|
__m128i i = _mm_cvtps_ph (s, 0);
|
|
|
|
_mm_storel_epi64 ((__m128i*)h, i);
|
2021-04-08 01:29:21 +00:00
|
|
|
|
2021-04-12 08:24:37 +00:00
|
|
|
#if defined (__GNUC__) || defined (__clang__)
|
2021-04-08 01:29:21 +00:00
|
|
|
__builtin_cpu_init ();
|
|
|
|
__builtin_cpu_supports ("f16c");
|
2021-04-12 08:24:37 +00:00
|
|
|
#endif
|
2021-04-08 01:29:21 +00:00
|
|
|
|
2021-10-22 14:31:40 +00:00
|
|
|
return ifunc_test ();
|
2021-04-07 23:41:54 +00:00
|
|
|
}'''
|
|
|
|
if cc.get_id() != 'msvc'
|
|
|
|
test_f16c_cflags = [ '-mf16c' ]
|
|
|
|
else
|
|
|
|
test_f16c_cflags = []
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cc.compiles(f16c_prog, args: test_f16c_cflags, name: 'F16C intrinsics')
|
|
|
|
cdata.set('HAVE_F16C', 1)
|
|
|
|
f16c_cflags = test_f16c_cflags
|
2021-05-05 22:58:23 +00:00
|
|
|
else
|
|
|
|
f16c_cflags = []
|
2021-04-07 23:41:54 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2021-05-05 00:39:52 +00:00
|
|
|
project_build_root = meson.current_build_dir()
|
|
|
|
|
2019-03-22 03:20:17 +00:00
|
|
|
subdir('gtk/css')
|
2016-08-15 08:03:57 +00:00
|
|
|
subdir('gdk')
|
2016-11-03 08:47:00 +00:00
|
|
|
subdir('gsk')
|
2016-09-20 09:10:27 +00:00
|
|
|
subdir('gtk')
|
2017-03-22 16:48:56 +00:00
|
|
|
subdir('modules')
|
2018-03-31 09:05:31 +00:00
|
|
|
if get_option('demos')
|
|
|
|
subdir('demos')
|
|
|
|
endif
|
2021-06-07 12:56:25 +00:00
|
|
|
subdir('tools')
|
2018-02-17 15:43:21 +00:00
|
|
|
if get_option('build-tests')
|
|
|
|
subdir('tests')
|
|
|
|
subdir('testsuite')
|
|
|
|
endif
|
2018-03-27 12:15:21 +00:00
|
|
|
if get_option('build-examples')
|
|
|
|
subdir('examples')
|
|
|
|
endif
|
2017-03-22 00:15:31 +00:00
|
|
|
|
2017-03-22 16:48:56 +00:00
|
|
|
# config.h
|
2021-09-11 00:51:11 +00:00
|
|
|
configure_file(output: 'config.h',
|
2017-04-18 13:25:44 +00:00
|
|
|
configuration: cdata)
|
2017-03-22 16:48:56 +00:00
|
|
|
|
2017-03-22 00:15:31 +00:00
|
|
|
# Requires
|
|
|
|
pango_pkgname = win32_enabled ? 'pangowin32' : 'pango'
|
2020-12-27 05:27:59 +00:00
|
|
|
gdk_packages = [
|
|
|
|
'@0@ @1@'.format(pango_pkgname, pango_req),
|
|
|
|
'pangocairo @0@'.format(pango_req),
|
|
|
|
'gdk-pixbuf-2.0 @0@'.format(gdk_pixbuf_req),
|
|
|
|
]
|
2017-09-12 05:34:36 +00:00
|
|
|
|
|
|
|
if cairo_pkg_found
|
2020-12-27 05:27:59 +00:00
|
|
|
gdk_packages += 'cairo @0@'.format(cairo_req)
|
2017-09-12 05:34:36 +00:00
|
|
|
endif
|
|
|
|
if cairogobj_pkg_found
|
2020-12-27 05:27:59 +00:00
|
|
|
gdk_packages += 'cairo-gobject @0@'.format(cairo_req)
|
2017-09-12 05:34:36 +00:00
|
|
|
endif
|
|
|
|
|
2018-02-05 11:42:02 +00:00
|
|
|
if vulkan_pkg_found
|
2020-12-27 05:42:29 +00:00
|
|
|
gdk_packages += ' vulkan'
|
2018-02-05 11:42:02 +00:00
|
|
|
endif
|
|
|
|
|
2020-12-27 05:27:59 +00:00
|
|
|
gsk_packages = [ 'graphene-gobject-1.0 @0@'.format(graphene_req) ]
|
|
|
|
gtk_packages = [ 'gio-2.0 @0@'.format(glib_req) ]
|
2017-03-22 00:15:31 +00:00
|
|
|
|
|
|
|
gio_pkgname = os_unix ? 'gio-unix-2.0' : 'gio-2.0'
|
2020-12-27 05:27:59 +00:00
|
|
|
gdk_private_packages = [
|
|
|
|
'@0@ @1@'.format(gio_pkgname, glib_req),
|
|
|
|
'epoxy @0@'.format(epoxy_req),
|
|
|
|
] + x11_pkgs + wayland_pkgs + cairo_backends
|
|
|
|
gsk_private_packages = [] # all already in gdk_private_packages
|
2017-03-22 00:15:31 +00:00
|
|
|
pangoft2_pkgs = (wayland_enabled or x11_enabled) ? ['pangoft2'] : []
|
2020-12-27 05:27:59 +00:00
|
|
|
gtk_private_packages = pangoft2_pkgs
|
2017-03-22 00:15:31 +00:00
|
|
|
|
2020-12-27 05:27:59 +00:00
|
|
|
gdk_extra_libs = pc_gdk_extra_libs
|
|
|
|
gsk_extra_libs = []
|
|
|
|
gtk_extra_libs = []
|
2017-03-22 00:15:31 +00:00
|
|
|
|
2020-12-27 05:27:59 +00:00
|
|
|
gdk_extra_cflags = []
|
|
|
|
gsk_extra_cflags = []
|
|
|
|
gtk_extra_cflags = []
|
2017-03-22 00:15:31 +00:00
|
|
|
|
2020-12-27 05:27:59 +00:00
|
|
|
pkgs = [ 'gtk4' ]
|
2017-03-22 00:15:31 +00:00
|
|
|
|
2020-12-27 05:27:59 +00:00
|
|
|
pkg_targets = []
|
2020-05-29 19:40:34 +00:00
|
|
|
display_backends = []
|
2020-10-10 03:08:23 +00:00
|
|
|
foreach backend: [ 'broadway', 'macos', 'wayland', 'win32', 'x11', ]
|
2017-03-22 00:15:31 +00:00
|
|
|
if get_variable('@0@_enabled'.format(backend))
|
2020-12-27 05:27:59 +00:00
|
|
|
pkgs += ['gtk4-@0@'.format(backend)]
|
|
|
|
pkg_targets += backend
|
2020-05-29 19:40:34 +00:00
|
|
|
display_backends += [ backend ]
|
2017-03-22 00:15:31 +00:00
|
|
|
endif
|
|
|
|
endforeach
|
2020-12-27 05:27:59 +00:00
|
|
|
|
|
|
|
common_pc_variables = [
|
|
|
|
'targets=@0@'.format(' '.join(pkg_targets)),
|
|
|
|
'gtk_binary_version=@0@'.format(gtk_binary_version),
|
|
|
|
'gtk_host=@0@-@1@'.format(host_machine.cpu_family(), host_machine.system()), # FIXME
|
|
|
|
]
|
2017-03-22 00:15:31 +00:00
|
|
|
|
2017-04-26 16:04:20 +00:00
|
|
|
foreach pkg: pkgs
|
2020-12-27 05:27:59 +00:00
|
|
|
pkg_config.generate(
|
|
|
|
filebase: pkg,
|
|
|
|
variables: common_pc_variables,
|
|
|
|
name: 'GTK',
|
|
|
|
description: 'GTK Graphical UI Library',
|
|
|
|
requires: gdk_packages + gsk_packages + gtk_packages,
|
|
|
|
requires_private: gdk_private_packages + gsk_private_packages + gtk_private_packages,
|
|
|
|
libraries: ['-L${libdir}', '-lgtk-4'],
|
|
|
|
libraries_private: gdk_extra_libs + gsk_extra_libs + gtk_extra_libs,
|
|
|
|
subdirs: ['gtk-@0@'.format(gtk_api_version)],
|
|
|
|
extra_cflags: gdk_extra_cflags + gsk_extra_cflags + gtk_extra_cflags,
|
|
|
|
)
|
2021-03-09 02:06:33 +00:00
|
|
|
meson.override_dependency(pkg, libgtk_dep)
|
2017-03-22 00:15:31 +00:00
|
|
|
endforeach
|
|
|
|
|
2018-04-22 12:47:32 +00:00
|
|
|
if os_unix
|
2020-12-27 05:27:59 +00:00
|
|
|
pkg_config.generate(
|
|
|
|
filebase: 'gtk4-unix-print',
|
|
|
|
variables: common_pc_variables,
|
|
|
|
name: 'GTK',
|
|
|
|
description: 'GTK Unix print support',
|
|
|
|
requires: ['gtk4'] + gtk_packages,
|
|
|
|
libraries: [],
|
|
|
|
subdirs: ['gtk-@0@/unix-print'.format(gtk_api_version)],
|
|
|
|
)
|
2017-03-22 00:15:31 +00:00
|
|
|
endif
|
2017-03-22 13:53:25 +00:00
|
|
|
|
|
|
|
subdir('po')
|
|
|
|
subdir('po-properties')
|
2017-04-19 10:35:45 +00:00
|
|
|
|
2019-05-25 16:27:32 +00:00
|
|
|
subdir('docs/tools')
|
|
|
|
subdir('docs/reference')
|
2017-04-26 14:59:43 +00:00
|
|
|
|
2020-04-05 19:57:22 +00:00
|
|
|
if not meson.is_cross_build()
|
2021-01-29 23:46:32 +00:00
|
|
|
if meson.version().version_compare('>=0.57.0')
|
|
|
|
gnome.post_install(
|
|
|
|
glib_compile_schemas: true,
|
|
|
|
gio_querymodules: gio_module_dirs,
|
|
|
|
gtk_update_icon_cache: true,
|
|
|
|
)
|
|
|
|
else
|
|
|
|
meson.add_install_script('build-aux/meson/post-install.py',
|
|
|
|
gtk_api_version,
|
|
|
|
gtk_binary_version,
|
|
|
|
gtk_libdir,
|
|
|
|
gtk_datadir,
|
|
|
|
gtk_bindir)
|
|
|
|
endif
|
2020-04-05 19:57:22 +00:00
|
|
|
else
|
|
|
|
message('Not executing post-install steps automatically when cross compiling')
|
|
|
|
endif
|
2018-04-13 13:21:41 +00:00
|
|
|
|
2021-02-26 07:27:02 +00:00
|
|
|
if not meson.is_subproject()
|
2021-03-30 14:42:40 +00:00
|
|
|
meson.add_dist_script('build-aux/meson/dist-data.py')
|
2021-02-26 07:27:02 +00:00
|
|
|
endif
|
2021-01-12 13:18:47 +00:00
|
|
|
|
2020-02-23 23:00:37 +00:00
|
|
|
if host_machine.system() != 'windows'
|
|
|
|
# Install Valgrind suppression files (except on Windows,
|
|
|
|
# as Valgrind is currently not supported on Windows)
|
2020-04-02 08:18:55 +00:00
|
|
|
install_data('gtk.supp',
|
2020-02-23 23:00:37 +00:00
|
|
|
install_dir : join_paths(gtk_datadir, 'gtk-4.0', 'valgrind'))
|
|
|
|
endif
|
|
|
|
|
2017-08-18 15:56:09 +00:00
|
|
|
|
2020-04-17 04:55:00 +00:00
|
|
|
#### Summary ####
|
|
|
|
|
2020-05-29 19:40:34 +00:00
|
|
|
summary('Display backends', display_backends)
|
2020-04-17 04:55:00 +00:00
|
|
|
summary('Print backends', print_backends)
|
|
|
|
summary('Media backends', media_backends)
|
2020-08-21 23:36:17 +00:00
|
|
|
|
|
|
|
summary('Vulkan support', vulkan_dep.found(), section: 'Features')
|
|
|
|
summary('Cloud support', cloudproviders_dep.found(), section: 'Features')
|
|
|
|
summary('Sysprof support', libsysprof_capture_dep.found(), section: 'Features')
|
|
|
|
summary('Colord support', colord_dep.found(), section: 'Features')
|
|
|
|
summary('Tracker support', tracker3_dep.found(), section: 'Features')
|
2020-04-17 04:55:00 +00:00
|
|
|
|
2021-09-19 08:52:36 +00:00
|
|
|
summary('Compiler', cc.get_id(), section: 'Toolchain')
|
|
|
|
summary('Linker', cc.get_linker_id(), section: 'Toolchain')
|
|
|
|
|
2020-04-17 04:55:00 +00:00
|
|
|
# Build
|
|
|
|
summary('Debugging', get_option('debug'), section: 'Build')
|
|
|
|
summary('Optimization', get_option('optimization'), section: 'Build')
|
2020-09-30 13:41:28 +00:00
|
|
|
summary('Introspection', build_gir, section: 'Build')
|
2020-04-17 04:55:00 +00:00
|
|
|
summary('Documentation', get_option('gtk_doc'), section: 'Build')
|
|
|
|
summary('Man pages', get_option('man-pages'), section: 'Build')
|
|
|
|
summary('Tests', get_option('build-tests'), section: 'Build')
|
|
|
|
summary('Install tests', get_option('install-tests'), section: 'Build')
|
|
|
|
summary('Demos', get_option('demos'), section: 'Build')
|
|
|
|
summary('Examples', get_option('build-examples'), section: 'Build')
|
|
|
|
|
|
|
|
# Directories
|
|
|
|
summary('prefix', gtk_prefix, section: 'Directories')
|
|
|
|
summary('includedir', gtk_includedir, section: 'Directories')
|
|
|
|
summary('libdir', gtk_libdir, section: 'Directories')
|
|
|
|
summary('datadir', gtk_datadir, section: 'Directories')
|