-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
executable file
·178 lines (146 loc) · 4.28 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
cmake_minimum_required(VERSION 3.6)
project(TelepathyMorse
VERSION 0.2.0
LANGUAGES CXX
)
set(OVERRIDE_CXX_STANDARD 11 CACHE STRING "Compile with custom C++ standard version")
option(BUILD_QML_IMPORT "Enable compilation of qml import plugin" FALSE)
set(CMAKE_CXX_STANDARD ${OVERRIDE_CXX_STANDARD})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(Qt5 REQUIRED COMPONENTS Core DBus Xml Network)
if(EXISTS telegram-qt)
message(STATUS "Build TelegramQt as a subdirectory")
if(BUILD_QML_IMPORT)
set(TELEGRAMQT_BUILD_QML_IMPORT )
endif()
add_subdirectory(telegram-qt)
else()
find_package(TelegramQt5 REQUIRED)
endif()
find_package(TelepathyQt5 0.9.6 REQUIRED)
find_package(TelepathyQt5Service 0.9.6 REQUIRED)
set(TELEPATHY_QT_VERSION ${TELEPATHY_QT5_VERSION})
include(GNUInstallDirs)
include(FeatureSummary)
add_executable(telepathy-morse main.cpp)
target_sources(telepathy-morse PRIVATE
main.cpp
connection.cpp
connection.hpp
datastorage.cpp
datastorage.hpp
protocol.cpp
protocol.hpp
textchannel.cpp
textchannel.hpp
)
if (NOT BUILD_VERSION)
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE BUILD_VERSION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
set(BUILD_VERSION "unknown")
endif()
endif()
set(MORSE_BUILD_VERSION ${BUILD_VERSION})
set_target_properties(telepathy-morse
PROPERTIES
AUTOMOC TRUE
)
configure_file(version.cpp.in "${CMAKE_CURRENT_BINARY_DIR}/version.cpp" @ONLY)
add_library(MorseInfo STATIC
info.cpp
info.hpp
"${CMAKE_CURRENT_BINARY_DIR}/version.cpp"
)
target_include_directories(MorseInfo PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(MorseInfo PUBLIC
Qt5::Core
)
set_target_properties(MorseInfo
PROPERTIES
AUTOMOC TRUE
)
if (TELEPATHY_QT_VERSION VERSION_LESS "0.9.7")
message(WARNING "TelepathyQt version < 0.9.7, so group chat and debug interface support will be disabled.")
else()
set(ENABLE_GROUP_CHAT TRUE)
set(ENABLE_DEBUG_IFACE TRUE)
endif()
if (ENABLE_DEBUG_IFACE)
target_compile_definitions(telepathy-morse PRIVATE
ENABLE_DEBUG_IFACE
)
target_sources(telepathy-morse PRIVATE
debug.cpp
debug.hpp
)
endif()
if (ENABLE_GROUP_CHAT)
target_compile_definitions(telepathy-morse PRIVATE
ENABLE_GROUP_CHAT
)
if (TELEPATHY_QT_VERSION VERSION_LESS "0.9.8")
target_compile_definitions(telepathy-morse PRIVATE
USE_BUNDLED_GROUPS_IFACE
)
target_sources(telepathy-morse PRIVATE
contactgroups.cpp
contactgroups.hpp
)
set(USE_BUNDLED_GROUPS_IFACE TRUE)
endif()
endif()
target_include_directories(telepathy-morse PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${TELEPATHY_QT5_INCLUDE_DIR}
)
target_link_libraries(telepathy-morse
Qt5::Core
Qt5::DBus
Qt5::Network
${TELEPATHY_QT5_LIBRARIES}
${TELEPATHY_QT5_SERVICE_LIBRARIES}
TelegramQt5::Core
MorseInfo
)
target_compile_definitions(telepathy-morse PRIVATE
QT_NO_CAST_FROM_BYTEARRAY
QT_NO_CAST_TO_ASCII
QT_NO_URL_CAST_FROM_STRING
QT_RESTRICTED_CAST_FROM_ASCII
QT_STRICT_ITERATORS
)
configure_file(dbus-service.in org.freedesktop.Telepathy.ConnectionManager.morse.service)
if(BUILD_QML_IMPORT)
add_subdirectory(imports/Morse)
endif()
install(
TARGETS telepathy-morse
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
)
install(
FILES morse.manager
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/telepathy/managers
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.ConnectionManager.morse.service
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/services
)
#install(
# FILES morse.png
# DESTINATION share/icons/hicolor/48x48/apps
#)
message(STATUS "${PROJECT_NAME} configuration:")
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS " Compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS " Qt: ${Qt5_VERSION} at ${_qt5Core_install_prefix}")
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)