-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathmeson.build
More file actions
122 lines (106 loc) · 3.05 KB
/
meson.build
File metadata and controls
122 lines (106 loc) · 3.05 KB
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
project('ant', ['c', 'cpp'], default_options: [
'buildtype=release',
'optimization=3',
'c_std=gnu23',
'cpp_std=gnu++23',
'default_library=static',
'b_lto=true',
'b_lto_threads=8',
'strip=true',
'warning_level=2'
], subproject_dir: 'vendor')
python = find_program('python3')
is_static = get_option('static_link')
src_root = meson.project_source_root()
include = include_directories('include')
subdir('meson')
messages_h = custom_target('messages_h',
input: 'src/core/messages.toml',
output: 'messages.h',
command: [python, files('meson/messages.py'), '@INPUT@'],
capture: true,
)
theme_h = custom_target('theme_h',
input: 'src/highlight/theme.toml',
output: 'theme.h',
command: [python, files('meson/theme.py'), '@INPUT@'],
capture: true,
)
lib_sources = files(run_command(
python, files('meson/sources.py'), files('sources.json'), 'engine',
check: true
).stdout().strip().split())
libant = static_library(
'ant',
lib_sources + [
builtin_bundle_h,
snapshot_h,
messages_h,
theme_h
],
install: true,
include_directories: include,
dependencies: ant_deps
)
pkg_lib = custom_target(
'pkg_zig',
output: 'libpkg.a',
command: [
'sh', '-c',
'"$ZIG" build --build-file "$PKG_ZIG_DIR/build.zig" --prefix "$PKG_BUILD_DIR" && cp "$PKG_BUILD_DIR/lib/$PKG_LIB_NAME" "@OUTPUT@"'
],
env: {
'ZIG': zig.full_path(),
'ANT_VERSION': ant_version,
'PKG_ZIG_DIR': pkg_zig_dir, 'PKG_BUILD_DIR': pkg_build_dir,
'LMDB_INCLUDE': lmdb_include_path, 'ZLIB_INCLUDE': zlib_include_path,
'LIBUV_INCLUDE': libuv_include_path, 'YYJSON_INCLUDE': yyjson_include_path,
'PKG_TARGET': host_machine.cpu_family() + '-' + host_machine.system(),
'PKG_LIB_NAME': host_machine.system() == 'windows' ? 'pkg.lib' : 'libpkg.a',
},
build_by_default: true,
build_always_stale: true
)
pkg_dep = declare_dependency(
link_with: [pkg_lib],
include_directories: include,
dependencies: [lmdb_dep, tlsuv_dep, libuv_dep, nghttp2_dep]
)
libant_dep = declare_dependency(
link_with: libant,
include_directories: include,
dependencies: ant_deps + [oxc_dep, pkg_dep]
)
link_args = []
if get_option('static_link')
link_args += ['-static']
endif
ant_link_args = link_args
if host_machine.system() == 'windows'
ant_link_args += ['-Wl,--stack,134217728']
elif host_machine.system() == 'darwin'
ant_link_args += ['-Wl,-stack_size,0x2000000']
else
ant_link_args += ['-Wl,-z,stack-size=134217728']
endif
if get_option('linker_map')
ant_linkmap = meson.project_build_root() + '/ant.linkmap'
if host_machine.system() == 'darwin'
ant_link_args += ['-Wl,-map,' + ant_linkmap]
else
ant_link_args += ['-Wl,-Map=' + ant_linkmap]
endif
endif
executable(
'ant',
files('src/main.c', 'src/watch.c') + [messages_h],
dependencies: libant_dep,
link_args: ant_link_args,
export_dynamic: true
)
executable(
'tlsuv-boringssl-smoke',
files('tests/tlsuv_boringssl_smoke.c'),
dependencies: [tlsuv_dep, libuv_dep, llhttp, zlib_dep] + (host_machine.system() == 'darwin' ? [security_dep] : []),
build_by_default: false
)