-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
CMakeLists.txt
251 lines (213 loc) · 7.14 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
cmake_minimum_required(VERSION 3.13)
if(NOT KRISTALL_VERSION)
execute_process(COMMAND git describe --tags --abbrev=0
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE KRISTALL_CMAKE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT KRISTALL_CMAKE_VERSION)
set(KRISTALL_CMAKE_VERSION "0.0.0")
endif()
execute_process(COMMAND git describe --tags
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE KRISTALL_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT KRISTALL_VERSION)
set(KRISTALL_VERSION "development")
endif()
endif()
# CMake requires the following format for versions:
# <major>[.<minor>[.<patch>[.<tweak>]]]]
string(REPLACE "V" "" KRISTALL_CMAKE_VERSION ${KRISTALL_CMAKE_VERSION})
project(kristall VERSION ${KRISTALL_CMAKE_VERSION} LANGUAGES CXX)
set(QT_VERSION_MAJOR 5)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
# QXmpp requires C++17.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS
Multimedia MultimediaWidgets Network Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS
Multimedia MultimediaWidgets Network Widgets REQUIRED)
set(PROJECT_SOURCES
src/browsertab.cpp
src/certificatehelper.cpp
src/cryptoidentity.cpp
src/dialogs/certificateiodialog.cpp
src/dialogs/certificatemanagementdialog.cpp
src/dialogs/certificateselectiondialog.cpp
src/dialogs/newidentitiydialog.cpp
src/dialogs/settingsdialog.cpp
src/documentoutlinemodel.cpp
src/documentstyle.cpp
src/favouritecollection.cpp
src/identitycollection.cpp
src/ioutil.cpp
src/localization.cpp
src/main.cpp
src/mainwindow.cpp
src/renderers/htmlrenderer.cpp
src/renderers/markdownrenderer.cpp
src/renderers/renderhelpers.cpp
src/renderers/textstyleinstance.cpp
src/widgets/browsertabbar.cpp
src/widgets/browsertabwidget.cpp
src/widgets/kristalltextbrowser.cpp
src/widgets/mediaplayer.cpp
src/mimeparser.cpp
src/protocolhandler.cpp
src/protocols/abouthandler.cpp
src/protocols/filehandler.cpp
src/protocols/fingerclient.cpp
src/protocols/geminiclient.cpp
src/protocols/gopherclient.cpp
src/protocols/guppyclient.cpp
src/protocols/webclient.cpp
src/protocolsetup.cpp
src/renderers/geminirenderer.cpp
src/renderers/gophermaprenderer.cpp
src/renderers/plaintextrenderer.cpp
src/ssltrust.cpp
src/tabbrowsinghistory.cpp
src/trustedhost.cpp
src/trustedhostcollection.cpp
src/widgets/elidelabel.cpp
src/widgets/searchbar.cpp
src/widgets/ssltrusteditor.cpp
src/widgets/favouritepopup.cpp
src/widgets/favouritebutton.cpp
src/widgets/querydialog.ui
src/widgets/querydialog.cpp
src/cachehandler.cpp
src/widgets/searchbox.cpp
src/browsertab.ui
src/dialogs/certificateiodialog.ui
src/dialogs/certificatemanagementdialog.ui
src/dialogs/certificateselectiondialog.ui
src/dialogs/newidentitiydialog.ui
src/dialogs/settingsdialog.ui
src/mainwindow.ui
src/widgets/mediaplayer.ui
src/widgets/ssltrusteditor.ui
src/fonts.qrc
lib/BreezeStyleSheets/breeze.qrc
src/builtins.qrc
src/icons.qrc
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(${PROJECT_NAME}
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(${PROJECT_NAME} SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(${PROJECT_NAME}
${PROJECT_SOURCES}
)
endif()
endif()
message(STATUS "Building Kristall ${KRISTALL_VERSION}")
target_compile_definitions(${PROJECT_NAME} PUBLIC
KRISTALL_VERSION=${KRISTALL_VERSION})
add_subdirectory(lib/luis-l-gist)
target_link_libraries(${PROJECT_NAME} PRIVATE luis-l-gist)
find_package(PkgConfig REQUIRED)
pkg_check_modules(cmark IMPORTED_TARGET cmark)
if(cmark_FOUND)
target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::cmark)
else()
message(STATUS "Using in-tree cmark")
add_subdirectory(lib/cmark)
target_link_libraries(${PROJECT_NAME} PRIVATE cmark)
endif()
pkg_check_modules(gumbo-parser IMPORTED_TARGET gumbo)
if(gumbo_FOUND)
target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::gumbo-parser)
else()
message(STATUS "Using in-tree gumbo-parser")
add_subdirectory(lib/gumbo-parser)
target_link_libraries(${PROJECT_NAME} PRIVATE gumbo-parser)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::Multimedia
Qt${QT_VERSION_MAJOR}::MultimediaWidgets
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Widgets)
target_include_directories(${PROJECT_NAME} PRIVATE src)
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(${PROJECT_NAME})
endif()
find_package(OpenSSL 1.1 REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::SSL)
if(NOT UNIX)
target_link_libraries(${PROJECT_NAME} PRIVATE iconv)
endif()
## Generate documentation
add_custom_target(
BuildDoc ALL
DEPENDS kristall.man.1
)
add_custom_command( OUTPUT kristall.man.1
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/doc/gen-man.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/
)
## Installation
include(GNUInstallDirs)
install(TARGETS kristall
RUNTIME
DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
)
install(FILES doc/kristall.1
DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}
)
install(FILES src/icons/kristall.svg
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/scalable/apps/
RENAME net.random-projects.kristall.svg
)
install(FILES src/icons/kristall-16.png
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/16x16/apps/
RENAME net.random-projects.kristall.png
)
install(FILES src/icons/kristall-32.png
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/32x32/apps/
RENAME net.random-projects.kristall.png
)
install(FILES src/icons/kristall-64.png
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/64x64/apps/
RENAME net.random-projects.kristall.png
)
install(FILES src/icons/kristall-128.png
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/128x128/apps/
RENAME net.random-projects.kristall.png
)
install(FILES Kristall.desktop
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications
)
install(FILES kristall-mime-info.xml
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/mime/packages
RENAME kristall.xml
)
install(FILES Kristall.metainfo.xml
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/metainfo/
)