-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
182 lines (162 loc) · 4.16 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
project(
'fies', 'c',
version : '0.0.6',
default_options : [
'c_std=c17',
'prefix=/usr',
],
meson_version : '>= 0.40',
)
libfies_version = '0.1.0'
libfies_dmthin_version = '0.1.0'
add_global_arguments('-D_GNU_SOURCE', language : 'c')
conf = configuration_data()
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
prefixdir = get_option('prefix')
bindir = join_paths(prefixdir, get_option('bindir'))
libdir = join_paths(prefixdir, get_option('libdir'))
datadir = join_paths(prefixdir, get_option('datadir'))
mandir = join_paths(prefixdir, get_option('mandir'))
man1dir = join_paths(mandir, 'man1')
pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
includedir = join_paths(prefixdir, get_option('includedir'))
# ... hmm
substs = configuration_data()
substs.set_quoted('PACKAGE_VERSION', meson.project_version())
substs.set('PREFIX', prefixdir)
substs.set('BINDIR', bindir)
substs.set('LIBDIR', libdir)
substs.set('INCLUDEDIR', includedir)
cc = meson.get_compiler('c')
pkgconfig = import('pkgconfig')
use_cxx = false
cxx = []
want_tests = get_option('tests')
if want_tests != 'false'
add_languages('cpp')
cxx = meson.get_compiler('cpp')
use_cxx = true
endif
foreach arg : [
'-Wall',
'-Wextra',
'-Weverything',
'-Werror',
]
if cc.has_argument(arg)
add_project_arguments(arg, language : 'c')
endif
if use_cxx and cxx.has_argument(arg)
add_project_arguments(arg, language : 'cpp')
endif
endforeach
foreach arg : [
'unknown-pragmas',
'pragmas',
'c++98-compat',
'c++98-compat-pedantic',
'disabled-macro-expansion',
'declaration-after-statement',
]
if cc.has_argument('-W' + arg)
add_project_arguments('-Wno-' + arg, language : 'c')
endif
if use_cxx and cxx.has_argument('-W' + arg)
add_project_arguments('-Wno-' + arg, language : 'cpp')
endif
endforeach
if use_cxx
foreach arg : [
'weak-vtables',
]
if cxx.has_argument('-W' + arg)
add_project_arguments('-Wno-' + arg, language : 'cpp')
endif
endforeach
endif
if not cc.has_header_symbol('sys/types.h', 'major')
if cc.has_header_symbol('sys/mkdev.h', 'major')
conf.set('MAJOR_IN_MKDEV', true)
conf.set('MAJOR_IN_SYSMACROS', false)
elif cc.has_header_symbol('sys/sysmacros.h', 'major')
conf.set('MAJOR_IN_SYSMACROS', true)
conf.set('MAJOR_IN_MKDEV', false)
else
error('failed to find "major" macro')
endif
endif
if host_machine.system() == 'linux'
conf.set('USE_READDIR_R', false)
conf.set('READLINKAT_EMPTY_PATH', true)
else
conf.set('USE_READDIR_R', true)
conf.set('READLINKAT_EMPTY_PATH', false)
endif
# /* #undef CONFIG_BIG_ENDIAN */
want_dmthin = get_option('dmthin')
want_rbd = get_option('rbd')
want_zvol = get_option('zvol')
libglib2 = dependency('glib-2.0',
required : ( want_dmthin == 'true' or
want_rbd == 'true'
)
)
want_doc = get_option('doc')
if want_doc != 'false'
rst2man = find_program('rst2man', required : want_doc == 'true')
have = rst2man.found()
else
rst2man = []
have = rst2man.found()
endif
want_doc = have
if want_dmthin != 'false'
libdevmapper = dependency('devmapper',
required : want_dmthin == 'true')
have = libdevmapper.found()
else
have = false
libdevmapper = []
endif
want_dmthin = have
conf.set10('HAVE_DEVMAPPER', have)
if want_rbd != 'false'
required = want_rbd == 'true'
librbd = cc.find_library('rbd', required : required)
librados = cc.find_library('rados', required : required)
if required and not (librbd.found() and librados.found())
error('librbd support not available')
endif
have = librbd.found()
else
have = false
librbd = []
librados = []
endif
want_rbd = have
conf.set10('HAVE_RBD', have)
if want_zvol != 'false'
libzfs = dependency('libzfs', required : want_zvol == 'true')
have = libzfs.found()
if have
libzpool = cc.find_library('zpool')
libnvpair = cc.find_library('nvpair')
endif
else
have = false
libzfs = []
libzpool = []
libnvpair = []
endif
want_zvol = have
conf.set10('HAVE_ZFS', have)
config_h = configure_file(
output : 'config.h',
configuration : conf)
add_project_arguments('-include', 'config.h', language : 'c')
subdir('doc')
subdir('include')
subdir('lib')
subdir('libfies-dmthin')
subdir('src')
subdir('tests')