-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathmeson.build
More file actions
144 lines (129 loc) · 4.47 KB
/
Copy pathmeson.build
File metadata and controls
144 lines (129 loc) · 4.47 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
project('AppStream Generator', 'cpp',
meson_version : '>=1.0',
default_options : ['c_std=c23', 'cpp_std=c++23'],
subproject_dir : 'contrib/subprojects',
license : 'LGPL-3.0+',
version : '0.10.3'
)
asgen_version = meson.project_version()
source_root = meson.project_source_root()
build_root = meson.project_build_root()
cxx = meson.get_compiler('cpp')
fs = import('fs')
#
# Dependencies
#
src_dir = include_directories('src/')
glib_dep = dependency('glib-2.0', version: '>= 2.80')
appstream_dep = dependency('appstream', version: '>= 1.1.0')
ascompose_dep = dependency('appstream-compose', version: '>= 1.1.0')
lmdb_dep = dependency('lmdb', version: '>= 0.9.22')
archive_dep = dependency('libarchive', version: '>= 3.2')
curl_dep = dependency('libcurl')
fyaml_dep = dependency('libfyaml', version: '>= 0.9.2')
tbb_dep = dependency('tbb')
icu_dep = dependency('icu-uc')
libxml2_dep = dependency('libxml-2.0') # for rpmmd
catch2_dep = dependency('catch2-with-main')
nljson_dep = dependency('nlohmann_json', version: '>= 3.11.2')
quill_dep = dependency('quill', version: '>= 11.1', fallback: ['quill', 'quill_dep']).as_system()
inja_dep = dependency('inja', version: '>= 3.5.0',
fallback: ['inja', 'inja_dep'], default_options: ['build_tests=false']).as_system()
backward_deps = []
backward_dep = dependency('', required: false)
if get_option('backward')
backward_dep = dependency('backward-cpp', fallback: ['backward-cpp', 'backward_dep'], required: false).as_system()
if backward_dep.found()
message('Using backward-cpp for stack traces')
libunwind_dep = dependency('libunwind')
backward_deps = [backward_dep, libunwind_dep]
endif
endif
# Ensure we have a compiler that can handle the C++23 features we need
if cxx.get_id() == 'gcc'
if not cxx.version().version_compare('>=14.0')
error('GCC 14 or newer is required to build this project')
endif
elif cxx.get_id() == 'clang'
if not cxx.version().version_compare('>=18.0')
error('Clang 18 or newer is required to build this project')
endif
# Clang/libc++ needs an additional flag to enable some experimental stuff
add_project_arguments('-fexperimental-library', language: 'cpp')
endif
#
# Compiler flags
#
if get_option('maintainer')
maintainer_c_args = [
'-Werror',
'-Wall',
'-Wextra',
'-Wcast-align',
'-Wno-uninitialized',
'-Wempty-body',
'-Wformat-security',
'-Winit-self',
'-Wnull-dereference',
'-Wmaybe-uninitialized',
]
maintainer_cpp_args = [
'-Wsuggest-final-methods'
]
add_project_arguments(maintainer_c_args, language: 'c')
add_project_arguments([maintainer_c_args, maintainer_cpp_args], language: 'cpp')
endif
# a few compiler warning/error flags we always want enabled
add_project_arguments(
'-Werror=shadow',
'-Werror=empty-body',
'-Werror=missing-prototypes',
'-Werror=implicit-function-declaration',
'-Werror=missing-declarations',
'-Werror=return-type',
'-Werror=int-conversion',
'-Werror=incompatible-pointer-types',
'-Werror=misleading-indentation',
'-Werror=format-security',
'-Wno-missing-field-initializers',
'-Wno-error=missing-field-initializers',
'-Wno-unused-parameter',
'-Wno-error=unused-parameter',
language: 'c'
)
add_project_arguments(
cxx.get_supported_arguments([
'-Werror=empty-body',
'-Werror=pointer-arith',
'-Werror=missing-declarations',
'-Werror=return-type',
'-Werror=misleading-indentation',
'-Werror=format-security',
'-Werror=suggest-override',
'-Wno-missing-field-initializers',
'-Wno-error=missing-field-initializers',
'-Wno-unused-parameter',
'-Wno-error=unused-parameter',
]),
language: 'cpp'
)
#
# Download JS stuff and additional sources if we couldn't find them
#
if get_option('download-js')
npm_exe = find_program('npm')
if not fs.is_dir(source_root / 'data' / 'templates' / 'default' / 'static' / 'js')
message('Downloading JavaScript libraries...')
getjs_cmd = run_command([source_root + '/contrib/setup/build_js.sh', npm_exe], check: false)
if getjs_cmd.returncode() != 0
error('Unable to download JavaScript files with NPM:\n' + getjs_cmd.stdout() + getjs_cmd.stderr())
endif
endif
endif
#
# Subdirs
#
subdir('src')
subdir('data')
subdir('tests')
subdir('docs')