-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
405 lines (358 loc) · 17.6 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
cmake_minimum_required(VERSION 3.1)
include("${CMAKE_CURRENT_SOURCE_DIR}/Custom/include.cmake" OPTIONAL)
project(SipWitchQt${CUSTOM_SUFFIX} VERSION 0.5.6 LANGUAGES CXX)
set(PROJECT_RELEASE "1")
set(PROJECT_COPYRIGHT "2017-2019")
string(TOLOWER "${PROJECT_NAME}" PROJECT_ARCHIVE)
string(REGEX REPLACE "[.]" "," RC_VERSION ${PROJECT_VERSION})
set(RC_VERSION "${RC_VERSION},0")
if(COVERAGE_TYPE MATCHES "gcov" AND CMAKE_BUILD_TYPE MATCHES "Debug")
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fprofile-arcs -ftest-coverage")
endif()
if(UNIX AND (CMAKE_GENERATOR MATCHES "Unix"))
set(CMAKE_MAINTAINER true)
endif()
include(GNUInstallDirs)
if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
set(QT_QMAKE_EXECUTABLE "/usr/local/lib/qt5/bin/qmake")
set(Qt5_DIR "/usr/local/lib/qt5/cmake/Qt5")
set(Qt5Core_DIR "/usr/local/lib/qt5/cmake/Qt5Core")
set(CUSTOM_CONTAINER "OpenBSD") # kill desktop...
set(BOOTSTRAP_VENDOR_EXOSIP true)
endif()
if(CUSTOM_CONTAINER)
find_package(Qt5 COMPONENTS Core Network Sql REQUIRED)
else()
find_package(Qt5 COMPONENTS Core Network Sql Gui Widgets REQUIRED)
find_package(Qt5LinguistTools)
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(DESKTOP_NAME "sipwitchqt-desktop")
if(WIN32)
set(PROJECT_PREFIX "C:/ProgramData/SipWitchQt${CUSTOM_SUFFIX}")
set(BOOTSTRAP_VENDOR_EXOSIP true)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(system_libs dnsapi advapi32 user32 crypt32 gdi32 ws2_32)
set(desktop_rc "${CMAKE_CURRENT_BINARY_DIR}/desktop.rc")
set(server_rc "${CMAKE_CURRENT_BINARY_DIR}/server.rc")
find_path(WINDEPLOYQT_PATH windeployqt.exe PATH_SUFFIXES bin)
elseif(APPLE)
if(NOT EXISTS "/usr/local/opt/libexosip")
message(FATAL_ERROR "*** requires: brew install libexosip")
endif()
set(OPENSSL_ROOT_DIR /usr/local/opt/openssl)
find_library(IOKIT_LIBRARY IOKit)
find_library(CORE_LIBRARY CoreFoundation)
find_library(APPKIT_LIBRARY AppKit)
set(system_libs ${APPKIT_LIBRARY} ${IOKIT_LIBRARY} ${CORE_LIBRARY})
include_directories("/usr/local/opt/libosip/include" "/usr/local/opt/libexosip/include")
link_directories("/usr/local/opt/libosip/lib" "/usr/local/opt/libexosip/lib")
find_path(MACDEPLOYQT_PATH macdeployqt PATH_SUFFIXES bin)
set(DESKTOP_ICON "${CMAKE_CURRENT_SOURCE_DIR}/Resources/logo.icns")
set(DESKTOP_NAME "SipWitchQt Desktop")
set(DESKTOP_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/desktop.plist.in")
set(MACOSX_BUNDLE_ICON_FILE "logo.icns")
set(MACOSX_BUNDLE_DISPLAY_NAME "SipWitchQt Desktop")
set(MACOSX_BUNDLE_INFO_STRING "SipWitchQt Desktop - Version ${PROJECT_VERSION}")
set(MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}-${PROJECT_RELEASE}")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}")
set(MACOSX_BUNDLE_BUNDLE_NAME "SipWitchQt Desktop")
set(MACOSX_BUNDLE_COPYRIGHT "Copyright ${PROJECT_COPYRIGHT} Tycho Softworks.")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.tychosoft.sipwitchqt")
else()
include_directories("/usr/local/include")
link_directories("/usr/local/lib")
include(FindPkgConfig)
if(NOT BOOTSTRAP_VENDOR_EXOSIP)
pkg_check_modules(OSIP2 libosip2>=5.1.0)
if(NOT OSIP2_FOUND)
set(BOOTSTRAP_VENDOR_EXOSIP true)
endif()
endif()
if(BOOTSTRAP_VENDOR_EXOSIP)
set(system_libs cares pthread)
endif()
if(NOT CUSTOM_CONTAINER OR CUSTOM_CONTAINER MATCHES "avahi")
pkg_check_modules(ZEROCONF avahi-client>=0.3.0)
endif()
if(NOT OSIP2_FOUND AND NOT BOOTSTRAP_VENDOR_EXOSIP)
message(FATAL_ERROR "*** requires osip2 and eXosip2 installed")
endif()
if(ZEROCONF_FOUND)
set(server_libs "${server_libs}" ${ZEROCONF_LIBRARIES})
endif()
find_library(HAVE_RT rt)
if(HAVE_RT)
set(server_libs "${server_libs}" ${HAVE_RT})
endif()
endif()
# Third party installed/system libraries. For windows, this
# is being supported with vcpkg. For redhat and fedora, you
# may need to use copr repo's; dyfet/develop for fedora and
# dyfet/stable for rhel7/centos7. Maybe one day fedora will
# have a modern exosip2 in the main repo.
# Required libraries
find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
set(system_libs ${OPENSSL_LIBRARIES} ${system_libs})
# Optional libraries
find_library(HAVE_JEMALLOC jemalloc)
if(HAVE_JEMALLOC)
set(system_libs "${system_libs}" ${HAVE_JEMALLOC})
endif()
# Customization
if(CUSTOM_NAME)
set(DESKTOP_NAME "${CUSTOM_NAME}")
set(PLIST_DISPLAY_NAME "${CUSTOM_NAME}")
set(PLIST_BUNDLE_ID "${CUSTOM_ID}")
set(CUSTOM_DESKTOP_RESOURCES "Custom/custom.qrc")
set(TRANSLATIONS_OUTPUT_DIRECTORY "${PROJECT_ARCHIVE}")
set(XDG "Custom")
set(ETC "Custom")
set(LOGO "Custom/logo.png")
add_definitions("-DCUSTOMIZE_DESKTOP")
else()
set(APPLICATION_NAME "${PROJECT_NAME} Desktop")
set(APPLICATION_EXEC "${DESKTOP_NAME}")
set(APPLICATION_DOMAIN "tychosoft.com")
set(APPLICATION_ORG "Tycho Softworks")
set(TRANSLATIONS_OUTPUT_DIRECTORY "translations")
set(PLIST_DISPLAY_NAME "SipWitchQt Desktop")
set(PLIST_BUNDLE_ID "com.tychosoft.sipwitchqt")
set(LOGO "Resources/logo.png")
set(ETC "etc")
set(XDG "xdg")
endif()
# Debug builds always run in repeatable pre-set configurations for testing
# and userdata allows one to create a private server testing configuration.
# Release builds operate as normal applications without console debug, and
# with a preference for poduction as RelWithDebInfo.
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/userdata/")
set(PROJECT_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/userdata")
set(PRELOAD_DATABASE true)
else()
set(PRELOAD_DATABASE true)
set(PROJECT_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/testdata")
endif()
set(DESKTOP_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/testdata")
else()
set(QT_NO_DEBUG_OUTPUT TRUE)
endif()
configure_file(config.hpp.in config.hpp)
configure_file(setup.iss.in setup.iss)
configure_file(desktop.rc.in desktop.rc)
configure_file(server.rc.in server.rc)
file(GLOB common_src Common/*.cpp)
file(GLOB connect_src Connect/*.cpp)
file(GLOB database_src Database/*.cpp)
file(GLOB server_src Server/*.cpp)
file(GLOB common_hdr Common/*.hpp)
file(GLOB connect_hdr Connect/*.hpp)
file(GLOB database_hdr Database/*.hpp)
file(GLOB server_hdr Server/*.hpp)
file(GLOB desktop_hdr Desktop/*.hpp)
file(GLOB desktop_src Desktop/*.cpp)
file(GLOB desktop_uic Desktop/*.ui)
file(GLOB dialogs_hdr Dialogs/*.hpp)
file(GLOB dialogs_src Dialogs/*.cpp)
file(GLOB dialogs_uic Dialogs/*.ui)
file(GLOB markdown *.md)
file(GLOB sipp_xml testdata/*.xml)
file(GLOB database_sql Database/*.sql)
file(GLOB desktop_ts Translations/sipwitchqt-desktop_*.ts)
if(BOOTSTRAP_VENDOR_EXOSIP)
include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/vendor/libosip2/include")
include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/vendor/libeXosip2/include")
endif()
if(NOT CUSTOM_CONTAINER)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/translations_autogen")
set_source_files_properties(${desktop_ts} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/translations_autogen")
qt5_add_translation(desktop_qm ${desktop_ts})
set(ts_desktop ${desktop_src} ${desktop_hdr} ${desktop_uic} ${dialogs_hdr} ${dialogs_src} ${dialogs_uic} ${connect_hdr} ${connect_src})
add_custom_target(translations SOURCES ${desktop_ts}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${ts_desktop} -ts translations/sipwitchqt-desktop_es.ts
)
endif()
if(APPLE)
set_source_files_properties(${DESKTOP_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set(desktop_mm Desktop/macos.mm)
set(server_mm Server/macos.mm)
endif()
set(voip_libs eXosip2 osip2 osipparser2)
if(NOT CUSTOM_CONTAINER)
add_executable(desktop-app WIN32 MACOSX_BUNDLE ${DESKTOP_ICON} ${common_src} ${common_hdr} ${connect_src} ${connect_hdr} ${desktop_src} ${desktop_hdr} ${desktop_uic} ${dialogs_src} ${dialogs_hdr} ${dialogs_uic} ${desktop_mm} ${desktop_qm} ${desktop_rc} ${CUSTOM_DESKTOP_RESOURCES} Resources/desktop.qrc)
target_link_libraries(desktop-app Qt5::Core Qt5::Network Qt5::Gui Qt5::Widgets Qt5::Sql ${voip_libs} ${desktop_libs} ${system_libs})
set_target_properties(desktop-app PROPERTIES
OUTPUT_NAME "${DESKTOP_NAME}"
MACOSX_BUNDLE_INFO_PLIST "${DESKTOP_PLIST}"
)
endif()
if(NOT CUSTOM_DESKTOP)
add_executable(server-app ${common_src} ${common_hdr} ${database_src} ${database_hdr} ${server_src} ${server_hdr} ${server_mm} ${server_rc} ${CUSTOM_SERVER_RESOURCES})
target_link_libraries(server-app Qt5::Core Qt5::Network Qt5::Sql ${voip_libs} ${server_libs} ${system_libs})
set_target_properties(server-app PROPERTIES OUTPUT_NAME "sipwitchqt-server")
endif()
if(WIN32)
set(DIST_FORMAT zip)
else()
set(DIST_FORMAT tar.gz)
endif()
add_custom_target(dist
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND "${CMAKE_COMMAND}" -E remove -F "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_ARCHIVE}-*.${DIST_FORMAT}"
COMMAND git archive -o "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_ARCHIVE}-${PROJECT_VERSION}.${DIST_FORMAT}" --format ${DIST_FORMAT} --prefix="${PROJECT_ARCHIVE}-${PROJECT_VERSION}/" "v${PROJECT_VERSION}" 2>/dev/null || git archive -o "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_ARCHIVE}-${PROJECT_VERSION}.${DIST_FORMAT}" --format ${DIST_FORMAT} --prefix="${PROJECT_ARCHIVE}-${PROJECT_VERSION}/" HEAD
)
if(BOOTSTRAP_VENDOR_EXOSIP)
add_subdirectory(vendor/libosip2)
add_subdirectory(vendor/libeXosip2)
if(NOT CUSTOM_DESKTOP)
add_dependencies(server-app eXosip2 osip2 osipparser2)
endif()
if(NOT CUSTOM_CONTAINER)
add_dependencies(desktop-app eXosip2 osip2 osipparser2)
endif()
endif()
add_custom_target(support-files SOURCES desktop.plist.in desktop.rc.in server.rc.in config.hpp.in setup.iss.in Doxyfile.in ${XDG}/${PROJECT_ARCHIVE}.desktop ${XDG}/${PROJECT_ARCHIVE}.appdata.xml LICENSE ${markdown} etc/sipwitchqt.init etc/sipwitchqt.openrc etc/sipwitchqt.sh etc/sipwitchqt-server.1 ${ETC}/sipwitchqt.default ${ETC}/sipwitchqt.conf etc/sipwitchqt.run testdata/service.conf testdata/siptest.sh ${sipp_xml} ${database_sql})
if(NOT CUSTOM_DESKTOP)
add_subdirectory(utils)
endif()
find_program(DOXYGEN doxygen)
find_program(GRAPHVIZ dot)
if(DOXYGEN AND GRAPHVIZ)
configure_file(Doxyfile.in Doxyfile)
add_custom_target(docs
COMMAND "${DOXYGEN}" Doxyfile
)
endif()
if(NOT CUSTOM_CONTAINER)
install(TARGETS desktop-app DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES ${desktop_qm} DESTINATION "${CMAKE_INSTALL_DATADIR}/${TRANSLATIONS_OUTPUT_DIRECTORY}")
endif()
if(UNIX AND NOT APPLE AND NOT CUSTOM_CONTAINER)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${XDG}/${PROJECT_ARCHIVE}.desktop" DESTINATION "${CMAKE_INSTALL_DATADIR}/applications")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${XDG}/${PROJECT_ARCHIVE}.appdata.xml" DESTINATION "${CMAKE_INSTALL_DATADIR}/metainfo")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${XDG}/${DESKTOP_NAME}.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${LOGO}" DESTINATION "${CMAKE_INSTALL_DATADIR}/pixmaps" RENAME sipwitchqt.png)
endif()
if(NOT CUSTOM_DESKTOP)
if(UNIX AND NOT APPLE)
if(NOT INIT_SYSTEM)
if(CMAKE_SYSTEM_NAME MATCHES "BSD")
set(INIT_SYSTEM "bsd")
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(INIT_SYSTEM "sysv")
endif()
endif()
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/etc/sipwitchqt-server.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
if(INIT_SYSTEM MATCHES "sysv")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/etc/sipwitchqt.init" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/init.d" RENAME "sipwitchqt-server")
endif()
if(INIT_SYSTEM MATCHES "bsd")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/etc/sipwitchqt.sh" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/rc.d" RENAME "sipwitchqt")
endif()
if(INIT_SYSTEM MATCHES "openrc")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/etc/sipwitchqt.openrc" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/init.d" RENAME "sipwitchqt-server")
endif()
if(INIT_SYSTEM MATCHES "runit")
install(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/etc/sipwitchqt.run" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/sv/sipwitchqt" RENAME "run")
endif()
endif()
install(TARGETS server-app DESTINATION "${CMAKE_INSTALL_SBINDIR}")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${ETC}/sipwitchqt.conf"
DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}"
PERMISSIONS OWNER_READ OWNER_WRITE
)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${ETC}/sipwitchqt.default"
DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/default" RENAME "sipwitchqt"
)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/Database/mysql.sql" DESTINATION "${CMAKE_INSTALL_DATADIR}/schemas" RENAME sipwitch-mysql.sql)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/Database/sqlite.sql" DESTINATION "${CMAKE_INSTALL_DATADIR}/schemas" RENAME sipwitch-sqlite.sql)
endif()
# staging releases; we do not stage debug because it uses testdata...
if(NOT CUSTOM_CONTAINER AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
if(APPLE)
if(CMAKE_GENERATOR MATCHES "Xcode")
set(OUTPUT_PREFIX "${CMAKE_BINARY_DIR}/Debug")
else()
set(OUTPUT_PREFIX "${CMAKE_BINARY_DIR}")
endif()
add_custom_command(TARGET desktop-app POST_BUILD
WORKING_DIRECTORY "${OUTPUT_PREFIX}"
COMMAND dsymutil "${OUTPUT_PREFIX}/${DESKTOP_NAME}.app/Contents/MacOS/${DESKTOP_NAME}"
COMMAND rm -rf "${DESKTOP_NAME}.dSYM"
COMMAND mv "${DESKTOP_NAME}.app/Contents/MacOS/${DESKTOP_NAME}.dSYM" "${DESKTOP_NAME}.dSYM"
COMMAND mkdir -p "${DESKTOP_NAME}.app/Contents/Translations"
COMMAND cp -a "${CMAKE_CURRENT_BINARY_DIR}/translations_autogen/sipwitchqt-desktop_*.qm" "${DESKTOP_NAME}.app/Contents/Translations"
COMMAND "${MACDEPLOYQT_PATH}/macdeployqt" "${DESKTOP_NAME}.app" -dmg -always-overwrite -appstore-compliant ${APPSTORE_SIGN}
)
endif()
if(WIN32 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
add_custom_command(TARGET desktop-app POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E remove Setup.exe
COMMAND "${CMAKE_COMMAND}" -E remove_directory stage
COMMAND "${CMAKE_COMMAND}" -E make_directory stage
COMMAND "${CMAKE_COMMAND}" -E copy sipwitchqt-desktop.exe stage
COMMAND xcopy /q "*.dll" stage
COMMAND "${WINDEPLOYQT_PATH}/windeployqt" --release --verbose=0 stage/sipwitchqt-desktop.exe
COMMAND xcopy /q "translations_autogen\\*.qm" "stage\\translations" >nul
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" stage/COPYING.txt
COMMAND iscc setup.iss
COMMAND "${CMAKE_COMMAND}" -E rename Setup.exe stage/Setup.exe
COMMAND cd stage && zip -rq ../stage.zip * && cd ..
COMMAND "${CMAKE_COMMAND}" -E rename stage.zip stage/sipwitchqt-desktop.zip
COMMAND zip -q stage/Symbols.zip *.pdb
COMMAND cd stage && zip Setup.zip Setup.exe && cd ..
)
endif()
endif()
# these targets mostly used in makefiles only...
if(CMAKE_MAINTAINER)
add_custom_target(distclean
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMAND ${CMAKE_BUILD_TOOL} clean
COMMAND "${CMAKE_COMMAND}" -E remove -F "${PROJECT_ARCHIVE}-*.tar.gz"
COMMAND "${CMAKE_COMMAND}" -E remove -F "${PROJECT_ARCHIVE}-*.rpm"
COMMAND "${CMAKE_COMMAND}" -E remove -F "${CMAKE_CURRENT_BINARY_DIR}-*.changes"
COMMAND "${CMAKE_COMMAND}" -E remove -F "${CMAKE_CURRENT_BINARY_DIR}-*.dsc"
COMMAND "${CMAKE_COMMAND}" -E remove -F "${CMAKE_CURRENT_BINARY_DIR}-*.deb"
COMMAND "${CMAKE_COMMAND}" -E remove -F "${CMAKE_CURRENT_SOURCE_DIR}/testdata/*.db"
COMMAND "${CMAKE_COMMAND}" -E remove -F "*.pdf"
COMMAND "${CMAKE_COMMAND}" -E remove_directory "doc"
)
add_custom_target(pdf
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doc/latex"
COMMAND make
COMMAND mv refman.pdf "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_ARCHIVE}.pdf"
DEPENDS support-docs
)
# Patch in packaging support. These are not part of master, but rather a
# packaging branch. This is done so that we can also overlay different
# packaging directory content for custom and special purpose builds, much
# like the Custom directory itself. OS's that redistribute would in any
# case maintain their own packaging. Finally I tend to add things in my
# include.cmake specific to my ci environment and where I upload our builds.
include("${CMAKE_CURRENT_SOURCE_DIR}/pkg/include.cmake" OPTIONAL)
include("${CMAKE_CURRENT_SOURCE_DIR}/debian/include.cmake" OPTIONAL)
endif()
# testing and coverage
if(COVERAGE_TYPE MATCHES "gcov" AND CMAKE_BUILD_TYPE MATCHES "Debug")
set(BUILD_TESTING true)
add_custom_target(coverage
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND rm -f *.gcov
# Server functional tests...
COMMAND ./sipwitchqt-server --test ./siptest.sh
COMMAND gcov -b Common/*.cpp -o CMakeFiles/server-app.dir/Common
COMMAND gcov -b Server/*.cpp -o CMakeFiles/server-app.dir/Server
COMMAND gcov -b Database/*.cpp -o CMakeFiles/server-app.dir/Database
)
endif()