-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
87 lines (74 loc) · 2.66 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
cmake_minimum_required(VERSION 3.14)
project(cppmpiler LANGUAGES CXX)
# GoogleTest requires are least C++14
set(CMAKE_CXX_STANDARD 17)
# Here, we must include the CTest, because we
# call `enabletesting` internally.
# See https://stackoverflow.com/questions/13550153/no-tests-found-when-using-gtest-with-cmake-ctest
include(CTest)
# Here we use CMake `FetchContent` module to download
# the dependency to the build system
# See https://cmake.org/cmake/help/latest/module/FetchContent.html
# And the code snippet is copied from the GTest docs.
# See https://google.github.io/googletest/quickstart-cmake.html
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.12.1
)
FetchContent_Declare(
spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog.git
GIT_TAG v1.x
)
FetchContent_MakeAvailable(googletest spdlog)
# See https://cmake.org/cmake/help/latest/module/FindDoxygen.html
find_package(Doxygen
REQUIRED dot
OPTIONAL_COMPONENTS mscgen dia)
if(DOXYGEN_FOUND)
set(DOXYGEN_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/docs)
# Here we must make Doxygen do not generate
# the docs for dependency
# See https://cmake.org/cmake/help/latest/module/FindDoxygen.html#variable:DOXYGEN_EXCLUDE_PATTERNS
set(DOXYGEN_EXCLUDE_PATTERNS "*/_deps/*" "*/deps/*")
doxygen_add_docs(DOXYGEN ${PROJECT_SOURCE_DIR})
set(DOXYGEN_COLLABORATION_GRAPH YES)
set(DOXYGEN_EXTRACT_ALL YES)
set(DOXYGEN_CLASS_DIAGRAMS YES)
set(DOXYGEN_HIDE_UNDOC_RELATIONS NO)
set(DOXYGEN_HAVE_DOT YES)
set(DOXYGEN_CLASS_GRAPH YES)
set(DOXYGEN_CALL_GRAPH YES)
set(DOXYGEN_CALLER_GRAPH YES)
set(DOXYGEN_COLLABORATION_GRAPH YES)
set(DOXYGEN_BUILTIN_STL_SUPPORT YES)
set(DOXYGEN_EXTRACT_PRIVATE YES)
set(DOXYGEN_EXTRACT_PACKAGE YES)
set(DOXYGEN_EXTRACT_STATIC YES)
set(DOXYGEN_EXTRACT_LOCALMETHODS YES)
set(DOXYGEN_UML_LOOK YES)
set(DOXYGEN_UML_LIMIT_NUM_FIELDS 50)
set(DOXYGEN_TEMPLATE_RELATIONS YES)
set(DOXYGEN_DOT_GRAPH_MAX_NODES 100)
set(DOXYGEN_MAX_DOT_GRAPH_DEPTH 0)
set(DOXYGEN_DOT_TRANSPARENT YES)
else()
message("Doxygen need to be installed to generate the doxygen documentation")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_subdirectory(./token)
add_subdirectory(./lexer)
add_subdirectory(./repl)
add_subdirectory(./ast)
add_subdirectory(./parser)
add_subdirectory(./object)
add_subdirectory(./evaluator)
add_subdirectory(./code)
add_subdirectory(./compiler)
add_subdirectory(./vm)
add_executable(cppmpiler main.cpp)
target_include_directories(cppmpiler PRIVATE ./repl)
target_link_libraries(cppmpiler repl)
set_target_properties(cppmpiler PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/)