-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
71 lines (62 loc) · 1.67 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
project(
'TuringCompiler',
['cpp'],
version: '0.0.0',
default_options: [
'cpp_std=c++2a',
'buildtype=debugoptimized',
]
)
cpp = meson.get_compiler('cpp')
# ANTLR setup
flex_exec = find_program('flex')
bison_exec = find_program('bison')
flex_gen = generator(flex_exec,
output: [
],
arguments: ['--header-file=@BUILD_DIR@/@[email protected]', '-o', '@BUILD_DIR@/@[email protected]', '@INPUT@']
)
bison_gen = generator(bison_exec,
output: [
],
arguments: ['--header=@BUILD_DIR@/@[email protected]', '-o', '@BUILD_DIR@/@[email protected]', '-rall', '@INPUT@']
)
bison_sources = bison_gen.process('grammar/turingc.y')
flex_sources = flex_gen.process('grammar/turingc.l')
# Final executable
sources = [
'src/backend/instr.cpp',
'src/backend/turingcompiler.cpp',
'src/backend/turingstate.cpp',
'src/output/binarywriter.cpp',
'src/utils.cpp'
]
sources_asm = [
'src/assembler/parser.cpp',
'src/assembler/main.cpp'
]
sources_c = [
'src/frontend/asmgen.cpp',
'src/frontend/ast.cpp',
'src/frontend/main.cpp',
'src/frontend/semcheck.cpp',
'src/frontend/symtab.cpp'
]
executable(
'turingasm',
[sources, sources_asm],
install: true,
build_by_default: true,
include_directories: [include_directories('include')]
)
executable(
'turingc',
[sources, sources_c, bison_sources, flex_sources],
install: true,
build_by_default: true,
include_directories: [include_directories('include')]
)