-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
91 lines (74 loc) · 5.5 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
cmake_minimum_required(VERSION 3.23)
project(TrustLangInterpreter)
if (CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
execute_process(
COMMAND brew --prefix bison
RESULT_VARIABLE BREW_BISON
OUTPUT_VARIABLE BREW_BISON_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (BREW_BISON EQUAL 0 AND EXISTS "${BREW_BISON_PREFIX}")
message(STATUS "Found Bison keg installed by Homebrew at ${BREW_BISON_PREFIX}")
set(BISON_EXECUTABLE "${BREW_BISON_PREFIX}/bin/bison")
endif ()
execute_process(
COMMAND brew --prefix flex
RESULT_VARIABLE BREW_FLEX
OUTPUT_VARIABLE BREW_FLEX_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (BREW_FLEX EQUAL 0 AND EXISTS "${BREW_FLEX_PREFIX}")
message(STATUS "Found Flex keg installed by Homebrew at ${BREW_FLEX_PREFIX}")
set(FLEX_EXECUTABLE "${BREW_FLEX_PREFIX}/bin/flex")
endif ()
include_directories(/usr/local/opt/flex/include/)
endif ()
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
set(
HEADERS
${TrustLangInterpreter_SOURCE_DIR}/driver.hh
${TrustLangInterpreter_SOURCE_DIR}/parser.hh
)
BISON_TARGET(
MyParser
parser.y
${TrustLangInterpreter_SOURCE_DIR}/parser.cpp
COMPILE_FLAGS "--graph -Wcounterexamples"
DEFINES_FILE ${TrustLangInterpreter_SOURCE_DIR}/parser.hh
)
FLEX_TARGET(
MyScanner
scanner.l
${TrustLangInterpreter_SOURCE_DIR}/scanner.cpp
)
ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -fpermissive -g -std=c++20 -fmax-errors=10 -Wall -Wextra -Weffc++ -Waggressive-loop-optimizations -Wc++0x-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual -Wchar-subscripts -Wconditionally-supported -Wconversion -Wctor-dtor-privacy -Wempty-body -Wfloat-equal -Wformat-nonliteral -Wformat-security -Wformat-signedness -Wformat=2 -Winline -Wlarger-than=8192 -Wlogical-op -Wmissing-declarations -Wnon-virtual-dtor -Wopenmp-simd -Woverloaded-virtual -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstack-usage=8192 -Wstrict-null-sentinel -Wstrict-overflow=2 -Wsuggest-attribute=noreturn -Wsuggest-final-methods -Wsuggest-final-types -Wsuggest-override -Wswitch-default -Wswitch-enum -Wsync-nand -Wundef -Wunreachable-code -Wunused -Wuseless-cast -Wvariadic-macros -Wno-literal-suffix -Wno-missing-field-initializers -Wno-narrowing -Wno-old-style-cast -Wno-varargs -fcheck-new -fsized-deallocation -fstack-check -fstack-protector -fstrict-overflow -fno-omit-frame-pointer -fPIE -fsanitize=address -fsanitize=alignment -fsanitize=bool -fsanitize=bounds -fsanitize=enum -fsanitize=float-cast-overflow -fsanitize=float-divide-by-zero -fsanitize=integer-divide-by-zero -fsanitize=leak -fsanitize=nonnull-attribute -fsanitize=null -fsanitize=object-size -fsanitize=return -fsanitize=returns-nonnull-attribute -fsanitize=shift -fsanitize=signed-integer-overflow -fsanitize=undefined -fsanitize=unreachable -fsanitize=vla-bound -fsanitize=vptr -lm -pie")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -std=c++20")
add_executable(
TrustLangInterpreter
help/Expressions/OrExpression.cpp help/Expressions/AndExpression.cpp help/Expressions/EqualExpression.cpp
help/Expressions/NotEqualExpression.cpp help/Expressions/GreaterEqExpression.cpp
help/Expressions/GreaterExpression.cpp help/Expressions/LessEqExpression.cpp help/Expressions/LessExpression.cpp
help/Expressions/NotExpression.cpp help/Expressions/AsExpression.cpp help/Expressions/DivExpression.cpp
help/Expressions/ModExpression.cpp help/Expressions/MulExpression.cpp help/Expressions/UnaryMinusExpression.cpp
help/Expressions/PlusExpression.cpp help/Expressions/MinusExpression.cpp help/Expressions/IDExpression.cpp
help/Expressions/FunctionCall.cpp help/Expressions/SubscriptionExpression.cpp
help/Expressions/VectorEnumerationExpression.cpp help/Expressions/SizeExpression.cpp
help/Expressions/VectorValueExpression.cpp
help/Statements/ExpressionList.cpp help/Statements/PrintStatement.cpp
help/Statements/Interruptions/BreakStatement.cpp help/Statements/Interruptions/ContinueStatement.cpp
help/Statements/Interruptions/Interruptions.cpp help/Statements/WhileStatement.cpp
help/Statements/IfStatement.cpp help/Statements/IfElseStatement.cpp help/Statements/AssignmentStatement.cpp
help/Statements/VariableDeclInit.cpp help/Visitor.cpp help/Statements/Statements.cpp help/Program.cpp
help/Statements/VariableDeclaration.cpp help/Statements/ForStatement.cpp
help/Statements/TypelessVariableDecl.cpp help/Statements/Interruptions/ReturnStatement.cpp
help/Statements/SubscriptionAssignment.cpp help/Statements/PushStatement.cpp
help/Statements/PopStatement.cpp help/Statements/ForIterableStatement.cpp
help/Types/Boolean.cpp help/Types/Integer.cpp help/Types/String.cpp help/Types/Float.cpp help/Types/Object.cpp
help/Types/Usize.cpp help/Types/Char.cpp help/Types/Vector.cpp
help/InterpretationExceptions/InterpretationExceptions.cpp
help/Identifiers/IDTable.cpp help/Identifiers/Identifier.cpp help/Functions/FunctionsTable.cpp
help/Functions/FunctionDeclarationList.cpp help/Functions/FunctionDeclaration.cpp help/Functions/ParamList.cpp
main.cpp driver.cpp ${BISON_MyParser_OUTPUTS} ${FLEX_MyScanner_OUTPUTS})
target_include_directories(TrustLangInterpreter PRIVATE ${TrustLangInterpreter_SOURCE_DIR})