This repository has been archived by the owner on May 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
meson.build
124 lines (103 loc) · 2.33 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
project(
'pbcopper',
['cpp', 'c'],
version : '2.3.99',
default_options : [
'buildtype=release',
'warning_level=3',
'cpp_std=c++20',
'c_std=c17',
'b_ndebug=if-release'],
license : 'BSD-3',
meson_version : '>= 0.57.0')
############
# CXXFLAGS #
############
pbcopper_cpp_test_flags = [
'-Wduplicated-cond',
'-Wduplicated-branches',
'-Wlogical-op',
'-Wrestrict',
'-Wdouble-promotion',
'-Wshadow',
'-Wformat=1',
]
pbcopper_cpp_flags = []
cpp = meson.get_compiler('cpp')
foreach cflag: pbcopper_cpp_test_flags
if cpp.has_argument(cflag)
pbcopper_cpp_flags += cflag
endif
endforeach
pbcopper_arch_flags = {
# ARM64 (ARMv8-A, Apple M1)
'aarch64': [
'-march=armv8.2-a',
],
'x86_64': [
'-msse4.1',
],
}
pbcopper_c_test_flags = [
'-Wc++-compat',
'-Wno-unused-parameter',
'-Wno-unused-variable',
'-Wno-sign-compare',
'-Wno-unused-but-set-variable'
] + pbcopper_arch_flags.get(host_machine.cpu_family(), [])
pbcopper_c_flags = []
c = meson.get_compiler('c')
foreach cflag: pbcopper_c_test_flags
if c.has_argument(cflag)
pbcopper_c_flags += cflag
endif
endforeach
################
# dependencies #
################
# threads
pbcopper_thread_dep = dependency('threads')
# boost
pbcopper_boost_dep = dependency('boost', include_type : 'system')
###########
# headers #
###########
subdir('include')
#####################
# sources + library #
#####################
subdir('src')
###############
# third-party #
###############
subdir('third-party')
##########
# extras #
##########
if not meson.is_subproject()
# documentation
if get_option('build-docs')
subdir('docs')
endif
# tests
if get_option('tests')
pbcopper_clang_formatter = find_program('tools/check-formatting')
subdir('tests')
endif
endif
###################
# dependency info #
###################
if not meson.is_subproject()
import('pkgconfig').generate(
libraries : pbcopper_lib,
version : meson.project_version(),
name : 'pbcopper',
filebase : 'pbcopper',
description : 'C++ library providing a suite of data structures, algorithms, and utilities')
endif
pbcopper_dep = declare_dependency(
include_directories : pbcopper_include_directories,
link_with : pbcopper_lib,
dependencies : [pbcopper_thread_dep, pbcopper_boost_dep],
version : meson.project_version())