-
Notifications
You must be signed in to change notification settings - Fork 1
/
meson.build
74 lines (65 loc) · 1.43 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
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2023 SUSE LLC Andrea Cervesato <[email protected]>
project(
'ltp-core',
'c',
license : 'GPL-2.0+',
version : '20230929',
default_options : [
'c_std=gnu99',
'warning_level=2',
'buildtype=debugoptimized',
],
meson_version: '>=1.2.3'
)
###########################
# Compiler arguments
###########################
add_project_arguments(
[
'-DLTPLIB',
'-pipe',
'-W',
'-fno-strict-aliasing',
'-Wold-style-definition',
],
language : 'c'
)
compiler = meson.get_compiler('c')
code = '''
#include <stdio.h>
int main(void)
{
#if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
return 0;
#else
# error Compiling without optimizations
#endif
}
'''
if compiler.compiles(code, name : 'whether to define _FORTIFY_SOURCE=2')
add_project_arguments('-D_FORTIFY_SOURCE=2', language : 'c')
endif
###########################
# Build library
###########################
ltp_sources = files()
ltp_dependences = []
subdir('include')
subdir('lib')
ltp_include_dir = include_directories(
'include',
'include/old'
)
ltp_library = library(
'ltp',
ltp_sources,
include_directories : ltp_include_dir,
dependencies: ltp_dependences,
link_args : ['-lrt'],
install : true,
install_dir : 'lib',
)
if get_option('build_tests')
subdir('lib/tests')
endif