Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

CMakeLists.txt 9.81 KB
Newer Older
Camilo Higuita's avatar
Camilo Higuita committed
1 2 3 4
cmake_minimum_required(VERSION 3.0)

set(REQUIRED_QT_VERSION 5.8.0)

5
set(CMAKE_CXX_STANDARD 17)
Camilo Higuita's avatar
Camilo Higuita committed
6 7 8 9 10 11 12 13 14 15 16

set(MAUIKIT_VERSION 0.0.5)

set(CMAKE_AUTOMOC ON)
set(AUTOMOC_MOC_OPTIONS -Muri=org.kde.maui)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

project(mauikit VERSION ${MAUIKIT_VERSION})

find_package(ECM 5.45.0 NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} 
Camilo higuita's avatar
Camilo higuita committed
17
    ${ECM_KDE_MODULE_DIR})
Camilo Higuita's avatar
Camilo Higuita committed
18 19 20 21 22 23 24 25 26 27 28 29 30

include(GenerateExportHeader)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(CMakePackageConfigHelpers)
include(ECMPoQmTools)
include(ECMQMLModules)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(ECMQtDeclareLoggingCategory)
include(ECMAddQch)
include(KDECompilerSettings NO_POLICY_SCOPE)

31 32 33

#options - for the appimage

Camilo Higuita's avatar
Camilo Higuita committed
34
find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Qml 
35
    Sql Core Quick Gui Svg QuickControls2 Network DBus Xml)
Camilo Higuita's avatar
Camilo Higuita committed
36 37 38 39 40
ecm_find_qmlmodule(QtGraphicalEffects 1.0)

include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/src
    ${CMAKE_CURRENT_BINARY_DIR}/src
Camilo higuita's avatar
Camilo higuita committed
41

Camilo higuita's avatar
Camilo higuita committed
42 43
    ${CMAKE_CURRENT_SOURCE_DIR}/src/utils
    ${CMAKE_CURRENT_BINARY_DIR}/src/utils
Camilo Higuita's avatar
Camilo Higuita committed
44
    
45 46 47
	${CMAKE_CURRENT_SOURCE_DIR}/src/utils/model_template
    ${CMAKE_CURRENT_BINARY_DIR}/src/utils/model_template
    
Camilo Higuita's avatar
Camilo Higuita committed
48
    ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/tagging
Camilo higuita's avatar
Camilo higuita committed
49
    ${CMAKE_CURRENT_BINARY_DIR}/src/utils/tagging
Camilo Higuita's avatar
Camilo Higuita committed
50
    
Camilo higuita's avatar
Camilo higuita committed
51 52
    ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/editor
    ${CMAKE_CURRENT_BINARY_DIR}/src/utils/editor
Camilo higuita's avatar
Camilo higuita committed
53 54
    
    ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/syncing
55 56 57 58
    ${CMAKE_CURRENT_BINARY_DIR}/src/utils/syncing 
    
    ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/store
    ${CMAKE_CURRENT_BINARY_DIR}/src/utils/store
Camilo higuita's avatar
Camilo higuita committed
59
    
60 61 62 63
	${CMAKE_CURRENT_SOURCE_DIR}/src/utils/syncing/libwebdavclient/lib
	${CMAKE_CURRENT_SOURCE_DIR}/src/utils/syncing/libwebdavclient/lib/utils
	${CMAKE_CURRENT_SOURCE_DIR}/src/utils/syncing/libwebdavclient/lib/dto
    
Camilo Higuita's avatar
Camilo Higuita committed
64 65 66 67 68 69 70 71
    ${CMAKE_CURRENT_SOURCE_DIR}/src/fm
    ${CMAKE_CURRENT_BINARY_DIR}/src/fm

    ${CMAKE_CURRENT_SOURCE_DIR}/src/kde
    ${CMAKE_CURRENT_BINARY_DIR}/src/kde
    )

