-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
62 lines (52 loc) · 1.47 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
project('wrapper_c', 'cpp', version : 'v0.1')
subdir('src')
compiler = meson.get_compiler('cpp').get_id()
build_type = get_option('buildtype')
command = run_command('date', check: false)
if command.returncode() == 0
compiled_time = command.stdout().strip()
else
compiled_time = ''
endif
message('compiled time: ' + compiled_time)
command = run_command('git', 'show', '--format=%H', '--no-patch', check: false)
if command.returncode() == 0
commit_id = command.stdout().strip()
else
commit_id = ''
endif
message('commit id: ' + commit_id)
includes = include_directories('include')
flags = [
'-DVERSION="@0@"'.format(meson.project_version()),
'-DBUILD_TYPE="@0@"'.format(build_type),
'-DCOMPILED_TIME="@0@"'.format(compiled_time),
'-DCOMMIT_ID="@0@"'.format(commit_id),
]
flags += ['-std=c++17', '-g']
flags += ['-Werror', '-Wall', '-Wextra', '-Wpedantic']
link_flags = []
if host_machine.system() == 'linux'
if build_type.startswith('debug')
flags += ['-fsanitize=address', '-fno-omit-frame-pointer']
link_flags += ['-Wl,-Bstatic', '-lasan', '-Wl,-Bdynamic']
elif build_type.startswith('release')
link_flags += ['-static']
endif
endif
executable(
meson.project_name(),
srcs,
include_directories: includes,
cpp_args: flags,
link_args: link_flags,
install: true
)
install_data(
[
'scripts/wrapper_make',
'scripts/wrapper_gcc',
'scripts/wrapper_g++'
],
install_dir: 'bin'
)