This repository has been archived by the owner on Nov 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
241 lines (215 loc) · 7.77 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
project(arsnovaoverlay)
cmake_minimum_required(VERSION 2.8.8)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Declarative REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Svg REQUIRED)
find_package(Qt5Test REQUIRED)
find_package(Qt5WebSockets REQUIRED)
# Set current Qt install dir or use param to define it
# set(QTDIR "/Applications/Qt5.5.0/5.5/clang_64/")
set(VERSION_MAJOR 1)
set(VERSION_MINOR 2)
set(VERSION_PATCH rc1)
set(VERSION_SHORT ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
if (BUILD_NUMBER)
set(VERSION_PATCH "${VERSION_PATCH}-${BUILD_NUMBER}")
else(BUILD_NUMBER)
find_program(GIT_EXECUTABLE "git")
if(GIT_EXECUTABLE)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --verify -q --short=7 HEAD
OUTPUT_VARIABLE head
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
set(VERSION_PATCH "${VERSION_PATCH}-g${head}")
endif()
endif()
message ("Start build configuration for ARSnova Overlay ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} ...")
message ("use 'cmake -i' to run CMake in interactive mode")
message ("or use:")
message (" -DTESTS=(ON|OFF) to build test application")
message (" -DCOVERAGE=(ON|OFF) to run test application with code coverage")
message ("")
option (TESTS "Enable build of tests" OFF)
option (COVERAGE "Enable coverage" OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
CONFIGURE_FILE( version.h.cmake src/version.h )
CONFIGURE_FILE( Doxyfile.cmake Doxyfile )
CONFIGURE_FILE( sonar.properties.cmake sonar.properties )
CONFIGURE_FILE( downloadpage-index.html.cmake downloadpage/index.html )
add_custom_target(doc)
find_program(DOXYGEN_EXECUTABLE "doxygen")
if (DOXYGEN_EXECUTABLE)
add_custom_command(TARGET doc POST_BUILD
COMMAND ${DOXYGEN_EXECUTABLE}
)
else(DOXYGEN_EXECUTABLE)
message ("ERROR: Doxygen not available")
endif(DOXYGEN_EXECUTABLE)
set(DESKTOP
src/resources/arsnovaoverlay.desktop
)
set(ICONS
src/resources/arsnova.svg
)
IF (UNIX AND NOT APPLE)
INSTALL(FILES ${DESKTOP}
DESTINATION share/applications
)
INSTALL(FILES ${ICONS}
DESTINATION share/icons/hicolor/scalable/apps
)
ENDIF (UNIX AND NOT APPLE)
if(APPLE)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ";${QTDIR}/lib/cmake;")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "-framework Foundation -w -stdlib=libc++")
endif(APPLE)
if (APPLE OR WIN32)
add_subdirectory(extern)
endif(APPLE OR WIN32)
add_subdirectory(src)
if(TESTS)
if (COVERAGE)
message ("Execute tests with coverage is enabled")
find_program(LCOV_TOOL "lcov")
find_program(LCOV_HTML "genhtml")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
else (COVERAGE)
message ("Execute tests with coverage is disabled")
endif(COVERAGE)
message ("Build of tests is enabled")
enable_testing()
add_subdirectory(tests)
else(TESTS)
message ("Build of tests is disabled")
endif(TESTS)
IF (APPLE)
INSTALL(FILES ${FILES}
DESTINATION ../../../
)
ENDIF (APPLE)
IF (WIN32)
INSTALL(FILES ${FILES}
DESTINATION .
)
SET(WINQTFILES
# This part should contain DLL files to be included in package e.g.:
${QT_LIBRARY_DIR}/libgcc_s_sjlj-1.dll
${QT_LIBRARY_DIR}/libstdc++-6.dll
${QT_LIBRARY_DIR}/Qt5Core.dll
${QT_LIBRARY_DIR}/Qt5Declarative.dll
${QT_LIBRARY_DIR}/Qt5Gui.dll
${QT_LIBRARY_DIR}/Qt5Network.dll
${QT_LIBRARY_DIR}/Qt5WebSockets.dll
${QT_LIBRARY_DIR}/Qt5Widgets.dll
${QT_LIBRARY_DIR}/Qt5Script.dll
${QT_LIBRARY_DIR}/Qt5Svg.dll
${QT_LIBRARY_DIR}/Qt5Sql.dll
${QT_LIBRARY_DIR}/Qt5Xml.dll
${QT_LIBRARY_DIR}/Qt5XmlPatterns.dll
${QT_LIBRARY_DIR}/libEGL.dll
${QT_LIBRARY_DIR}/libGLESv2.dll
${QT_LIBRARY_DIR}/libharfbuzz-0.dll
${QT_LIBRARY_DIR}/icudata56.dll
${QT_LIBRARY_DIR}/icui18n56.dll
${QT_LIBRARY_DIR}/icuuc56.dll
${QT_LIBRARY_DIR}/libpcre16-0.dll
${QT_LIBRARY_DIR}/libfreetype-6.dll
${QT_LIBRARY_DIR}/libglib-2.0-0.dll
${QT_LIBRARY_DIR}/libjpeg-8.dll
${QT_LIBRARY_DIR}/libpng16-16.dll
${QT_LIBRARY_DIR}/libtiff-5.dll
${QT_LIBRARY_DIR}/liblzma-5.dll
${QT_LIBRARY_DIR}/zlib1.dll
${QT_LIBRARY_DIR}/libssl-10.dll
${QT_LIBRARY_DIR}/libcrypto-10.dll
${QT_LIBRARY_DIR}/libintl-8.dll
${CMAKE_CURRENT_BINARY_DIR}/extern/libqrencode.dll
)
INSTALL(FILES ${WINQTFILES}
DESTINATION .
)
INSTALL(FILES
${QT_LIBRARY_DIR}/lib/i386-pc/qt5/plugins/platforms/qwindows.dll
DESTINATION ./platforms
)
ENDIF (WIN32)
# CPACK
INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ARSnova Overlay is a small widget to display information taken from arsnova.thm.de")
SET(CPACK_PACKAGE_VENDOR "Paul-Christian Volkmer <[email protected]>")
SET(CPACK_PACKAGE_CONTACT "Paul-Christian Volkmer <[email protected]>")
SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
SET(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
IF (UNIX AND NOT APPLE)
find_program(ARCH_EXECUTABLE "arch")
if(ARCH_EXECUTABLE)
execute_process(
COMMAND ${ARCH_EXECUTABLE}
OUTPUT_VARIABLE arch
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${arch}")
SET(CPACK_GENERATOR "RPM")
endif()
# Override architecture if dpkg-architecture command was found on debian based distributions
find_program(DPKG_EXECUTABLE "dpkg")
if(DPKG_EXECUTABLE)
execute_process(
COMMAND ${DPKG_EXECUTABLE} "--print-architecture"
OUTPUT_VARIABLE arch
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${arch}")
SET(CPACK_GENERATOR "DEB")
endif()
SET(CPACK_SYSTEM_NAME ${CPACK_RPM_PACKAGE_ARCHITECTURE})
SET(CPACK_RPM_PACKAGE_RELEASE "1")
SET(CPACK_RPM_PACKAGE_LICENSE "GPLv3")
SET(
CPACK_RPM_PACKAGE_DESCRIPTION
"ARSnova Overlay is a small widget to display information taken from arsnova.thm.de."
)
#SET(CPACK_RPM_CHANGELOG_FILE ${CMAKE_CURRENT_BINARY_DIR}/CHANGES)
SET(CPACK_STRIP_FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/arsnovaoverlay)
if (CPACK_GENERATOR STREQUAL "RPM")
SET(CPACK_PACKAGE_FILE_NAME "arsnovaoverlay-${VERSION}.${arch}")
elseif(CPACK_GENERATOR STREQUAL "DEB")
SET(CPACK_PACKAGE_FILE_NAME "arsnovaoverlay_${VERSION}_${arch}")
endif()
ENDIF (UNIX AND NOT APPLE)
IF (WIN32)
SET(CPACK_GENERATOR "NSIS")
SET(CPACK_SYSTEM_NAME "win32")
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_BINARY_DIR}/COPYING)
SET(CPACK_NSIS_MODIFY_PATH OFF)
SET(CPACK_NSIS_PACKAGE_NAME "ARSnova Overlay")
SET(CPACK_NSIS_DISPLAY_NAME "ARSnova Overlay")
SET(CPACK_NSIS_CONTACT "${CPACK_PACKAGE_VENDOR}")
SET(CPACK_NSIS_URL_INFO_ABOUT "https:\\\\\\\\arsnova.eu\\\\blog\\\\")
SET(CPACK_NSIS_MUI_FINISHPAGE_RUN "arsnovaoverlay.exe")
SET(CPACK_PACKAGE_ICON ${CMAKE_CURRENT_BINARY_DIR}/src/resources/images/logo_32.png)
SET(CPACK_PACKAGE_EXECUTABLES ..\\\\arsnovaoverlay;ARSnovaOverlay)
SET(CPACK_CREATE_DESKTOP_LINKS ..\\\\arsnovaoverlay)
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "ARSnova Overlay")
SET(CPACK_STRIP_FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/arsnovaoverlay.exe)
ENDIF (WIN32)
IF (APPLE)
SET(CPACK_GENERATOR "Bundle")
SET(CPACK_BUNDLE_NAME "ARSnovaOverlay")
SET(CPACK_BUNDLE_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
SET(CPACK_BUNDLE_ICON ${CMAKE_CURRENT_BINARY_DIR}/src/resources/images/arsnovaoverlay.icns)
ENDIF (APPLE)
INCLUDE(CPack)