meson: build translations
[platform/upstream/at-spi2-core.git] / meson.build
1 project('at-spi2-core', 'c',
2         version: '2.25.90',
3         license: 'LGPLv2.1+',
4         default_options: [
5           'buildtype=debugoptimized',
6           'warning_level=1',
7           'c_std=c99',
8         ],
9         meson_version: '>= 0.40.1')
10
11 add_project_arguments([ '-D_POSIX_C_SOURCE', '-D_DEFAULT_SOURCE' ], language: 'c')
12
13 atspi_gir_ns = 'Atspi'
14
15 cc = meson.get_compiler('c')
16 host_system = host_machine.system()
17
18 soversion = '0.0.1'
19
20 at_spi_conf = configuration_data()
21 at_spi_conf.set('GETTEXT_PACKAGE', meson.project_name())
22
23 root_inc = include_directories('.')
24 registryd_inc = include_directories('registryd')
25
26 atspi_prefix = get_option('prefix')
27 atspi_datadir = join_paths(atspi_prefix, get_option('datadir'))
28 atspi_libexecdir = join_paths(atspi_prefix, get_option('libexecdir'))
29 atspi_sysconfdir = join_paths(atspi_prefix, get_option('sysconfdir'))
30 atspi_libdir = join_paths(atspi_prefix, get_option('libdir'))
31 atspi_includedir = join_paths(atspi_prefix, get_option('includedir'))
32
33 if get_option('dbus_services_dir') != 'default'
34   dbus_services_dir = get_option('dbus_services_dir')
35 else
36   dbus_services_dir = join_paths(get_option('datadir'), 'dbus-1/services')
37 endif
38
39 if get_option('systemd_user_dir') != 'default'
40   systemd_user_dir = get_option('systemd_user_dir')
41 else
42   systemd_user_dir = join_paths(get_option('prefix'), 'lib/systemd/user')
43 endif
44
45 # Dependencies
46 libdbus_req_version = '>= 1.5'
47 glib_req_version = '>= 2.32.0'
48 gobject_req_version = '>= 2.0.0'
49 gio_req_version = '>= 2.28.0'
50
51 libdbus_dep = dependency('dbus-1', version: libdbus_req_version)
52 glib_dep = dependency('glib-2.0', version: glib_req_version)
53 gobject_dep = dependency('gobject-2.0', version: gobject_req_version)
54 gio_dep = dependency('gio-2.0', version: gio_req_version)
55 dl_dep = cc.find_library('dl', required: false)
56 x11_dep = dependency('x11', required: false)
57
58 x11_deps = []
59 if x11_dep.found()
60   x11_deps += x11_dep
61
62   xtest_dep = dependency('xtst')
63   x11_deps += xtest_dep
64
65   xkb_dep = dependency('xkbcommon-x11', required: false)
66   if xkb_dep.found()
67     x11_deps += xkb_dep
68     at_spi_conf.set('HAVE_XKB', 1)
69   endif
70
71   xinput_dep = dependency('xi')
72   x11_deps += xinput_dep
73 endif
74
75 # Alignments
76 at_spi_conf.set('ALIGNOF_CHAR', cc.alignment('char'))
77 at_spi_conf.set('ALIGNOF_DOUBLE', cc.alignment('double'))
78
79 dbus_alignments = [
80   'dbus_bool_t',
81   'dbus_int16_t',
82   'dbus_int32_t',
83   'dbus_int64_t',
84 ]
85
86 foreach a: dbus_alignments
87   at_spi_conf.set('ALIGNOF_' + a.underscorify().to_upper(),
88                   cc.alignment(a, prefix: '#include <dbus/dbus.h>', dependencies: libdbus_dep))
89 endforeach
90
91 at_spi_conf.set('ALIGNOF_DBIND_POINTER', cc.alignment('dbind_pointer', prefix: 'typedef void *dbind_pointer;'))
92 at_spi_conf.set('ALIGNOF_DBIND_STRUCT', cc.alignment('dbind_struct', prefix: 'typedef struct { char s1; } dbind_struct;'))
93
94 # introspection support
95 have_gir = false
96
97 introspection_option = get_option('enable-introspection')
98 if introspection_option != 'no'
99   gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.6.7', required: false)
100
101   if gir_dep.found()
102     have_gir = true
103   endif
104 endif
105
106 xgettext = find_program('xgettext', required : false)
107
108 configure_file(output: 'config.h', configuration: at_spi_conf)
109
110 # Compat variables for pkgconfig
111 pkgconf = configuration_data()
112 pkgconf.set('prefix', get_option('prefix'))
113 pkgconf.set('exec_prefix', get_option('prefix'))
114 pkgconf.set('libdir', atspi_libdir)
115 pkgconf.set('includedir', atspi_includedir)
116 pkgconf.set('VERSION', meson.project_version())
117
118 configure_file(input: 'atspi-2.pc.in',
119                output: 'atspi-2.pc',
120                configuration: pkgconf,
121                install: true,
122                install_dir: join_paths(get_option('libdir'), 'pkgconfig'))
123
124 gnome = import('gnome')
125
126 subdir('dbind')
127 subdir('atspi')
128 subdir('bus')
129 subdir('registryd')
130 subdir('test')
131
132 if get_option('enable_docs')
133   subdir('doc/libatspi')
134 endif
135
136 if xgettext.found()
137   subdir('po')
138 endif