-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
meson.build
104 lines (93 loc) · 2.67 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
project('libdemangle', 'c', meson_version: '>=0.49.0')
cc = meson.get_compiler('c')
common_c_args = []
libdemangle_c_args = []
libdemangle_src = [
'src' / 'cxx' / 'borland.c',
'src' / 'cxx.c',
'src' / 'demangler.c',
'src' / 'demangler_util.c',
'src' / 'java.c',
'src' / 'microsoft_demangle.c',
'src' / 'msvc.c',
'src' / 'objc.c',
'src' / 'pascal' / 'pascal.c',
'src' / 'rust' / 'punycode.c',
'src' / 'rust' / 'rust.c',
'src' / 'rust' / 'rust_legacy.c',
'src' / 'rust' / 'rust_v0.c',
]
tests = [
'borland',
'java',
'msvc',
'objc',
'pascal',
'rust',
]
if get_option('use_gpl')
libdemangle_src += 'src' / 'cxx' / 'cp-demangle.c'
libdemangle_src += 'src' / 'gnu_v2' / 'cplus-dem.c'
common_c_args += '-DWITH_GPL=1'
tests += 'cxx'
tests += 'cxx_base'
tests += 'cxx_gnu_v2'
endif
if get_option('use_swift_demangler')
libdemangle_src += 'src' / 'swift.c'
common_c_args += '-DWITH_SWIFT_DEMANGLER=1'
tests += 'swift'
endif
if get_option('default_library') == 'shared'
if cc.has_argument('-fvisibility=hidden')
libdemangle_c_args += '-fvisibility=hidden'
endif
endif
if cc.has_argument('--std=gnu99')
add_project_arguments('--std=gnu99', language: 'c')
elif cc.has_argument('--std=c99')
add_project_arguments('--std=c99', language: 'c')
endif
libdemangle = library('demangle', libdemangle_src,
c_args : common_c_args + libdemangle_c_args,
dependencies: [],
implicit_include_directories: false,
install: get_option('install_lib'),
include_directories: include_directories(['include', 'src']))
libdemangle_dep = declare_dependency(
link_with: libdemangle,
dependencies: [],
include_directories: include_directories('include'),
)
if get_option('enable_cli')
bin_demangle = [
'bin' / 'demangle.c',
]
executable('demangle', bin_demangle,
c_args : common_c_args,
dependencies: [libdemangle_dep],
include_directories: include_directories(['include', 'src']),
implicit_include_directories: false,
install: true,
)
endif
if get_option('enable_tests') and not meson.is_subproject()
test_dependencies = [libdemangle_dep]
if get_option('b_sanitize').contains('address')
test_dependencies += cc.find_library('asan')
endif
if get_option('b_sanitize').contains('undefined')
test_dependencies += cc.find_library('ubsan')
endif
foreach test : tests
exe = executable('test_@0@'.format(test), 'test/test_@[email protected]'.format(test),
include_directories: include_directories(['include', 'test']),
dependencies: test_dependencies,
c_args : common_c_args,
install: false,
install_rpath: '',
implicit_include_directories: false
)
test(test, exe)
endforeach
endif