-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
132 lines (122 loc) · 5.82 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
cmake_minimum_required(VERSION 3.26)
project(LoxCpp)
set(CMAKE_CXX_STANDARD 20)
add_compile_options(-gdwarf-4)
add_library(LoxLib LoxLib/src
LoxLib/src/Lox
LoxLib/src/Lox/DataStructures
LoxLib/src/Lox/DataStructures/Chunk.cpp
LoxLib/src/Lox/DataStructures/LinesArray.cpp
LoxLib/src/Lox/Compiler
LoxLib/src/Lox/Compiler/Compilers/Compiler.cpp
LoxLib/src/Lox/Compiler/Scanning/Token.cpp
LoxLib/src/Lox/Compiler/Scanning/SourcePosition.cpp
LoxLib/src/Lox/Compiler/Scanning/TokenType.cpp
LoxLib/src/Lox/Compiler/Scanning/Scanner.cpp
LoxLib/src/Lox/Stages
LoxLib/src/Lox/Stages/ChunkOptimizer.cpp
LoxLib/src/Lox/Runtime
LoxLib/src/Lox/Runtime/Value.cpp
LoxLib/src/Lox/Runtime/Nil.cpp
LoxLib/src/Lox/Runtime/ValueType.cpp
LoxLib/src/Lox/Interpreter
LoxLib/src/Lox/Interpreter/VirtualMachineConfiguration.cpp
LoxLib/src/Lox/Interpreter/Exceptions
LoxLib/src/Lox/Interpreter/Exceptions/ZeroDivision.cpp
LoxLib/src/Lox/Interpreter/Exceptions/StackOverflow.cpp
LoxLib/src/Lox/Interpreter/Exceptions/StackUnderflow.cpp
LoxLib/src/Lox/Interpreter/Exceptions/RuntimeException.cpp
LoxLib/src/Lox/Interpreter/Exceptions/UnknownInstruction.cpp
LoxLib/src/Lox/Interpreter/CallFrame.cpp
LoxLib/src/Lox/Interpreter/Opcode.cpp
LoxLib/src/Lox/Interpreter/VirtualMachine.cpp
LoxLib/src/Lox/Util
LoxLib/src/Lox/Util/Assert.cpp
LoxLib/src/Lox/Stages/ChunkChecker.cpp
LoxLib/src/Lox/Util/ChunkDumper.cpp
LoxLib/src/Lox/Util/ChunkWriter.cpp
LoxLib/src/Lox/Util/ChunkReader.cpp
LoxLib/include/Lox/Stages/Exceptions/OptimizerFailure.hpp
LoxLib/src/Lox/Stages/Exceptions/OptimizerFailure.cpp
LoxLib/include/Lox/Runtime/ObjectType.hpp
LoxLib/src/Lox/Runtime/ObjectType.cpp
LoxLib/include/Lox/Runtime/Object.hpp
LoxLib/include/Lox/Runtime/GcPtr.hpp
LoxLib/src/Lox/Runtime/Object.cpp
LoxLib/include/Lox/Runtime/Objects/String.hpp
LoxLib/src/Lox/Runtime/Objects/String.cpp
LoxLib/include/Lox/Runtime/PrintFlags.hpp
LoxLib/include/Lox/Runtime/MemoryManager.hpp
LoxLib/src/Lox/Runtime/MemoryManager.cpp
LoxLib/include/Lox/Interpreter/Exceptions/WrongType.hpp
LoxLib/include/Lox/Interpreter/Exceptions/UndefinedVariable.hpp
LoxLib/src/Lox/Interpreter/Exceptions/UndefinedVariable.cpp
LoxLib/include/Lox/Interpreter/Exceptions/InvalidStackAccess.hpp
LoxLib/src/Lox/Interpreter/Exceptions/InvalidStackAccess.cpp
LoxLib/include/Lox/Interpreter/Exceptions/All.hpp
LoxLib/include/Lox/Runtime/Objects/Closure.hpp
LoxLib/src/Lox/Runtime/Objects/Closure.cpp
LoxLib/src/Lox/Compiler/Compilers/Compiler.hpp
LoxLib/src/Lox/Compiler/Compiler.cpp
LoxLib/src/Lox/Compiler/Parsing/Parser.hpp
LoxLib/src/Lox/Compiler/Parsing/Parser.cpp
LoxLib/src/Lox/Compiler/Parsing/Precedence.hpp
LoxLib/src/Lox/Compiler/Parsing/ParserRule.hpp
LoxLib/src/Lox/Compiler/Parsing/ParserRule.cpp
LoxLib/include/Lox/Interpreter/Exceptions/NonCallable.hpp
LoxLib/src/Lox/Interpreter/Exceptions/NonCallable.cpp
LoxLib/include/Lox/Interpreter/Exceptions/WrongArgumentsCount.hpp
LoxLib/src/Lox/Interpreter/Exceptions/WrongArgumentsCount.cpp
LoxLib/include/Lox/Runtime/Objects/Native.hpp
LoxLib/src/Lox/Runtime/Objects/Native.cpp
LoxLib/include/Lox/Interpreter/StackIterator.hpp
LoxLib/include/Lox/Util/OptionalReference.hpp
LoxLib/include/Lox/Util/StackedBoolean.hpp
LoxLib/src/Lox/Util/StackedBoolean.cpp
LoxLib/include/Lox/Runtime/Objects/Upvalue.hpp
LoxLib/src/Lox/Runtime/Objects/Upvalue.cpp
LoxLib/include/Lox/Runtime/RootsSource.hpp
LoxLib/include/Lox/Runtime/Objects/Class.hpp
LoxLib/src/Lox/Runtime/Objects/Class.cpp
LoxLib/include/Lox/Runtime/Objects/Instance.hpp
LoxLib/src/Lox/Runtime/Objects/Instance.cpp
LoxLib/include/Lox/Interpreter/Exceptions/UndefinedProperty.hpp
LoxLib/src/Lox/Interpreter/Exceptions/UndefinedProperty.cpp
LoxLib/src/Lox/Compiler/Compilers/ScopedValueChange.hpp
LoxLib/src/Lox/Compiler/Compilers/FunctionType.hpp
LoxLib/src/Lox/Compiler/Compilers/ClassCompiler.hpp
LoxLib/src/Lox/Compiler/Compilers/ClassCompiler.cpp
LoxLib/include/Lox/Runtime/Objects/BoundMethod.hpp
LoxLib/src/Lox/Runtime/Objects/BoundMethod.cpp
)
set_target_properties(LoxLib PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(LoxLib PRIVATE LoxLib/include)
add_executable(LoxInterpreter
LoxInterpreter/src
LoxInterpreter/src/main.cpp
LoxInterpreter/src/Natives.hpp
LoxInterpreter/src/ErrorCode.hpp
LoxInterpreter/src/Natives.cpp)
target_link_libraries(LoxInterpreter LoxLib)
set_target_properties(LoxInterpreter PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(LoxInterpreter PRIVATE LoxLib/include)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
enable_testing()
add_executable(LoxGoogleTest
LoxGoogleTest/src/ValueTest.cpp
LoxGoogleTest/src/ScannerTest.cpp
LoxGoogleTest/src/CompilerTest.cpp
LoxGoogleTest/src/CheckerTest.cpp
LoxGoogleTest/src/ChunkRwTest.cpp
LoxGoogleTest/src/OptimizerTest.cpp
LoxGoogleTest/src/VmTest.cpp)
target_link_libraries(LoxGoogleTest GTest::gtest_main LoxLib)
target_include_directories(LoxGoogleTest PRIVATE LoxLib/include)
include(GoogleTest)
gtest_discover_tests(LoxGoogleTest)