-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
83 lines (70 loc) · 2.13 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
project(
'short-circuit',
['c', 'cpp'],
version: '0.1.0-alpha',
default_options: [
'c_std=c11',
'warning_level=2',
'buildtype=debug',
'b_ndebug=if-release',
'default_library=static'
]
)
# TODO: Library rework and tests.
c = meson.get_compiler('c')
sc_common_flags = [
'-DSC_VERSION="' + meson.project_version() + '"',
'-Dtypeof=__typeof__',
'-D_XOPEN_SOURCE=700'
]
sc_c_flags = []
if get_option('profile')
sc_common_flags += '-DPROFILE'
endif
# NOTE: If this ever goes cross-platform, this will need to support other syntaxes.
sc_flags_wanted = ['-fstack-protector', '-fstack-clash-protection']
add_project_arguments(c.get_supported_arguments(sc_flags_wanted), language: 'c')
sc_warnings_wanted = [
'-Wdisabled-optimization', '-Wduplicated-branches', '-Wduplicated-cond', '-Wfloat-equal',
'-Wformat-nonliteral', '-Wformat-security', '-Wlogical-op', '-Wmissing-declarations',
'-Wmissing-include-dirs', '-Wnull-dereference', '-Wpacked', '-Wshadow', '-Wstack-protector',
'-Wundef', '-Wcast-align', '-Wbad-function-cast', '-Wimplicit', '-Wmissing-prototypes',
'-Wnested-externs', '-Wstrict-prototypes'
]
sc_c_flags += c.get_supported_arguments(sc_warnings_wanted)
if (c.get_id() != 'gcc' or not c.version().startswith('9'))
# -Wconversion is too aggressive on GCC <= 9.
sc_c_flags += c.get_supported_arguments(['-Wconversion'])
endif
sc_include = include_directories('src')
sc_src = files(
[
'src/main.c',
'src/event/init.c',
'src/event/mod.c',
'src/event/handle.c',
'src/file.c',
'src/connection.c',
'src/http/connection.c',
'src/http/headers.c',
'src/http/parse.c',
'src/http/request.c',
'src/http/response.c',
'src/http/types.c',
'src/listen.c',
'src/timeout.c',
'src/uri.c'
]
)
liburing = dependency('liburing')
a3 = dependency('a3', fallback: ['a3', 'a3_dep'])
a3_hash = dependency('a3_hash', fallback: ['a3', 'a3_hash_dep'])
sc = executable(
'sc',
sc_src,
include_directories: sc_include,
dependencies: [liburing, a3, a3_hash],
c_args: sc_c_flags + sc_common_flags,
gnu_symbol_visibility: 'hidden',
build_by_default: true
)