-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
123 lines (104 loc) · 3.48 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
cmake_minimum_required(VERSION 3.5)
project(VTDRAW CXX)
# require a C++11 compiler
# use it for all targets
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# configure Qt
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 COMPONENTS Widgets Core Test REQUIRED)
# EDIT
# add any files you create related to the interpreter here
# excluding unit tests
set(interpreter_src
tokenize.hpp tokenize.cpp
expression.hpp expression.cpp
environment.hpp environment.cpp
interpreter.hpp interpreter.cpp
atom.hpp atom.cpp
env_entry.hpp env_entry.cpp
proc.hpp proc.cpp
graph.hpp graph.cpp
)
# EDIT
# add any files you create related to the GUI here
# excluding tests
set(gui_src
qgraphics_arc_item.hpp qgraphics_arc_item.cpp
message_widget.hpp message_widget.cpp
canvas_widget.hpp canvas_widget.cpp
repl_widget.hpp repl_widget.cpp
qt_interpreter.hpp qt_interpreter.cpp
main_window.hpp main_window.cpp
)
# EDIT
# add any files you create related to interpreter unit testing here
set(test_src
catch.hpp
unittests.cpp
test_interpreter.cpp
test_atom.cpp
test_env_entry.cpp
test_environment.cpp
test_expression.cpp
test_tokenize.cpp
test_proc.cpp
)
# EDIT
# add any files you create related to the vtscript program here
set(vtscript_src
${interpreter_src}
vtscript.cpp
)
# EDIT
# add any files you create related to the vtdraw program here
set(vtdraw_src
${interpreter_src}
${gui_src}
vtdraw.cpp
)
# You should not need to edit below this line
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# create the vtscript executable
add_executable(vtscript ${vtscript_src})
# create the vtdraw executable
add_executable(vtdraw ${vtdraw_src})
target_link_libraries(vtdraw Qt5::Widgets)
# setup testing
set(TEST_FILE_DIR "${CMAKE_SOURCE_DIR}/tests")
configure_file(${CMAKE_SOURCE_DIR}/test_config.hpp.in
${CMAKE_BINARY_DIR}/test_config.hpp)
include_directories(${CMAKE_BINARY_DIR})
add_executable(unittests ${interpreter_src} ${test_src})
add_executable(test_gui test_gui.cpp ${gui_src} ${interpreter_src})
target_link_libraries(test_gui Qt5::Widgets Qt5::Test)
enable_testing()
add_test(unittests unittests)
add_test(test_gui test_gui)
# On Linux, using GCC, to enable coverage on tests -DCOVERAGE=TRUE
if(UNIX AND NOT APPLE AND CMAKE_COMPILER_IS_GNUCXX AND COVERAGE)
message("Enabling Test Coverage")
SET(GCC_COVERAGE_COMPILE_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
set_target_properties(unittests PROPERTIES COMPILE_FLAGS ${GCC_COVERAGE_COMPILE_FLAGS} )
target_link_libraries(unittests gcov)
set_target_properties(test_gui PROPERTIES COMPILE_FLAGS ${GCC_COVERAGE_COMPILE_FLAGS} )
target_link_libraries(test_gui Qt5::Widgets Qt5::Test gcov)
add_custom_target(coverage
COMMAND ${CMAKE_COMMAND} -E env "ROOT=${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/scripts/coverage.sh)
endif()
# On Linux, using GCC, to enable coverage on tests -DMEMORY=TRUE
if(UNIX AND NOT APPLE AND CMAKE_COMPILER_IS_GNUCXX AND MEMORY)
add_custom_target(memtest
COMMAND valgrind ${CMAKE_BINARY_DIR}/unittests)
endif()
# enable clang-tidy with -DTIDY=TRUE
if(UNIX AND NOT APPLE AND CMAKE_COMPILER_IS_GNUCXX AND TIDY)
add_custom_target(tidy
COMMAND ${CMAKE_COMMAND} -E env "source=${CMAKE_CURRENT_SOURCE_DIR}" env "build=${CMAKE_CURRENT_BINARY_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/scripts/tidy.sh
)
endif()