This repository has been archived by the owner on Feb 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathCMakeLists.txt
454 lines (442 loc) · 23.9 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# Although flex option nounistd works fine for the generated cpp file, we need
# to make sure this is also set for the header.
set_property(
DIRECTORY
APPEND PROPERTY COMPILE_DEFINITIONS YY_NO_UNISTD_H
)
find_package(BISON)
if (BISON_FOUND)
if (BISON_VERSION VERSION_GREATER 2.4 OR BISON_VERSION VERSION_EQUAL 2.4)
set(RUN_BISON TRUE)
else()
set(RUN_BISON FALSE)
message(WARNING "You are using a version of bison which is too old to build quickstep's "
"parser. A preprocessed copy of the parser sources will be used.")
endif()
else()
set(RUN_BISON FALSE)
message(WARNING "Unable to find bison. A preprocessed copy of the parser sources will be used.")
endif()
find_package(FLEX)
if (FLEX_FOUND)
# TODO(chasseur): This might not be the exact version to test for.
if (FLEX_VERSION VERSION_GREATER 2.5.38)
set(RUN_FLEX TRUE)
else()
set(RUN_FLEX FALSE)
message(WARNING "You are using a version of flex which is too old to build quickstep's lexer. "
"A preprocessed copy of the lexer sources will be used.")
endif()
else()
set(RUN_FLEX FALSE)
message(WARNING "Unable to find flex. A preprocessed copy of the lexer sources will be used.")
endif()
if (RUN_BISON)
BISON_TARGET(SqlParser SqlParser.ypp ${CMAKE_CURRENT_BINARY_DIR}/SqlParser_gen.cpp)
else()
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/preprocessed/SqlParser_gen.hpp DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/preprocessed/SqlParser_gen.cpp DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
set(BISON_SqlParser_OUTPUTS
${CMAKE_CURRENT_BINARY_DIR}/SqlParser_gen.cpp
${CMAKE_CURRENT_BINARY_DIR}/SqlParser_gen.hpp)
endif()
if (RUN_FLEX)
FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.hpp" LEXER_HEADER_FILE)
FLEX_TARGET(SqlLexer SqlLexer.lpp ${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.cpp
COMPILE_FLAGS "-i -I --header-file=${LEXER_HEADER_FILE}")
if (RUN_BISON)
ADD_FLEX_BISON_DEPENDENCY(SqlLexer SqlParser)
endif()
else()
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/preprocessed/SqlLexer_gen.hpp DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/preprocessed/SqlLexer_gen.cpp DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
set(FLEX_SqlLexer_OUTPUTS
${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.cpp
${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.hpp)
if (RUN_BISON)
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.hpp
${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.cpp
PROPERTIES OBJECT_DEPENDS ${BISON_SqlParser_OUTPUT_HEADER})
endif()
endif()
# Declare micro-libs:
add_library(quickstep_parser_ParseAssignment ../empty_src.cpp ParseAssignment.hpp)
add_library(quickstep_parser_ParseAttributeDefinition ParseAttributeDefinition.cpp ParseAttributeDefinition.hpp)
add_library(quickstep_parser_ParseBasicExpressions ParseBasicExpressions.cpp ParseBasicExpressions.hpp)
add_library(quickstep_parser_ParseBlockProperties ParseBlockProperties.cpp ParseBlockProperties.hpp)
add_library(quickstep_parser_ParseCaseExpressions ParseCaseExpressions.cpp ParseCaseExpressions.hpp)
add_library(quickstep_parser_ParseExpression ../empty_src.cpp ParseExpression.hpp)
add_library(quickstep_parser_ParseGeneratorTableReference
ParseGeneratorTableReference.cpp
ParseGeneratorTableReference.hpp)
add_library(quickstep_parser_ParseGroupBy ParseGroupBy.cpp ParseGroupBy.hpp)
add_library(quickstep_parser_ParseHaving ParseHaving.cpp ParseHaving.hpp)
add_library(quickstep_parser_ParseIndexProperties ParseIndexProperties.cpp ParseIndexProperties.hpp)
add_library(quickstep_parser_ParseJoinedTableReference ParseJoinedTableReference.cpp ParseJoinedTableReference.hpp)
add_library(quickstep_parser_ParseKeyValue ../empty_src.cpp ParseKeyValue.hpp)
add_library(quickstep_parser_ParseLimit ParseLimit.cpp ParseLimit.hpp)
add_library(quickstep_parser_ParseLiteralValue ParseLiteralValue.cpp ParseLiteralValue.hpp)
add_library(quickstep_parser_ParseOrderBy ParseOrderBy.cpp ParseOrderBy.hpp)
add_library(quickstep_parser_ParsePartitionClause ../empty_src.cpp ParsePartitionClause.hpp)
add_library(quickstep_parser_ParsePredicate ParsePredicate.cpp ParsePredicate.hpp)
add_library(quickstep_parser_ParsePredicateExists ../empty_src.cpp ParsePredicateExists.hpp)
add_library(quickstep_parser_ParsePredicateInTableQuery ../empty_src.cpp ParsePredicateInTableQuery.hpp)
add_library(quickstep_parser_ParsePriority ../empty_src.cpp ParsePriority.hpp)
add_library(quickstep_parser_ParseSample ParseSample.cpp ParseSample.hpp)
add_library(quickstep_parser_ParseSelect ../empty_src.cpp ParseSelect.hpp)
add_library(quickstep_parser_ParseSelectionClause ParseSelectionClause.cpp ParseSelectionClause.hpp)
add_library(quickstep_parser_ParseSetOperation ../empty_src.cpp ParseSetOperation.hpp)
add_library(quickstep_parser_ParseSimpleTableReference ParseSimpleTableReference.cpp ParseSimpleTableReference.hpp)
add_library(quickstep_parser_ParseStatement ../empty_src.cpp ParseStatement.hpp)
add_library(quickstep_parser_ParseString ParseString.cpp ParseString.hpp)
add_library(quickstep_parser_ParseSubqueryExpression ParseSubqueryExpression.cpp ParseSubqueryExpression.hpp)
add_library(quickstep_parser_ParseSubqueryTableReference
ParseSubqueryTableReference.cpp
ParseSubqueryTableReference.hpp)
add_library(quickstep_parser_ParseTableReference ParseTableReference.cpp ParseTableReference.hpp)
add_library(quickstep_parser_ParseTreeNode ../empty_src.cpp ParseTreeNode.hpp)
add_library(quickstep_parser_ParseWindow ../empty_src.cpp ParseWindow.hpp)
add_library(quickstep_parser_ParserUtil ParserUtil.cpp ParserUtil.hpp)
add_library(quickstep_parser_SqlLexer ${FLEX_SqlLexer_OUTPUTS})
add_library(quickstep_parser_SqlParser ${BISON_SqlParser_OUTPUTS})
add_library(quickstep_parser_SqlParserWrapper SqlParserWrapper.cpp SqlParserWrapper.hpp)
# Link dependencies:
target_link_libraries(quickstep_parser_ParseAssignment
quickstep_parser_ParseExpression
quickstep_parser_ParseString
quickstep_parser_ParseTreeNode
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParseAttributeDefinition
quickstep_parser_ParseString
quickstep_parser_ParseTreeNode
quickstep_types_Type
quickstep_utility_Macros
quickstep_utility_PtrList)
target_link_libraries(quickstep_parser_ParseBasicExpressions
quickstep_parser_ParseExpression
quickstep_parser_ParseLiteralValue
quickstep_parser_ParseString
quickstep_parser_ParseTreeNode
quickstep_parser_ParseWindow
quickstep_types_operations_binaryoperations_BinaryOperation
quickstep_types_operations_unaryoperations_UnaryOperation
quickstep_utility_Macros
quickstep_utility_PtrList)
target_link_libraries(quickstep_parser_ParseBlockProperties
glog
quickstep_parser_ParseKeyValue
quickstep_parser_ParseString
quickstep_parser_ParseTreeNode
quickstep_utility_Macros
quickstep_utility_PtrList
quickstep_utility_SqlError
quickstep_utility_StringUtil)
target_link_libraries(quickstep_parser_ParseCaseExpressions
quickstep_parser_ParseExpression
quickstep_parser_ParsePredicate
quickstep_parser_ParseTreeNode
quickstep_utility_Macros
quickstep_utility_PtrVector)
target_link_libraries(quickstep_parser_ParseExpression
quickstep_parser_ParseTreeNode
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParseGeneratorTableReference
quickstep_parser_ParseBasicExpressions
quickstep_parser_ParseTableReference
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParseGroupBy
quickstep_parser_ParseExpression
quickstep_parser_ParseTreeNode
quickstep_utility_Macros
quickstep_utility_PtrList)
target_link_libraries(quickstep_parser_ParseHaving
quickstep_parser_ParsePredicate
quickstep_parser_ParseTreeNode
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParseIndexProperties
glog
quickstep_parser_ParseKeyValue
quickstep_parser_ParseString
quickstep_parser_ParseTreeNode
quickstep_storage_StorageBlockLayout_proto
quickstep_utility_Macros
quickstep_utility_PtrList
quickstep_utility_StringUtil)
target_link_libraries(quickstep_parser_ParseJoinedTableReference
glog
quickstep_parser_ParsePredicate
quickstep_parser_ParseTableReference
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParseKeyValue
quickstep_parser_ParseLiteralValue
quickstep_parser_ParseString
quickstep_parser_ParseTreeNode
quickstep_utility_Macros
quickstep_utility_PtrList)
target_link_libraries(quickstep_parser_ParseLimit
quickstep_parser_ParseLiteralValue
quickstep_parser_ParseTreeNode
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParseLiteralValue
glog
quickstep_parser_ParseString
quickstep_parser_ParseTreeNode
quickstep_types_DatetimeIntervalType
quickstep_types_DoubleType
quickstep_types_IntType
quickstep_types_LongType
quickstep_types_NullType
quickstep_types_Type
quickstep_types_TypedValue
quickstep_types_VarCharType
quickstep_types_YearMonthIntervalType
quickstep_utility_Macros
quickstep_utility_SqlError)
target_link_libraries(quickstep_parser_ParseOrderBy
quickstep_parser_ParseExpression
quickstep_parser_ParseTreeNode
quickstep_utility_Macros
quickstep_utility_PtrList)
target_link_libraries(quickstep_parser_ParsePartitionClause
quickstep_parser_ParseLiteralValue
quickstep_parser_ParseString
quickstep_parser_ParseTreeNode
quickstep_utility_Macros
quickstep_utility_PtrList)
target_link_libraries(quickstep_parser_ParsePredicate
quickstep_parser_ParseExpression
quickstep_parser_ParseTreeNode
quickstep_types_operations_comparisons_Comparison
quickstep_utility_Macros
quickstep_utility_PtrList)
target_link_libraries(quickstep_parser_ParsePredicateExists
quickstep_parser_ParsePredicate
quickstep_parser_ParseSubqueryExpression
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParsePredicateInTableQuery
quickstep_parser_ParseExpression
quickstep_parser_ParsePredicate
quickstep_parser_ParseSubqueryExpression
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParsePriority
quickstep_parser_ParseLiteralValue
quickstep_parser_ParseTreeNode
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParseSample
quickstep_parser_ParseLiteralValue
quickstep_parser_ParseTreeNode
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParseSelect
glog
quickstep_parser_ParseGroupBy
quickstep_parser_ParseHaving
quickstep_parser_ParseLimit
quickstep_parser_ParseOrderBy
quickstep_parser_ParsePredicate
quickstep_parser_ParseSelectionClause
quickstep_parser_ParseTableReference
quickstep_parser_ParseTreeNode
quickstep_parser_ParseWindow
quickstep_utility_Macros
quickstep_utility_PtrList)
target_link_libraries(quickstep_parser_ParseSelectionClause
quickstep_parser_ParseExpression
quickstep_parser_ParseString
quickstep_parser_ParseTreeNode
quickstep_utility_Macros
quickstep_utility_PtrList)
target_link_libraries(quickstep_parser_ParseSetOperation
glog
quickstep_parser_ParseTreeNode
quickstep_utility_Macros
quickstep_utility_PtrList)
target_link_libraries(quickstep_parser_ParseSimpleTableReference
quickstep_parser_ParseSample
quickstep_parser_ParseString
quickstep_parser_ParseTableReference
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParseStatement
glog
quickstep_parser_ParseAssignment
quickstep_parser_ParseAttributeDefinition
quickstep_parser_ParseBasicExpressions
quickstep_parser_ParseBlockProperties
quickstep_parser_ParseIndexProperties
quickstep_parser_ParseKeyValue
quickstep_parser_ParsePartitionClause
quickstep_parser_ParsePredicate
quickstep_parser_ParsePriority
quickstep_parser_ParseSelect
quickstep_parser_ParseSetOperation
quickstep_parser_ParseString
quickstep_parser_ParseSubqueryTableReference
quickstep_parser_ParseTreeNode
quickstep_storage_StorageBlockInfo
quickstep_utility_Macros
quickstep_utility_PtrList
quickstep_utility_PtrVector)
target_link_libraries(quickstep_parser_ParseString
quickstep_parser_ParseTreeNode
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParseSubqueryExpression
glog
quickstep_parser_ParseExpression
quickstep_parser_ParseSetOperation
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParseSubqueryTableReference
quickstep_parser_ParseSubqueryExpression
quickstep_parser_ParseTableReference
quickstep_utility_Macros)
target_link_libraries(quickstep_parser_ParseTableReference
quickstep_parser_ParseString
quickstep_parser_ParseTreeNode
quickstep_utility_Macros
quickstep_utility_PtrList)
target_link_libraries(quickstep_parser_ParseTreeNode
quickstep_utility_Macros
quickstep_utility_TreeStringSerializable)
target_link_libraries(quickstep_parser_ParseWindow
quickstep_parser_ParseExpression
quickstep_parser_ParseOrderBy
quickstep_parser_ParseString
quickstep_parser_ParseTreeNode
quickstep_utility_PtrList)
target_link_libraries(quickstep_parser_ParserUtil
quickstep_utility_SqlError)
target_link_libraries(quickstep_parser_SqlLexer
quickstep_parser_ParseJoinedTableReference
quickstep_parser_ParseLiteralValue
quickstep_parser_ParseString
quickstep_parser_ParserUtil
quickstep_parser_SqlParser
quickstep_utility_PtrList
quickstep_utility_PtrVector)
target_link_libraries(quickstep_parser_SqlParser
quickstep_catalog_PartitionSchemeHeader
quickstep_parser_ParseAssignment
quickstep_parser_ParseAttributeDefinition
quickstep_parser_ParseBasicExpressions
quickstep_parser_ParseBlockProperties
quickstep_parser_ParseCaseExpressions
quickstep_parser_ParseExpression
quickstep_parser_ParseGeneratorTableReference
quickstep_parser_ParseGroupBy
quickstep_parser_ParseHaving
quickstep_parser_ParseJoinedTableReference
quickstep_parser_ParseKeyValue
quickstep_parser_ParseLimit
quickstep_parser_ParseLiteralValue
quickstep_parser_ParseOrderBy
quickstep_parser_ParsePartitionClause
quickstep_parser_ParsePredicate
quickstep_parser_ParsePredicateExists
quickstep_parser_ParsePredicateInTableQuery
quickstep_parser_ParsePriority
quickstep_parser_ParseSample
quickstep_parser_ParseSelect
quickstep_parser_ParseSelectionClause
quickstep_parser_ParseSetOperation
quickstep_parser_ParseSimpleTableReference
quickstep_parser_ParseStatement
quickstep_parser_ParseString
quickstep_parser_ParseSubqueryExpression
quickstep_parser_ParseSubqueryTableReference
quickstep_parser_ParseTableReference
quickstep_parser_ParseWindow
quickstep_parser_ParserUtil
quickstep_storage_StorageBlockInfo
quickstep_types_Type
quickstep_types_TypeFactory
quickstep_types_TypeID
quickstep_types_operations_binaryoperations_BinaryOperation
quickstep_types_operations_binaryoperations_BinaryOperationFactory
quickstep_types_operations_binaryoperations_BinaryOperationID
quickstep_types_operations_comparisons_Comparison
quickstep_types_operations_comparisons_ComparisonFactory
quickstep_types_operations_comparisons_ComparisonID
quickstep_types_operations_unaryoperations_UnaryOperation
quickstep_types_operations_unaryoperations_UnaryOperationFactory
quickstep_types_operations_unaryoperations_UnaryOperationID
quickstep_utility_PtrList
quickstep_utility_PtrVector)
target_link_libraries(quickstep_parser_SqlParserWrapper
glog
quickstep_parser_ParseJoinedTableReference
quickstep_parser_ParseStatement
quickstep_parser_SqlLexer
quickstep_parser_SqlParser
quickstep_utility_Macros
quickstep_utility_SqlError)
# Dependencies on generated sources.
set_property(SOURCE SqlParserWrapper.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SqlParser_gen.hpp)
# The dependency is on the header, but this picks up the generated sources
# from the CMake environment.
set_property(SOURCE SqlParserWrapper.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.cpp)
set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/SqlParser_gen.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.cpp)
# Lexers generated by some versions of Flex use the C "register" keyword. This
# supresses warnings about that for the lexer ONLY.
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-Wno-deprecated-register" COMPILER_HAS_WNO_DEPRECATED_REGISTER)
if (COMPILER_HAS_WNO_DEPRECATED_REGISTER)
set_target_properties(quickstep_parser_SqlLexer PROPERTIES COMPILE_FLAGS "-Wno-deprecated-register")
endif()
# GCC will make a warning for unsigned-signed comparisons which are inherent
# in the lexer. For this, we turn off the sign compare.
set_target_properties(quickstep_parser_SqlLexer PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
add_subdirectory(tests)
# Module all-in-one library:
add_library(quickstep_parser ../empty_src.cpp ParserModule.hpp)
target_link_libraries(quickstep_parser
quickstep_parser_ParseAssignment
quickstep_parser_ParseAttributeDefinition
quickstep_parser_ParseBasicExpressions
quickstep_parser_ParseBlockProperties
quickstep_parser_ParseCaseExpressions
quickstep_parser_ParseExpression
quickstep_parser_ParseGeneratorTableReference
quickstep_parser_ParseGroupBy
quickstep_parser_ParseHaving
quickstep_parser_ParseIndexProperties
quickstep_parser_ParseJoinedTableReference
quickstep_parser_ParseKeyValue
quickstep_parser_ParseLimit
quickstep_parser_ParseLiteralValue
quickstep_parser_ParseOrderBy
quickstep_parser_ParsePartitionClause
quickstep_parser_ParsePredicate
quickstep_parser_ParsePredicateExists
quickstep_parser_ParsePredicateInTableQuery
quickstep_parser_ParsePriority
quickstep_parser_ParseSample
quickstep_parser_ParseSelect
quickstep_parser_ParseSelectionClause
quickstep_parser_ParseSetOperation
quickstep_parser_ParseSimpleTableReference
quickstep_parser_ParseStatement
quickstep_parser_ParseString
quickstep_parser_ParseSubqueryExpression
quickstep_parser_ParseSubqueryTableReference
quickstep_parser_ParseTableReference
quickstep_parser_ParseTreeNode
quickstep_parser_ParseWindow
quickstep_parser_ParserUtil
quickstep_parser_SqlLexer
quickstep_parser_SqlParser
quickstep_parser_SqlParserWrapper)