-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
181 lines (149 loc) · 5.58 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
cmake_minimum_required(VERSION 3.10)
project(Calc)
set(CMAKE_CXX_STANDARD 17)
include_directories(src)
include_directories(src/math)
include_directories(src/tests)
include_directories()
add_library(math STATIC src/math/Number.cpp src/math/Number.h src/math/UndefinedException.h)
find_package(Qt5 COMPONENTS Widgets Qml Quick REQUIRED)
include_directories(${Qt5Widgets_INCLUDE_DIRS} ${QtQml_INCLUDE_DIRS})
set(CMAKE_AUTOMOC ON)
qt5_add_resources(QT_RESOURCES src/qml.qrc)
add_executable(${PROJECT_NAME}
src/Equation.cpp
src/Equation.h
src/EquationObserver.h
src/Interpret.cpp
src/Interpret.h
src/InterpretException.h
src/Lex.cpp
src/Lex.h
src/LexException.h
src/LexicalAnalyzer.cpp
src/LexicalAnalyzer.h
src/LexicalAnalyzerException.h
src/LexIdentificationObserver.h
src/main.cpp
src/ResultObserver.h
src/SignalManager.cpp
src/SignalManager.h
src/resources/main.qml
${RESOURCES})
file(COPY src/resources/main.qml DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY src/resources DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(${PROJECT_NAME} math)
target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::Qml Qt5::Quick)
#################################################################################
## Profiling
#################################################################################
add_executable(Profiling
src/profiling/profiling.cpp
)
target_link_libraries(Profiling math)
#################################################################################
## Testy
#################################################################################
# Testy lexikálního analyzátoru
###############################
add_executable(LexicalATest
src/tests/LexicalAnalyzerTest.cpp
src/Lex.cpp
src/Lex.h
src/LexException.h
src/LexicalAnalyzer.cpp
src/LexicalAnalyzer.h
src/LexicalAnalyzerException.h
src/LexIdentificationObserver.h
)
target_link_libraries(LexicalATest gtest_main)
target_link_libraries(LexicalATest math)
# Testy Interpretu
###############################
add_executable(InterpretTest
src/tests/InterpretTests.cpp
src/Interpret.cpp
src/Interpret.h
src/InterpretException.h
src/Lex.cpp
src/Lex.h
src/LexException.h
src/LexIdentificationObserver.h
)
target_link_libraries(InterpretTest gtest_main)
target_link_libraries(InterpretTest math)
# Testy backendu
###############################
add_executable(BackendTest
src/tests/backendTest.cpp
src/Equation.cpp
src/Equation.h
src/EquationObserver.h
src/Interpret.cpp
src/Interpret.h
src/InterpretException.h
src/Lex.cpp
src/Lex.h
src/LexException.h
src/LexicalAnalyzer.cpp
src/LexicalAnalyzer.h
src/LexicalAnalyzerException.h
src/LexIdentificationObserver.h
)
target_link_libraries(BackendTest gtest_main)
target_link_libraries(BackendTest math)
# Testy Numerické knihovny
###############################
add_executable(NumberTest
src/tests/NumberTest.cpp
)
target_link_libraries(NumberTest gtest_main)
target_link_libraries(NumberTest math)
# Gtest pto testování
###############################
# Download and unpack googletest at configure time
configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
if(result)
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
if(result)
message(FATAL_ERROR "Build step for googletest failed: ${result}")
endif()
# Prevent overriding the parent project's compiler/linker
# settings on Windows
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# Add googletest directly to our build. This defines
# the gtest and gtest_main targets.
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
${CMAKE_BINARY_DIR}/googletest-build
EXCLUDE_FROM_ALL)
################################################################################
# Instalace / balíček
################################################################################
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VENDOR "team22")
set(CPACK_PACKAGE_CONTACT "xmatla00@stud.fit.vutbr.cz")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Jednoduchá kalkulacka")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://matlad.github.io/FIT_IVS_PROJECT2")
set(CPACK_PACKAGE_VERSION "1.0.0-Alfa")
if(WIN32)
set(CPACK_GENERATOR NSIS)
install(DIRECTORY deployment/ DESTINATION .)
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}")
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "Execwait 'vcredist_x64.exe /q'")
set(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$DESKTOP\\\\${PROJECT_NAME}.lnk' '$INSTDIR\\\\${PROJECT_NAME}.exe'")
set(CPACK_NSIS_DELETE_ICONS_EXTRA "Delete '$DESKTOP\\\\${PROJECT_NAME}.lnk'")
else()
set(CPACK_GENERATOR DEB)
install(TARGETS ${PROJECT_NAME} DESTINATION /opt/${PROJECT_NAME})
install(DIRECTORY src/resources DESTINATION /opt/${PROJECT_NAME})
install(FILES src/install/${PROJECT_NAME}.desktop DESTINATION share/applications)
install(FILES src/install/uinstall.sh DESTINATION /opt/${PROJECT_NAME})
endif()
include(CPack)