-
Notifications
You must be signed in to change notification settings - Fork 3
/
meson.build
104 lines (92 loc) · 2.29 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
project('htcpp', 'cpp', default_options : ['warning_level=3', 'cpp_std=c++20'])
threads_dep = dependency('threads')
openssl_dep = dependency('openssl', required : false)
clipp_dep = dependency('clipp', fallback : ['clipp', 'clipp_dep'])
cpprom_dep = dependency('cpprom', fallback : ['cpprom', 'cpprom_dep'], default_options : [ 'single_threaded=true' ])
joml_cpp_dep = dependency('joml-cpp', fallback : ['joml-cpp', 'joml_cpp_dep'])
liburingpp_dep = dependency('liburingpp', fallback : ['liburingpp', 'liburingpp_dep'])
minijson_dep = dependency('minijson', fallback : ['minijson', 'minijson_dep'])
flags = []
lib_src = [
'src/client.cpp',
'src/events.cpp',
'src/fd.cpp',
'src/filecache.cpp',
'src/filewatcher.cpp',
'src/http.cpp',
'src/ioqueue.cpp',
'src/log.cpp',
'src/metrics.cpp',
'src/pattern.cpp',
'src/router.cpp',
'src/server.cpp',
'src/string.cpp',
'src/tcp.cpp',
'src/tokenbucket.cpp',
'src/time.cpp',
'src/util.cpp',
]
if openssl_dep.found()
lib_src += [
'src/acme.cpp',
'src/ssl.cpp',
]
flags += '-DTLS_SUPPORT_ENABLED'
endif
htcpp_lib_deps = [
threads_dep,
openssl_dep,
cpprom_dep,
liburingpp_dep,
minijson_dep,
]
# This is not really clean, but it's a start
htcpp_inc = include_directories('src')
htcpp_lib = static_library('htcpp', lib_src,
cpp_args : flags,
include_directories : htcpp_inc,
dependencies : htcpp_lib_deps,
)
htcpp_dep = declare_dependency(
compile_args : flags,
include_directories : htcpp_inc,
link_with : htcpp_lib,
# Not quite sure why I need this: https://github.com/mesonbuild/meson/issues/10543
dependencies : htcpp_lib_deps,
)
bin_src = [
'src/config.cpp',
'src/hosthandler.cpp',
'src/htcpp.cpp',
]
executable('htcpp', bin_src,
cpp_args : flags,
include_directories : ['src'],
dependencies : [
htcpp_dep,
clipp_dep,
joml_cpp_dep,
],
)
if get_option('build_libexample')
executable('libexample', 'src/libexample.cpp',
cpp_args : flags,
include_directories : ['src'],
dependencies : [
htcpp_dep,
],
)
endif
if get_option('build_unittests')
unittests_src = [
'unittests/main.cpp',
'unittests/time.cpp',
]
executable('unittests', unittests_src,
cpp_args : flags,
include_directories : ['src'],
dependencies : [
htcpp_dep,
],
)
endif