summaryrefslogtreecommitdiff
path: root/meson.build
blob: cddf083bbebd393d1bffed2b80f22b0adca9bc05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
project(
  'dconf', ['c', 'vala'],
  version: '0.28.0',
  license: 'LGPL2.1+',
  default_options: [
    'buildtype=debugoptimized',
    'warning_level=1'
  ],
  meson_version: '>= 0.41.0'
)

dconf_version = meson.project_version()
version_array = dconf_version.split('.')
dconf_major_version = version_array[0].to_int()
dconf_minor_version = version_array[1].to_int()
dconf_micro_version = version_array[2].to_int()

dconf_prefix = get_option('prefix')
dconf_bindir = join_paths(dconf_prefix, get_option('bindir'))
dconf_datadir = join_paths(dconf_prefix, get_option('datadir'))
dconf_includedir = join_paths(dconf_prefix, get_option('includedir'))
dconf_libdir = join_paths(dconf_prefix, get_option('libdir'))
dconf_libexecdir = join_paths(dconf_prefix, get_option('libexecdir'))
dconf_mandir = join_paths(dconf_prefix, get_option('mandir'))

dconf_namespace = 'ca.desrt.dconf'

soversion = 1
current = 0
revision = 0
libversion = '@0@.@1@.@2@'.format(soversion, current, revision)

cc = meson.get_compiler('c')
valac = meson.get_compiler('vala')

config_h = configuration_data()

# package
set_defines = [
  ['PACKAGE', meson.project_name()],
  ['PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=dconf'],
  ['PACKAGE_NAME', meson.project_name()],
  ['PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), dconf_version)],
  ['PACKAGE_TARNAME', meson.project_name()],
  ['PACKAGE_URL', 'https://wiki.gnome.org/Projects/dconf'],
  ['PACKAGE_VERSION', dconf_version],
  ['VERSION', dconf_version],
  ['GETTEXT_PACKAGE', meson.project_name()]
]

foreach define: set_defines
  config_h.set_quoted(define[0], define[1])
endforeach

# compiler flags
common_flags = ['-DHAVE_CONFIG_H']

if get_option('buildtype').contains('debug')
  test_cflags = [
    '-fno-common',
    '-Wmissing-prototypes',
    '-Wwrite-strings'
  ]

  foreach cflag: test_cflags
    if cc.has_argument(cflag)
      common_flags += [cflag]
    endif
  endforeach
endif

add_project_arguments(common_flags, language: 'c')

gio_unix_req_version = '>= 2.25.7'

glib_dep = dependency('glib-2.0', version: '>= 2.44.0')
gio_unix_dep = dependency('gio-unix-2.0', version: gio_unix_req_version)

gio_querymodules = find_program('gio-querymodules', required: false)
if gio_querymodules.found()
  gio_modules_dir = get_option('with-gio-modules-dir').strip()
  if gio_modules_dir == ''
    gio_modules_dir = join_paths(dconf_libdir, 'gio', 'modules')
  endif

  meson.add_install_script('meson_post_install.py', gio_querymodules.path(), gio_modules_dir)
endif

configure_file(
  output: 'config.h',
  configuration: config_h
)

gnome = import('gnome')
pkg = import('pkgconfig')

top_inc = include_directories('.')

subdir('shm')
subdir('gvdb')
subdir('common')
subdir('engine')
subdir('service')
subdir('gdbus')
subdir('gsettings')
subdir('client')
subdir('bin')

if get_option('enable-gtk-doc')
  subdir('docs')
endif

subdir('tests')