forked from ValveSoftware/GameNetworkingSockets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
120 lines (103 loc) · 2.73 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
project('GameNetworkingSockets', 'cpp', 'c',
default_options: [
'buildtype=debugoptimized',
],
license: 'BSD'
)
flags_common = [
'-fno-strict-aliasing',
'-fvisibility=hidden',
]
target_os = target_machine.system()
if target_os == 'windows'
flags_common += [
'-fno-stack-protector',
]
else
flags_common += [
'-fstack-protector-strong',
'-fstack-clash-protection',
]
endif
flags_cxx = [
'-fno-rtti',
'-fno-exceptions',
'-fvisibility-inlines-hidden',
]
warn_flags_common = [
'-Wall',
'-Wextra',
# Explicitly disable noisy warnings
'-Wno-documentation',
'-Wno-implicit-fallthrough',
'-Wno-padded',
'-Wno-sign-compare',
'-Wno-sign-conversion',
'-Wno-signed-enum-bitfield',
'-Wno-unknown-pragmas',
'-Wno-unused-const-variable',
'-Wno-unused-local-typedef',
'-Wno-unused-parameter',
'-Wno-nested-anon-types',
]
werror = get_option('Werror')
if werror
warn_flags_common += [ '-Werror' ]
endif
use_crypto_25519 = get_option('use_crypto25519')
if use_crypto_25519 == 'Reference'
warn_flags_common += [ '-Wno-unused-function' ]
endif
warn_flags_c = [
'-Wimplicit',
'-Wstrict-prototypes',
'-Wno-missing-prototypes',
]
warn_flags_cxx = [
'-Wno-c++98-compat',
'-Wno-c++98-compat-pedantic',
'-Wno-exit-time-destructors',
'-Wno-global-constructors',
'-Wno-non-virtual-dtor',
'-Wno-old-style-cast',
'-Wno-reorder',
# These ones are prolific but don't really matter. Most are in generated
# protobuf code.
'-Wno-zero-as-null-pointer-constant',
'-Wno-missing-variable-declarations',
]
c_compiler = meson.get_compiler('c')
cxx_compiler = meson.get_compiler('cpp')
c_flags = []
c_flags += c_compiler.first_supported_argument(['-std=c11', '-std=gnu99'])
foreach arg : flags_common + warn_flags_common + warn_flags_c
if c_compiler.has_argument(arg)
c_flags += [ arg ]
endif
endforeach
add_project_arguments(c_flags, language: 'c')
cxx_flags = []
cxx_flags += cxx_compiler.first_supported_argument(['-std=c++11', '-std=c++0x'])
foreach arg : flags_common + warn_flags_common + flags_cxx + warn_flags_cxx
if cxx_compiler.has_argument(arg)
cxx_flags += [ arg ]
endif
endforeach
add_project_arguments(cxx_flags, language: 'cpp')
# Preprocessor defines for platform and compiler
cpp_flags = []
if target_os == 'linux'
cpp_flags += ['-DPOSIX', '-DLINUX']
elif target_os == 'darwin'
cpp_flags += ['-DPOSIX', '-DOSX']
elif target_os == 'windows'
cpp_flags += ['-D_WIN32', '-DWIN32', '-D__STDC_FORMAT_MACROS=1', '-D__USE_MINGW_ANSI_STDIO=0']
else
error('Could not identify your target operating system')
endif
add_project_arguments(cpp_flags, language: 'c')
add_project_arguments(cpp_flags, language: 'cpp')
dep_threads = dependency('threads')
subdir('src')
subdir('tests')
subdir('examples')