forked from openbmc/libpldm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeson.build
More file actions
121 lines (104 loc) · 2.98 KB
/
meson.build
File metadata and controls
121 lines (104 loc) · 2.98 KB
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
project(
'libpldm',
'c',
default_options: {
'debug': true,
'optimization': 'g',
'warning_level': '3',
'werror': true,
'cpp_std': 'c++23',
'c_std': 'c17',
'b_ndebug': 'if-release',
'tests': not meson.is_subproject(),
},
version: '0.15.0',
meson_version: '>=1.4.0',
)
if get_option('bindings').contains('cpp') or get_option('tests')
add_languages('cpp', native: false)
endif
# For memmem() in src/msgbuf.h
add_project_arguments('-D_GNU_SOURCE', language: ['c'])
cc = meson.get_compiler('c')
if cc.has_argument('-Wvla')
add_project_arguments('-Wvla', language: ['c'])
endif
if get_option('bindings').contains('cpp') or get_option('tests')
cpp = meson.get_compiler('cpp')
endif
# avoid using different compilers across C/C++
if get_option('bindings').contains('cpp')
if (cc.get_id() != cpp.get_id())
error(
'unsupported combination: C compiler: ' + cc.get_id() + ' C++ compiler: ' + cpp.get_id(),
)
endif
if get_option('tests') and cpp.get_id() == 'gcc'
# when building tests, also dump class layout for inspection
add_project_arguments('-fdump-lang-class', language: ['cpp'])
endif
endif
conf = configuration_data()
conf.set10(
'HAVE_LIBPLDM_ABI_DEPRECATED',
get_option('abi').contains('deprecated'),
)
conf.set10('HAVE_LIBPLDM_ABI_TESTING', get_option('abi').contains('testing'))
if cc.has_header('linux/mctp.h')
conf.set10(
'HAVE_STRUCT_MCTP_FQ_ADDR',
cc.has_type(
'struct mctp_fq_addr',
prefix: '#include <linux/mctp.h>',
),
description: 'Is struct mctp_fq_addr available?',
)
endif
config = configure_file(
input: 'config.h.in',
output: 'config.h',
configuration: conf,
)
add_project_arguments('-include', config.full_path(), language: ['c', 'cpp'])
libpldm_deprecated_aliases = []
include_root = include_directories('include', is_system: true)
subdir('include')
subdir('src')
if get_option('bindings').contains('cpp')
subdir('bindings/cpp')
endif
subdir('tools')
doxygen = find_program('doxygen', required: false)
if doxygen.found()
doxydata = configuration_data()
doxydata.set('description', meson.project_name())
doxydata.set('project', meson.project_name())
doxydata.set('version', meson.project_version())
doxydata.set(
'sources',
'@0@ @1@'.format(
meson.project_source_root() / 'include',
meson.project_source_root() / 'src',
),
)
doxyfile = configure_file(
input: 'Doxyfile.in',
output: 'Doxyfile',
configuration: doxydata,
install: false,
)
docs = custom_target(
'docs',
input: doxyfile,
output: 'doxygen',
command: [doxygen, doxyfile],
)
endif
if get_option('tests')
subdir('tests')
endif
install_subdir(
'instance-db',
install_mode: 'r--r--r--',
install_dir: get_option('datadir') / meson.project_name(),
)