-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmeson.build
111 lines (90 loc) · 3.4 KB
/
meson.build
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
project('nip4', 'c',
# ie. a major after nip2 8.9 for workspace save file versioning
version: '9.0.6',
license: 'GPL',
meson_version: '>=0.64',
default_options: [
'c_std=c2x',
# do a release (optimised) build by default
'buildtype=release',
# turn off asserts etc. in release mode
'b_ndebug=if-release'
]
)
application_id = 'org.libvips.nip4'
version_parts = meson.project_version().split('.')
version_major = version_parts[0]
version_minor = version_parts[1]
version_micro = version_parts[2]
prefix_dir = get_option('prefix')
lib_dir = prefix_dir / get_option('libdir')
project_source_root = meson.current_source_dir()
project_build_root = meson.current_build_dir()
pkg = import('pkgconfig')
gnome = import('gnome')
# we should probably have more flexibility here
lex = find_program('flex')
yacc = find_program('bison')
cc = meson.get_compiler('c')
config_h = configuration_data()
set_defines = [
['APPLICATION_ID', application_id],
['PACKAGE', meson.project_name()],
['VERSION', meson.project_version()],
]
foreach define: set_defines
config_h.set_quoted(define[0], define[1])
endforeach
# Needed for reallocarray()
default_source_flag = ['-D_DEFAULT_SOURCE']
add_project_arguments(default_source_flag, language: 'c')
nip4_deps = [cc.find_library('m')]
gettext_domain = 'nip4@0@.@1@'.format(version_major, version_minor)
config_h.set_quoted('GETTEXT_PACKAGE', gettext_domain)
config_h.set_quoted('PREFIX', prefix_dir)
config_h.set_quoted('LIBDIR', lib_dir)
config_h.set('MAJOR_VERSION', version_major)
config_h.set('MINOR_VERSION', version_minor)
config_h.set('MICRO_VERSION', version_micro)
libintl_dep = dependency('intl', required: false)
have_bind_textdomain_codeset = false
if libintl_dep.found()
nip4_deps += libintl_dep
config_h.set('ENABLE_NLS', true)
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset', prefix: '#include <libintl.h>', dependencies: libintl_dep)
endif
config_h.set('HAVE_BIND_TEXTDOMAIN_CODESET', have_bind_textdomain_codeset)
config_h.set('HAVE_SYS_RESOURCE_H', cc.has_header('sys/resource.h'))
config_h.set('HAVE_GETRLIMIT', cc.has_function('getrlimit'))
config_h.set('HAVE_REALLOCARRAY', cc.has_function('reallocarray', prefix: '#include <stdlib.h>', args: default_source_flag))
config_file = configure_file(
output: 'config.h',
configuration: config_h,
)
nip4_deps += declare_dependency(
sources: config_file,
include_directories: include_directories('.'),
compile_args: '-DHAVE_CONFIG_H',
)
# need vips_thread_execute()
nip4_deps += dependency('vips', version: '>=8.16')
nip4_deps += dependency('gtk4', version: '>=4.14')
nip4_deps += dependency('gsl')
nip4_deps += dependency('libxml-2.0')
# Courtesy check that the compiler supports the cleanup attribute
glib_dep = dependency('glib-2.0')
if not cc.has_header_symbol('glib.h', 'g_autofree', dependencies : glib_dep)
error('nip4 requires the GNU C "cleanup" attribute.')
endif
install_data(application_id + '.gschema.xml',
install_dir: get_option('datadir') / 'glib-2.0' / 'schemas')
install_data(application_id + '.png',
install_dir: get_option('datadir') / 'icons' / 'hicolor' / '128x128' / 'apps')
install_data(application_id + '.desktop',
install_dir: get_option('datadir') / 'applications')
install_data(application_id + '.metainfo.xml',
install_dir: get_option('datadir') / 'metainfo')
meson.add_install_script('meson_post_install.py')
subdir('src')
subdir('share')
subdir('test')