Version 2.36.0
[platform/upstream/atk.git] / meson.build
1 project('atk', 'c',
2         version: '2.36.0',
3         license: 'LGPLv2.1+',
4         default_options: [
5           'buildtype=debugoptimized',
6           'warning_level=1',
7           'c_std=c99',
8         ],
9         meson_version : '>= 0.46.0')
10
11 cc = meson.get_compiler('c')
12 host_system = host_machine.system()
13
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()
18
19 atk_interface_age = 1
20 atk_binary_age = 10000 * atk_major_version + 100 * atk_minor_version + 10 + atk_micro_version
21
22 atk_api_version = '1.0'
23 atk_api_name = 'atk-@0@'.format(atk_api_version)
24 atk_api_path = '@0@/atk'.format(atk_api_name)
25
26 atk_prefix = get_option('prefix')
27 atk_libdir = join_paths(atk_prefix, get_option('libdir'))
28 atk_sysconfdir = join_paths(atk_prefix, get_option('sysconfdir'))
29 atk_includedir = join_paths(atk_prefix, get_option('includedir'))
30 atk_datadir = join_paths(atk_prefix, get_option('datadir'))
31 atk_libexecdir = join_paths(atk_prefix, get_option('libexecdir'))
32
33 atk_conf = configuration_data()
34
35 atk_conf.set_quoted('VERSION', meson.project_version())
36 atk_conf.set_quoted('GETTEXT_PACKAGE', 'atk10')
37
38 # Maintain version scheme with libtool
39 atk_soversion = 0
40 current = atk_binary_age - atk_interface_age
41 atk_libversion = '@0@.@1@.@2@'.format(atk_soversion, current, atk_interface_age)
42 darwin_versions = ['@0@'.format(current + 1), '@0@.@1@'.format(current + 1, atk_interface_age)]
43
44 add_project_arguments([ '-DG_DISABLE_SINGLE_INCLUDES', '-DATK_DISABLE_SINGLE_INCLUDES' ], language: 'c')
45
46 if cc.get_id() == 'msvc'
47   add_project_arguments(cc.get_supported_arguments(['-FImsvc_recommended_pragmas.h', '-utf-8']), language: 'c')
48 endif
49
50 # Compiler and linker flags
51 common_cflags = []
52 common_ldflags = []
53
54 test_cflags = []
55
56 # Symbol visibility
57 if get_option('default_library') != 'static'
58   if host_system == 'windows'
59     atk_conf.set('DLL_EXPORT', true)
60     atk_conf.set('_ATK_EXTERN', '__declspec(dllexport) extern')
61     if cc.get_id() != 'msvc'
62       test_cflags += ['-fvisibility=hidden']
63     endif
64   else
65     atk_conf.set('_ATK_EXTERN', '__attribute__((visibility("default"))) extern')
66     test_cflags += ['-fvisibility=hidden']
67   endif
68 endif
69
70 # Check all compiler flags
71 common_cflags += cc.get_supported_arguments(test_cflags)
72
73 # Linker flags
74 if host_machine.system() == 'linux'
75   test_ldflags = [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ]
76   common_ldflags += cc.get_supported_link_arguments(test_ldflags)
77 endif
78
79 # Maintain compatibility with autotools on macOS
80 if host_machine.system() == 'darwin'
81   common_ldflags += [ '-compatibility_version', darwin_versions[0], '-current_version', darwin_versions[1]]
82 endif
83
84 # Functions
85 checked_funcs = [
86   'bind_textdomain_codeset',
87 ]
88
89 foreach f: checked_funcs
90   if cc.has_function(f)
91     atk_conf.set('HAVE_' + f.underscorify().to_upper(), 1)
92   endif
93 endforeach
94
95 # Dependencies
96 glib_req_version = '>= 2.38.0'
97
98 glib_dep = [dependency('glib-2.0', version: glib_req_version,
99                           fallback : ['glib', 'libglib_dep']),
100             dependency('gobject-2.0', version: glib_req_version,
101                           fallback : ['glib', 'libgobject_dep'])]
102
103 pkgconfig = import('pkgconfig')
104 gnome = import('gnome')
105
106 # Internal configuration header
107 configure_file(output: 'config.h', configuration: atk_conf)
108
109 root_inc = include_directories('.')
110 atk_inc = include_directories('atk')
111
112 subdir('atk')
113 subdir('tests')
114 subdir('po')
115
116 if get_option('docs')
117   subdir('docs')
118 endif