-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
110 lines (84 loc) · 2.83 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
project('volts', ['cpp', 'c'],
default_options : [
'cpp_std=c++17',
'cpp_rtti=false',
'cpp_eh=none',
# as the VC 2019 runtime isnt shipped by default on windows we need to link it statically
# this stops those weird dll errors that lead to downloading some random dll
# and shoving it into system32
'b_vscrt=mt',
'default_library=static',
'werror=true',
# TODO: we will need to replace xxhash and zlib at some point
# as they trigger all kinds of warnings at higher levels
#'warning_level=3'
],
version : '0.2.1',
license : 'Apache'
)
if host_machine.system() == 'darwin'
add_languages('objcpp')
endif
# TODO: using cpp_eh=none makes meson do funky stuff on windows, feels like a bug, should report
if meson.get_compiler('cpp').get_id() == 'msvc'
add_global_arguments(['/D_HAS_EXCEPTIONS=0'],
language : ['cpp', 'c']
)
endif
# collect all the dependencies that lots of things share
zlib = dependency('zlib', fallback : [ 'zlib', 'zlib_dep' ])
spdlog_opts = [
'enable_tests=false',
'enable_examples=false',
'no_exceptions=true',
'no_thread_id=true',
'no_tls=true'
]
if host_machine.system() == 'windows'
spdlog_opts += 'wchar_support=true'
endif
spdlog = subproject('spdlog', default_options : spdlog_opts).get_variable('spdlog_dep')
xxhash = subproject('xxhash').get_variable('xxhash_dep')
aes = subproject('aes').get_variable('aes_dep')
svl = subproject('svl').get_variable('svl_dep')
elf = subproject('elf').get_variable('elf_dep')
cxxopts = subproject('cxxopts').get_variable('cxxopts_dep')
glm = subproject('glm').get_variable('glm_dep')
toml = subproject('toml').get_variable('tomlplusplus_dep')
links = []
sources = []
dependencies = [ aes, xxhash, svl, elf, cxxopts, spdlog, zlib, glm, toml ]
cpp_args = [ '-DFMT_EXCEPTIONS=0' ]
include_directories = []
if host_machine.system() == 'darwin'
dependencies += dependency('appleframeworks', modules : [ 'Cocoa', 'Foundation' ])
endif
if host_machine.system() != 'windows'
cpp_args += [ '-std=c++17' ]
endif
if host_machine.system() == 'linux'
links += [ '-lstdc++fs' ]
endif
subdir('volts')
libvolts = library('volts', sources,
cpp_args : cpp_args,
objcpp_args : cpp_args,
include_directories : include_directories,
dependencies : dependencies,
link_args : links
)
cli = executable('cli', 'volts/cli.cpp',
cpp_args : cpp_args,
objcpp_args : cpp_args,
include_directories : include_directories,
dependencies : dependencies,
link_with : libvolts,
link_args : links
)
if get_option('gui').enabled()
# subdir('volts/gui'/host_machine.system())
endif
doxygen = find_program('doxygen', required : false)
if doxygen.found()
run_target('docs', command : [doxygen, meson.source_root()/'Doxyfile'])
endif