-
Notifications
You must be signed in to change notification settings - Fork 22
/
CMakeLists.txt
203 lines (179 loc) · 5.29 KB
/
CMakeLists.txt
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
cmake_minimum_required(VERSION 3.10)
# Enable group projects in folders
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "cmake")
project(piranha)
set(CMAKE_CXX_STANDARD 17)
# =========================================================
# GTEST
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
set_property(TARGET gmock PROPERTY FOLDER "gtest")
set_property(TARGET gmock_main PROPERTY FOLDER "gtest")
set_property(TARGET gtest PROPERTY FOLDER "gtest")
set_property(TARGET gtest_main PROPERTY FOLDER "gtest")
# =========================================================
# FLEX BISON
find_package(FLEX REQUIRED)
find_package(BISON REQUIRED)
flex_target(
lexer
flex-bison/scanner.l
${CMAKE_CURRENT_BINARY_DIR}/scanner.auto.cpp
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/scanner.auto.h)
bison_target(
parser
flex-bison/specification.y
${CMAKE_CURRENT_BINARY_DIR}/parser.auto.cpp
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.auto.h)
add_flex_bison_dependency(lexer parser)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(dependencies/libraries/flex/include)
include_directories(include)
add_library(piranha STATIC
# Source files
src/assembly.cpp
src/channel_node.cpp
src/channel_type.cpp
src/compilation_error.cpp
src/compiler.cpp
src/error_list.cpp
src/float_conversions.cpp
src/fundamental_types.cpp
src/int_conversions.cpp
src/ir_attribute.cpp
src/ir_attribute_definition.cpp
src/ir_attribute_definition_list.cpp
src/ir_attribute_list.cpp
src/ir_binary_operator.cpp
src/ir_compilation_unit.cpp
src/ir_context_tree.cpp
src/ir_import_statement.cpp
src/ir_node.cpp
src/ir_node_definition.cpp
src/ir_parser_structure.cpp
src/ir_unary_operator.cpp
src/ir_value.cpp
src/language_rules.cpp
src/memory_tracker.cpp
src/node.cpp
src/node_allocator.cpp
src/node_container.cpp
src/node_graph.cpp
src/node_output.cpp
src/node_program.cpp
src/no_op_node.cpp
src/path.cpp
src/standard_allocator.cpp
src/string_conversions.cpp
src/vector_constructor.cpp
# Header files
include/piranha.h
include/add_operation_output.h
include/assembly.h
include/bool_negate_operation.h
include/build_settings.h
include/channel_node.h
include/channel_type.h
include/compilation_error.h
include/compiler.h
include/console_input_node.h
include/console_output_node.h
include/default_literal_node.h
include/divide_operation_output.h
include/error_list.h
include/exceptions.h
include/float_conversions.h
include/fundamental_output.h
include/fundamental_types.h
include/int_conversions.h
include/int_probe.h
include/ir_attribute.h
include/ir_attribute_definition.h
include/ir_attribute_definition_list.h
include/ir_attribute_list.h
include/ir_binary_operator.h
include/ir_compilation_unit.h
include/ir_context_tree.h
include/ir_import_statement.h
include/ir_literal_node.h
include/ir_node.h
include/ir_node_definition.h
include/ir_parser_structure.h
include/ir_structure_list.h
include/ir_token_info.h
include/ir_unary_operator.h
include/ir_value.h
include/ir_value_constant.h
include/ir_visibility.h
include/key_value_lookup.h
include/language_rules.h
include/literal_node.h
include/literal_node_output.h
include/memory_management.h
include/memory_tracker.h
include/multiply_operation_output.h
include/node.h
include/node_allocator.h
include/node_container.h
include/node_graph.h
include/node_output.h
include/node_program.h
include/no_op_node.h
include/num_negate_operation.h
include/operation_node.h
include/path.h
include/pipe_node.h
include/pkey_value_lookup.h
include/rule.h
include/scanner.h
include/standard_allocator.h
include/string_conversions.h
include/subtract_operation_output.h
include/throw_runtime_error_node.h
include/vector_constructor.h
include/vector_output.h
include/vector_split.h
include/vector_split_node.h
include/version.h
# Autogen
${BISON_parser_OUTPUTS}
${FLEX_lexer_OUTPUTS}
)
add_executable(piranha_reference_compiler
# Source files
demos/main.cpp
demos/reference_language_rules.cpp
demos/utilities.cpp
# Include files
demos/utilities.h
demos/reference_language_rules.h
)
target_link_libraries(piranha_reference_compiler piranha)
# gtest
enable_testing()
add_executable(piranha_test
test/compilation_tests.cpp
test/general_tests.cpp
test/operator_tests.cpp
test/optimization_tests.cpp
test/runtime_tests.cpp
test/sdl_stress_tests.cpp
test/sdl_tests.cpp
test/test_rules.cpp
test/utilities.cpp
)
target_link_libraries(piranha_test
gtest_main
piranha
)
include(GoogleTest)
gtest_discover_tests(piranha_test)
set_property(TARGET piranha PROPERTY FOLDER "piranha")
set_property(TARGET piranha_reference_compiler PROPERTY FOLDER "piranha")
set_property(TARGET piranha_test PROPERTY FOLDER "piranha")