caac91b31376fcc49e88aad8448e156c03db2086
[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_datadir = join_paths(get_option('prefix'), get_option('datadir'))
27 atspi_libexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
28 atspi_sysconfdir = join_paths(get_option('prefix'), get_option('sysconfdir'))
29
30 if get_option('dbus_services_dir') != 'default'
31   dbus_services_dir = get_option('dbus_services_dir')
32 else
33   dbus_services_dir = join_paths(get_option('datadir'), 'dbus-1/services')
34 endif
35
36 if get_option('systemd_user_dir') != 'default'
37   systemd_user_dir = get_option('systemd_user_dir')
38 else
39   systemd_user_dir = join_paths(get_option('prefix'), 'lib/systemd/user')
40 endif
41
42 # Dependencies
43 libdbus_req_version = '>= 1.5'
44 glib_req_version = '>= 2.32.0'
45 gobject_req_version = '>= 2.0.0'
46 gio_req_version = '>= 2.28.0'
47
48 libdbus_dep = dependency('dbus-1', version: libdbus_req_version)
49 glib_dep = dependency('glib-2.0', version: glib_req_version)
50 gobject_dep = dependency('gobject-2.0', version: gobject_req_version)
51 gio_dep = dependency('gio-2.0', version: gio_req_version)
52 dl_dep = cc.find_library('dl', required: false)
53 x11_dep = dependency('x11', required: false)
54
55 x11_deps = []
56 if x11_dep.found()
57   x11_deps += x11_dep
58
59   xtest_dep = dependency('xtst')
60   x11_deps += xtest_dep
61
62   xkb_dep = dependency('xkbcommon-x11', required: false)
63   if xkb_dep.found()
64     x11_deps += xkb_dep
65     at_spi_conf.set('HAVE_XKB', 1)
66   endif
67
68   xinput_dep = dependency('xi')
69   x11_deps += xinput_dep
70 endif
71
72 # Alignments
73 at_spi_conf.set('ALIGNOF_CHAR', cc.alignment('char'))
74 at_spi_conf.set('ALIGNOF_DOUBLE', cc.alignment('double'))
75
76 dbus_alignments = [
77   'dbus_bool_t',
78   'dbus_int16_t',
79   'dbus_int32_t',
80   'dbus_int64_t',
81 ]
82
83 foreach a: dbus_alignments
84   at_spi_conf.set('ALIGNOF_' + a.underscorify().to_upper(),
85                   cc.alignment(a, prefix: '#include <dbus/dbus.h>', dependencies: libdbus_dep))
86 endforeach
87
88 at_spi_conf.set('ALIGNOF_DBIND_POINTER', cc.alignment('dbind_pointer', prefix: 'typedef void *dbind_pointer;'))
89 at_spi_conf.set('ALIGNOF_DBIND_STRUCT', cc.alignment('dbind_struct', prefix: 'typedef struct { char s1; } dbind_struct;'))
90
91 # introspection support
92 have_gir = false
93
94 introspection_option = get_option('enable-introspection')
95 if introspection_option != 'no'
96   gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.6.7', required: false)
97
98   if gir_dep.found()
99     have_gir = true
100   endif
101 endif
102
103 configure_file(output: 'config.h', configuration: at_spi_conf)
104
105 # Compat variables for pkgconfig
106 pkgconf = configuration_data()
107 pkgconf.set('prefix', get_option('prefix'))
108 pkgconf.set('exec_prefix', get_option('prefix'))
109 pkgconf.set('libdir', get_option('libdir'))
110 pkgconf.set('includedir', get_option('includedir'))
111 pkgconf.set('VERSION', meson.project_version())
112
113 configure_file(input: 'atspi-2.pc.in',
114                output: 'atspi-2.pc',
115                configuration: pkgconf,
116                install: true,
117                install_dir: join_paths(get_option('libdir'), 'pkgconfig'))
118
119 gnome = import('gnome')
120
121 subdir('dbind')
122 subdir('atspi')
123 subdir('bus')
124 subdir('registryd')
125 subdir('test')
126
127 if get_option('enable_docs')
128   subdir('doc/libatspi')
129 endif