atkimplementor: use the G_DEFINE_INTERFACE macro to declare it as interface in the...
[atk.git] / meson.build
blob51f5f5d95feefc9af825ad6566086a0e2480b014
1 project('atk', 'c',
2         version: '2.29.1',
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')
11 cc = meson.get_compiler('c')
12 host_system = host_machine.system()
14 version = meson.project_version().split('.')
15 atk_major_version = version[0].to_int()
16 atk_minor_version = version[1].to_int()
17 atk_micro_version = version[2].to_int()
19 atk_interface_age = 1
20 atk_binary_age = 10000 * atk_major_version + 100 * atk_minor_version + 10 + atk_micro_version
22 atk_api_version = '1.0'
23 atk_api_path = 'atk-@0@/atk'.format(atk_api_version)
25 atk_prefix = get_option('prefix')
26 atk_libdir = join_paths(atk_prefix, get_option('libdir'))
27 atk_sysconfdir = join_paths(atk_prefix, get_option('sysconfdir'))
28 atk_includedir = join_paths(atk_prefix, get_option('includedir'))
29 atk_datadir = join_paths(atk_prefix, get_option('datadir'))
30 atk_libexecdir = join_paths(atk_prefix, get_option('libexecdir'))
32 atk_conf = configuration_data()
34 atk_conf.set_quoted('VERSION', meson.project_version())
35 atk_conf.set_quoted('GETTEXT_PACKAGE', 'atk10')
37 # Maintain version scheme with libtool
38 atk_soversion = 0
39 atk_libversion = '@0@.@1@.@2@'.format(atk_soversion, (atk_binary_age - atk_interface_age), atk_interface_age)
41 add_project_arguments([ '-DG_DISABLE_SINGLE_INCLUDES', '-DATK_DISABLE_SINGLE_INCLUDES' ], language: 'c')
43 if cc.get_id() == 'msvc'
44   add_project_arguments([ '-FImsvc_recommended_pragmas.h' ], language: 'c')
45 endif
47 # Compiler and linker flags
48 common_cflags = []
49 common_ldflags = []
51 test_cflags = []
53 # Symbol visibility
54 if get_option('default_library') != 'static'
55   if host_system == 'windows'
56     atk_conf.set('DLL_EXPORT', true)
57     atk_conf.set('_ATK_EXTERN', '__declspec(dllexport) extern')
58     if cc.get_id() != 'msvc'
59       test_cflags += ['-fvisibility=hidden']
60     endif
61   else
62     atk_conf.set('_ATK_EXTERN', '__attribute__((visibility("default"))) extern')
63     test_cflags += ['-fvisibility=hidden']
64   endif
65 endif
67 # Check all compiler flags
68 foreach cflag: test_cflags
69   if cc.has_argument(cflag)
70     common_cflags += [ cflag ]
71   endif
72 endforeach
74 # Linker flags
75 if host_machine.system() == 'linux'
76   foreach ldflag: [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ]
77     if cc.has_argument(ldflag)
78       common_ldflags += [ ldflag ]
79     endif
80   endforeach
81 endif
83 # Maintain compatibility with autotools on macOS
84 if host_machine.system() == 'darwin'
85   common_ldflags += [ '-compatibility_version 1', '-current_version 1.0', ]
86 endif
88 # Functions
89 checked_funcs = [
90   'bind_textdomain_codeset',
93 foreach f: checked_funcs
94   if cc.has_function(f)
95     atk_conf.set('HAVE_' + f.underscorify().to_upper(), 1)
96   endif
97 endforeach
99 # Dependencies
100 gobject_req_version = '>= 2.31.2'
102 gobject_dep = dependency('gobject-2.0', version: gobject_req_version)
104 # Compat variables for pkgconfig
105 pkgconf = configuration_data()
106 pkgconf.set('prefix', atk_prefix)
107 pkgconf.set('exec_prefix', atk_prefix)
108 pkgconf.set('libdir', atk_libdir)
109 pkgconf.set('includedir', atk_includedir)
110 pkgconf.set('VERSION', meson.project_version())
111 pkgconf.set('ATK_API_VERSION', atk_api_version)
112 pkgconf.set('srcdir', '.')
114 foreach pkg: [ 'atk.pc', ]
115   configure_file(input: pkg + '.in',
116                  output: pkg,
117                  configuration: pkgconf,
118                  install: true,
119                  install_dir: join_paths(atk_libdir, 'pkgconfig'))
120 endforeach
122 gnome = import('gnome')
124 # Internal configuration header
125 configure_file(output: 'config.h', configuration: atk_conf)
127 root_inc = include_directories('.')
129 subdir('atk')
130 subdir('tests')
131 subdir('po')
133 if get_option('docs')
134   subdir('docs')
135 endif