-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
53 lines (47 loc) · 1.55 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
project(
'okra-packed',
'c',
'cpp',
version: '0.0.0',
default_options: [ 'c_std=c11', 'cpp_std=gnu++11' ]
)
# Import binary helpers
python = find_program('python3', required: false)
objcopy = '@0@'.format(find_program('objcopy').path())
size = '@0@'.format(find_program('size').path())
# Startup and system files
c_args = [ '-Os' ]
# link_args = '-Wl,-T,@0@/@1@'.format(meson.current_source_dir(), 'linker.ld')
# Add src dependancies
subdir('src')
packed_inc = get_variable('packed_inc')
packed_src = get_variable('packed_src')
subdir('example')
example_inc = get_variable('example_inc')
example_src = get_variable('example_src')
# Generate elf file for MCU
main_elf = executable(
'main',
[ packed_src, example_src ],
include_directories : [ packed_inc, example_inc ],
cpp_args : [ c_args ],
c_args : [ c_args ],
)
# Add CppUTest dependancy
cpputest = subproject('cpputest')
cpputest_dep = cpputest.get_variable('cpputest_dep')
# Build native test executable
subdir('test')
test_src = get_variable('test_src')
main_test = executable(
'tests',
[ packed_src, test_src ],
include_directories : [ packed_inc ],
dependencies : [ cpputest_dep ],
native : true,
build_by_default : false
)
test('packed test', main_test)
# Custom run commands
run_target('lint', command: [ python, '.clang-format.py', '-r', '-e', 'src', 'src' ])
run_target('fix', command: [ python, '.clang-format.py', '-r', '-s', '-e', 'src', 'src' ])