-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
90 lines (76 loc) · 2.74 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
cmake_minimum_required(VERSION 3.12)
project(px)
set(CMAKE_CXX_STANDARD 17)
# Code Coverage Configuration
add_library(coverage_config INTERFACE)
option(CODE_COVERAGE "Enable coverage reporting" OFF)
if(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
# Add required flags (GCC & LLVM/Clang)
target_compile_options(coverage_config INTERFACE
-O0 # no optimization
-g # generate debug info
--coverage # sets all required flags
)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
target_link_options(coverage_config INTERFACE --coverage)
else()
target_link_libraries(coverage_config INTERFACE --coverage)
endif()
endif(CODE_COVERAGE)
find_package(ICU 60.2 COMPONENTS io data tu uc REQUIRED)
include_directories(compiler/include)
include_directories(runtime/include)
include_directories(tests/include)
add_executable(pxc
compiler/include/ast/AST.h
compiler/include/ast/Declaration.h
compiler/include/ast/Expression.h
compiler/include/ast/Literal.h
compiler/include/ast/Statement.h
compiler/include/ast/Visitor.h
compiler/include/cg/CCompiler.h
compiler/include/ContextAnalyzer.h
compiler/include/Error.h
compiler/include/IO.h
compiler/include/Parser.h
compiler/include/Scanner.h
compiler/include/Scope.h
compiler/include/SourcePosition.h
compiler/include/Symbol.h
compiler/include/Token.h
compiler/include/Utf8String.h
compiler/src/ast/Declaration.cpp
compiler/src/ast/Expression.cpp
compiler/src/ast/Literal.cpp
compiler/src/ast/Node.cpp
compiler/src/ast/Statement.cpp
compiler/src/cg/CCompiler.cpp
compiler/src/ContextAnalyzer.cpp
compiler/src/Parser.cpp
compiler/src/PxMain.cpp
compiler/src/Scanner.cpp
compiler/src/Symbol.cpp
compiler/src/Token.cpp)
target_link_libraries(pxc coverage_config ${ICU_LIBRARIES})
add_library(pxruntime STATIC runtime/src/PxRuntime.cpp)
add_executable(tests
tests/src/TestMain.cpp
tests/src/ParserTest.cpp
tests/src/ScannerTest.cpp
tests/src/ScopeTest.cpp
tests/src/ScopeTreeTest.cpp
tests/src/SourcePositionTest.cpp
tests/src/SymbolTableTest.cpp
tests/src/TokenTest.cpp
tests/src/Utf8StringTest.cpp
compiler/src/ast/Declaration.cpp
compiler/src/ast/Expression.cpp
compiler/src/ast/Literal.cpp
compiler/src/ast/Node.cpp
compiler/src/ast/Statement.cpp
compiler/src/Parser.cpp
compiler/src/Scanner.cpp
compiler/src/Symbol.cpp
compiler/src/Token.cpp)
target_link_libraries(tests ${ICU_LIBRARIES})
add_test(NAME pxc_test COMMAND tests)