-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmeson.build
107 lines (86 loc) · 2.69 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
project('vctool', 'c', 'cpp',
version : '0.4.3-snapshot',
default_options : ['c_std=gnu11', 'cpp_std=c++14', 'buildtype=release'],
meson_version : '>=0.53.0'
)
message('Using build type: ' + get_option('buildtype'))
force_velo_toolchain = get_option('force_velo_toolchain')
# TODO: Move this into mesons built in warning level.
add_project_arguments('-Wall', '-Werror', '-Wextra', language : 'c')
add_project_arguments('-Wall', '-Werror', '-Wextra', language : 'cpp')
flex = find_program('flex', required : true)
bison = find_program('bison', required : true)
lgen = generator(
flex,
output : ['@PLAINNAME@.yy.c', '@BASENAME@.yy.h'],
arguments : ['--header-file=@OUTPUT1@', '-o', '@OUTPUT0@', '@INPUT@']
)
ygen = generator(
bison,
output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@']
)
endorse_lfiles = lgen.process('src/lib/endorse/endorse.l')
endorse_yfiles = ygen.process('src/lib/endorse/endorse.y')
src_not_main = run_command(
'find', './src', '(', '-name', '*.c', '-or', '-name', '*.h' , ')',
'!', '-name', 'main.c',
check : true
).stdout().strip().split('\n')
test_src = run_command(
'find', './test', '-name', '*.cpp', '-or', '-name', '*.h',
check : true
).stdout().strip().split('\n')
lib_src = run_command(
'find', './src/lib', '-name', '*.c',
check : true
).stdout().strip().split('\n')
vcblockchain = dependency(
'vcblockchain',
required : true,
fallback : ['vcblockchain', 'vcblockchain_dep']
)
vccrypt = dependency(
'vccrypt',
required : true,
fallback : ['vccrypt', 'vccrypt_dep']
)
vccrypt_sub = subproject('vccrypt')
vccrypt_mock_lib = vccrypt_sub.get_variable('vccrypt_mock_lib')
cmake = import('cmake')
minunit_proj = cmake.subproject('minunit')
minunit = minunit_proj.dependency('minunit')
threads = dependency('threads')
vctool_include = include_directories('include')
vctool_exe = executable(
'vctool',
'./src/vctool/main.c',
src_not_main,
endorse_lfiles, endorse_yfiles,
include_directories : vctool_include,
dependencies : [threads, vcblockchain]
)
vctool_test = executable(
'vctool-test',
src_not_main,
endorse_lfiles, endorse_yfiles,
test_src,
include_directories : vctool_include,
dependencies : [threads, vcblockchain, vccrypt, minunit],
link_with : [vccrypt_mock_lib]
)
vctool_lib = static_library(
'vctool',
lib_src,
endorse_lfiles, endorse_yfiles,
include_directories : vctool_include,
dependencies : [vcblockchain]
)
vctool_dep = declare_dependency(
link_with : vctool_lib,
include_directories : vctool_include
)
test(
'vctool-test',
vctool_test,
)