set(mauikit_SRCS
Camilo higuita's avatar
Camilo higuita committed
72
    src/mauikit.cpp
Camilo higuita's avatar
Camilo higuita committed
73
    src/utils/mauiapp.cpp
74
    src/utils/mauiaccounts.cpp
Camilo higuita's avatar
Camilo higuita committed
75
    src/utils/handy.cpp
76 77
    src/utils/model_template/mauilist.cpp
    src/utils/model_template/mauimodel.cpp
Camilo Higuita's avatar
Camilo Higuita committed
78
    )
Camilo higuita's avatar
Camilo higuita committed
79

Camilo Higuita's avatar
Camilo Higuita committed
80 81
set(mauikit_HDRS
    src/mauikit.h
Camilo higuita's avatar
Camilo higuita committed
82 83
    src/utils.h
    src/utils/handy.h
Camilo higuita's avatar
Camilo higuita committed
84
    src/utils/mauiapp.h
85
    src/utils/mauiaccounts.h
86 87
	src/utils/model_template/mauilist.h
    src/utils/model_template/mauimodel.h
Camilo Higuita's avatar
Camilo Higuita committed
88
    )
Camilo higuita's avatar
Camilo higuita committed
89

90
set(editor_SRCS
Camilo higuita's avatar
Camilo higuita committed
91
    src/utils/editor/documenthandler.cpp
Anupam Basak's avatar
Anupam Basak committed
92
    src/utils/editor/syntaxhighlighterutil.cpp
Camilo higuita's avatar
Camilo higuita committed
93 94
    )

95
set(editor_HDRS
Camilo higuita's avatar
Camilo higuita committed
96
    src/utils/editor/documenthandler.cpp
Anupam Basak's avatar
Anupam Basak committed
97
    src/utils/editor/syntaxhighlighterutil.h
98
    )
Camilo higuita's avatar
Camilo higuita committed
99

Camilo Higuita's avatar
Camilo Higuita committed
100 101 102
set(fm_SRCS
    src/fm/fm.cpp
    src/fm/fmdb.cpp
103
    src/fm/fmlist.cpp
Camilo higuita's avatar
Camilo higuita committed
104
    src/fm/placeslist.cpp
105
    src/fm/pathlist.cpp
Camilo higuita's avatar
Camilo higuita committed
106 107
    )

Camilo Higuita's avatar
Camilo Higuita committed
108 109
set(fm_HDRS
    src/fm/fmh.h
110
    src/fm/fm.h
Camilo Higuita's avatar
Camilo Higuita committed
111
    src/fm/fmdb.h
112
    src/fm/fmlist.h
113
    src/fm/placeslist.h
114
	src/fm/pathlist.h
Camilo Higuita's avatar
Camilo Higuita committed
115
    )
Camilo higuita's avatar
Camilo higuita committed
116

Camilo Higuita's avatar
Camilo Higuita committed
117 118 119
set(tagging_SRCS
    src/utils/tagging/tagging.cpp
    src/utils/tagging/tagdb.cpp
120 121
    src/utils/tagging/tagsmodel.cpp
    src/utils/tagging/tagslist.cpp
Camilo Higuita's avatar
Camilo Higuita committed
122
    )
Camilo higuita's avatar
Camilo higuita committed
123

Camilo Higuita's avatar
Camilo Higuita committed
124
set(tagging_HDRS
125
    src/utils/tagging/tag.h
Camilo Higuita's avatar
Camilo Higuita committed
126 127
    src/utils/tagging/tagging.h
    src/utils/tagging/tagdb.h
128 129
    src/utils/tagging/tagsmodel.h
    src/utils/tagging/tagslist.h
Camilo Higuita's avatar
Camilo Higuita committed
130 131
    )

Camilo higuita's avatar
Camilo higuita committed
132 133
set(syncing_SRCS
    src/utils/syncing/syncing.cpp
134 135 136 137 138 139
    src/utils/syncing/libwebdavclient/lib/WebDAVClient.cpp
    src/utils/syncing/libwebdavclient/lib/dto/WebDAVItem.cpp
    src/utils/syncing/libwebdavclient/lib/utils/Environment.cpp
    src/utils/syncing/libwebdavclient/lib/utils/NetworkHelper.cpp
    src/utils/syncing/libwebdavclient/lib/utils/WebDAVReply.cpp
    src/utils/syncing/libwebdavclient/lib/utils/XMLHelper.cpp
Camilo higuita's avatar
Camilo higuita committed
140 141 142 143
    )

