tests: Set G_DEBUG and other useful environment variables
[dconf.git] / meson.build
blob7f9767e08a528af3a51805496b6010b45ba26806
1 project(
2   'dconf', ['c', 'vala'],
3   version: '0.28.0',
4   license: 'LGPL2.1+',
5   default_options: [
6     'buildtype=debugoptimized',
7     'warning_level=1'
8   ],
9   meson_version: '>= 0.41.0'
12 dconf_version = meson.project_version()
13 version_array = dconf_version.split('.')
14 dconf_major_version = version_array[0].to_int()
15 dconf_minor_version = version_array[1].to_int()
16 dconf_micro_version = version_array[2].to_int()
18 dconf_prefix = get_option('prefix')
19 dconf_bindir = join_paths(dconf_prefix, get_option('bindir'))
20 dconf_datadir = join_paths(dconf_prefix, get_option('datadir'))
21 dconf_includedir = join_paths(dconf_prefix, get_option('includedir'))
22 dconf_libdir = join_paths(dconf_prefix, get_option('libdir'))
23 dconf_libexecdir = join_paths(dconf_prefix, get_option('libexecdir'))
24 dconf_mandir = join_paths(dconf_prefix, get_option('mandir'))
26 dconf_namespace = 'ca.desrt.dconf'
28 soversion = 1
29 current = 0
30 revision = 0
31 libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
33 cc = meson.get_compiler('c')
34 valac = meson.get_compiler('vala')
36 config_h = configuration_data()
38 # package
39 set_defines = [
40   ['PACKAGE', meson.project_name()],
41   ['PACKAGE_BUGREPORT', 'https://gitlab.gnome.org/GNOME/dconf/issues'],
42   ['PACKAGE_NAME', meson.project_name()],
43   ['PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), dconf_version)],
44   ['PACKAGE_TARNAME', meson.project_name()],
45   ['PACKAGE_URL', 'https://wiki.gnome.org/Projects/dconf'],
46   ['PACKAGE_VERSION', dconf_version],
47   ['VERSION', dconf_version],
48   ['GETTEXT_PACKAGE', meson.project_name()]
51 foreach define: set_defines
52   config_h.set_quoted(define[0], define[1])
53 endforeach
55 # compiler flags
56 common_flags = ['-DHAVE_CONFIG_H']
58 if get_option('buildtype').contains('debug')
59   test_cflags = [
60     '-fno-common',
61     '-Wmissing-prototypes',
62     '-Wwrite-strings'
63   ]
65   foreach cflag: test_cflags
66     if cc.has_argument(cflag)
67       common_flags += [cflag]
68     endif
69   endforeach
70 endif
72 add_project_arguments(common_flags, language: 'c')
74 gio_unix_req_version = '>= 2.25.7'
76 glib_dep = dependency('glib-2.0', version: '>= 2.44.0')
77 gio_unix_dep = dependency('gio-unix-2.0', version: gio_unix_req_version)
79 gio_querymodules = find_program('gio-querymodules', required: false)
80 if gio_querymodules.found()
81   gio_modules_dir = get_option('with-gio-modules-dir').strip()
82   if gio_modules_dir == ''
83     gio_modules_dir = join_paths(dconf_libdir, 'gio', 'modules')
84   endif
86   meson.add_install_script('meson_post_install.py', gio_querymodules.path(), gio_modules_dir)
87 endif
89 configure_file(
90   output: 'config.h',
91   configuration: config_h
94 test_env = [
95   'G_DEBUG=gc-friendly,fatal-warnings',
96   'MALLOC_CHECK_=2',
97   'LC_ALL=C.UTF-8',
100 gnome = import('gnome')
101 pkg = import('pkgconfig')
103 top_inc = include_directories('.')
105 subdir('shm')
106 subdir('gvdb')
107 subdir('common')
108 subdir('engine')
109 subdir('service')
110 subdir('gdbus')
111 subdir('gsettings')
112 subdir('client')
113 subdir('bin')
114 subdir('docs')
115 subdir('tests')