set(syncing_HDRS
    src/utils/syncing/syncing.h
144 145 146 147 148 149
    src/utils/syncing/libwebdavclient/lib/WebDAVClient.hpp
    src/utils/syncing/libwebdavclient/lib/dto/WebDAVItem.hpp
    src/utils/syncing/libwebdavclient/lib/utils/Environment.hpp
    src/utils/syncing/libwebdavclient/lib/utils/NetworkHelper.hpp
    src/utils/syncing/libwebdavclient/lib/utils/WebDAVReply.hpp
    src/utils/syncing/libwebdavclient/lib/utils/XMLHelper.hpp
Camilo higuita's avatar
Camilo higuita committed
150 151
    )

152 153
set(store_SRCS
    src/utils/store/store.cpp
154 155
    src/utils/store/storemodel.cpp
    src/utils/store/storelist.cpp
156 157 158
    )

set(store_HDRS
159 160 161
    src/utils/store/store.h    
    src/utils/store/storemodel.h
    src/utils/store/storelist.h
162 163
    )

Camilo higuita's avatar
Camilo higuita committed
164

Camilo Higuita's avatar
Camilo Higuita committed
165
#use dbus on linux, bsd etc, but not andoid and apple stuff
166 167 168
option(IS_APPIMAGE_PACKAGE "If set to true then the icons and styled is packaged as well")
    
if(ANDROID OR IS_APPIMAGE_PACKAGE)
camilo higuita's avatar
camilo higuita committed
169
	qt5_add_resources(MauiIcon_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/android/icons.qrc)
170 171 172 173 174 175
    qt5_add_resources(MauiStyle_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/maui-style/style.qrc)
    
     if (NOT EXISTS ${CMAKE_SOURCE_DIR}/src/android/icons/luv-icon-theme/.git)
        find_package(Git REQUIRED)
        execute_process(COMMAND ${GIT_EXECUTABLE} clone --depth 1 https://github.com/Nitrux/luv-icon-theme.git ${CMAKE_SOURCE_DIR}/src/android/icons/luv-icon-theme)
    endif()
176
    
177 178 179 180 181 182 183 184
    set(mauikit_style_QRCS
        ${MauiIcon_RESOURCES}
        ${MauiStyle_RESOURCES}
        )
endif()

if(ANDROID)
    find_package(Qt5 REQUIRED COMPONENTS AndroidExtras Xml WebView Network)    
185 186 187
    set(MAUIANDROID_LIBS
        Qt5::Xml
        Qt5::AndroidExtras
188
        Qt5::Network
Camilo higuita's avatar
Camilo higuita committed
189
        Qt5::WebView
190 191
        )  
    
192 193 194
    set(mauikit_Android_SRCS
        src/android/mauiandroid.cpp
        )
Camilo Higuita's avatar
Camilo Higuita committed
195
else()
Camilo higuita's avatar
Camilo higuita committed
196 197
    find_package(Qt5 REQUIRED COMPONENTS WebEngine)
    find_package(KF5 ${KF5_VERSION} REQUIRED COMPONENTS I18n Notifications
Anupam Basak's avatar
Anupam Basak committed
198 199
        Config Service KIO ConfigWidgets Attica SyntaxHighlighting)
    find_package(/usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kquicksyntaxhighlighter/libkquicksyntaxhighlighterplugin.so)
200

Camilo Higuita's avatar
Camilo Higuita committed
201 202 203 204
    set(mauikit_KDE_SRCS
        src/kde/mauikde.cpp
        src/kde/kdeconnect.cpp
        )
Camilo higuita's avatar
Camilo higuita committed
205

Camilo Higuita's avatar
Camilo Higuita committed
206 207 208 209
    set(mauikit_KDE_HDRS
        src/kde/mauikde.h
        src/kde/kdeconnect.h
        )
Camilo higuita's avatar
Camilo higuita committed
210 211

    set(MAUIKDE_KF5LIBS
212 213
        KF5::ConfigCore
        KF5::Notifications
214 215
        KF5::I18n 
        KF5::Service
216 217 218 219 220 221
        KF5::KIOCore
        KF5::KIOWidgets
        KF5::KIOFileWidgets
        KF5::Service
        KF5::KIONTLM
        KF5::ConfigWidgets
222
        KF5::Attica
Anupam Basak's avatar
Anupam Basak committed
223
        KF5::SyntaxHighlighting
Camilo higuita's avatar
Camilo higuita committed
224
        Qt5::WebEngine
camilo higuita's avatar
camilo higuita committed
225
#         /usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kquicksyntaxhighlighter/libkquicksyntaxhighlighterplugin.so
Camilo higuita's avatar
Camilo higuita committed
226
        )
Camilo Higuita's avatar
Camilo Higuita committed
227 228 229 230
endif()
# set(CMAKE_AUTORCC ON)

qt5_add_resources(mauikit_ASSETS ${CMAKE_CURRENT_SOURCE_DIR}/assets.qrc)
231 232
qt5_add_resources(tagging_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/tagging/tagging.qrc)
qt5_add_resources(fm_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/fm/fm.qrc)
233
qt5_add_resources(store_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/store/store.qrc)
Camilo Higuita's avatar
Camilo Higuita committed
234 235 236 237

# qt5_add_resources(mauikit_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/mauikit.qrc)

add_library(MauiKit 
238

Camilo higuita's avatar
Camilo higuita committed
239 240 241
    ${fm_HDRS}
    ${fm_SRCS}
    ${fm_RESOURCES}
242

Camilo higuita's avatar
Camilo higuita committed
243 244
    ${editor_HDRS}
    ${editor_SRCS}
Camilo higuita's avatar
Camilo higuita committed
245

Camilo higuita's avatar
Camilo higuita committed
246 247
    ${syncing_HDRS}
    ${syncing_SRCS}
248 249 250 251 252
    
    ${store_SRCS}
    ${store_HDRS}
	${store_RESOURCES}
    
Camilo higuita's avatar
Camilo higuita committed
253 254 255
    ${tagging_HDRS}
    ${tagging_SRCS}
    ${tagging_RESOURCES}
256

Camilo higuita's avatar
Camilo higuita committed
257 258 259 260
    ${mauikit_HDRS}
    ${mauikit_SRCS}
    ${mauikit_RESOURCES}
    ${mauikit_ASSETS}
camilo higuita's avatar
camilo higuita committed
261 262
    ${MauiIcon_RESOURCES}
    ${MauiStyle_RESOURCES}
263

Camilo higuita's avatar
Camilo higuita committed
264 265 266 267 268
    ${mauikit_Android_SRCS}

    ${mauikit_KDE_HDRS}
    ${mauikit_KDE_SRCS}
    )
Camilo Higuita's avatar
Camilo Higuita committed
269 270 271 272 273 274 275 276 277 278

target_link_libraries(MauiKit
    PUBLIC
    Qt5::Core
    Qt5::Sql
    Qt5::Qml
    Qt5::Quick
    Qt5::QuickControls2
    Qt5::Svg
    Qt5::Gui
Camilo higuita's avatar
Camilo higuita committed
279
    Qt5::Network
280
    Qt5::Xml
281
    ${MAUIKDE_KF5LIBS}
282
    ${MAUIANDROID_LIBS}
Camilo higuita's avatar
Camilo higuita committed
283
# #     webdavclient
Camilo Higuita's avatar
Camilo Higuita committed
284
    )
285 286 287 288
    
if(IS_APPIMAGE_PACKAGE)
    target_compile_definitions(MauiKit PUBLIC APPIMAGE_PACKAGE)
endif()
289 290 291 292 293

if (ANDROID)
    kde_enable_exceptions(MauiKit PRIVATE)
    target_include_directories(MauiKit PRIVATE src/android)
    install(FILES src/android/mauiandroid.h DESTINATION ${KDE_INSTALL_INCLUDEDIR}/MauiKit COMPONENT Devel)
294 295

    install(DIRECTORY src/android/ DESTINATION ${KDE_INSTALL_DATAROOTDIR}/MauiKitAndroid COMPONENT Devel)
296 297
endif()

Camilo Higuita's avatar
Camilo Higuita committed
298 299 300 301
generate_export_header(MauiKit BASE_NAME MauiKit)
install(TARGETS MauiKit EXPORT MauiKitTargets ${INSTALL_TARGETS_DEFAULT_ARGS})

target_include_directories(MauiKit 
Camilo higuita's avatar
Camilo higuita committed
302
    INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR}/MauiKit>")
Camilo Higuita's avatar
Camilo Higuita committed
303 304 305 306 307

add_custom_target(copy)

file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/org/kde/mauikit)
add_custom_command(TARGET copy PRE_BUILD COMMAND ${CMAKE_COMMAND} 
Camilo higuita's avatar
Camilo higuita committed
308 309
    -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src/controls
    ${CMAKE_BINARY_DIR}/bin/org/kde/mauikit/)
Camilo Higuita's avatar
Camilo Higuita committed
310 311 312 313

add_dependencies(MauiKit copy)

install(DIRECTORY src/controls/ DESTINATION 
Camilo higuita's avatar
Camilo higuita committed
314
    ${KDE_INSTALL_QMLDIR}/org/kde/mauikit)
Camilo Higuita's avatar
Camilo Higuita committed
315 316

install(TARGETS MauiKit DESTINATION 
Camilo higuita's avatar
Camilo higuita committed
317
    ${KDE_INSTALL_QMLDIR}/org/kde/mauikit)
Camilo Higuita's avatar
Camilo Higuita committed
318 319

install(FILES
Camilo higuita's avatar
Camilo higuita committed
320 321 322 323
    ${mauikit_HDRS}
    ${mauikit_KDE_HDRS}
    ${tagging_HDRS}
    ${fm_HDRS}
324
    ${syncing_HDRS}
325
    ${store_HDRS}
Camilo higuita's avatar
Camilo higuita committed
326 327 328 329
    ${CMAKE_CURRENT_BINARY_DIR}/mauikit_export.h
    DESTINATION ${KDE_INSTALL_INCLUDEDIR}/MauiKit
    COMPONENT Devel)

330 331
##INSTALL MAUI STYLE
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/maui-style DESTINATION ${KDE_INSTALL_QMLDIR}/QtQuick/Controls.2)   
Camilo higuita's avatar
Camilo higuita committed
332

Camilo Higuita's avatar
Camilo Higuita committed
333
##CMAKE PARTS   
Camilo higuita's avatar
Camilo higuita committed
334

Camilo Higuita's avatar
Camilo Higuita committed
335 336 337 338 339 340 341
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/MauiKit")

ecm_setup_version(${MAUIKIT_VERSION}
    VARIABLE_PREFIX MAUIKIT
    VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/mauikit_version.h"
    PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/MauiKitConfigVersion.cmake"
    SOVERSION 5
Camilo higuita's avatar
Camilo higuita committed
342
    )
Camilo Higuita's avatar
Camilo Higuita committed
343 344 345 346 347 348

configure_package_config_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/MauiKitConfig.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/MauiKitConfig.cmake"
    INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
    PATH_VARS  KF5_INCLUDE_INSTALL_DIR CMAKE_INSTALL_PREFIX
Camilo higuita's avatar
Camilo higuita committed
349
    )
Camilo Higuita's avatar
Camilo Higuita committed
350 351 352 353 354 355

install(FILES
    "${CMAKE_CURRENT_BINARY_DIR}/MauiKitConfig.cmake"
    "${CMAKE_CURRENT_BINARY_DIR}/MauiKitConfigVersion.cmake"
    DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
    COMPONENT Devel
Camilo higuita's avatar
Camilo higuita committed
356
    )
Camilo Higuita's avatar
Camilo Higuita committed
357 358 359 360

install(EXPORT MauiKitTargets
    DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
    FILE MauiKitTargets.cmake
Camilo higuita's avatar
Camilo higuita committed
361
    )