Refactor CMakeLists #46

Merged
blue merged 5 commits from vae/squawk:build-refactor into messageFeed 2021-05-11 23:31:59 +00:00
11 changed files with 188 additions and 204 deletions
Showing only changes of commit 0038aca1f6 - Show all commits

View File

@ -15,13 +15,77 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
include(GNUInstallDirs)
option(SYSTEM_QXMPP "Use system qxmpp lib" ON)
option(WITH_KWALLET "Build KWallet support module" ON)
option(WITH_KIO "Build KIO support module" ON)
# Dependencies
## Qt
find_package(Qt5Widgets CONFIG REQUIRED COMPONENTS Widgets DBus Core)
find_package(Qt5LinguistTools)
find_package(Qt5Core CONFIG REQUIRED)
find_package(Qt5Gui CONFIG REQUIRED)
find_package(Qt5Network CONFIG REQUIRED)
find_package(Qt5Xml CONFIG REQUIRED)
find_package(Qt5LinguistTools)
find_package(LMDB REQUIRED)
find_package(Signal REQUIRED)
## QXmpp
if (SYSTEM_QXMPP)
find_package(QXmpp CONFIG)
if (NOT QXmpp_FOUND)
set(SYSTEM_QXMPP OFF)
message("QXmpp package wasn't found, trying to build with bundled QXmpp")
else()
message("Building with system QXmpp")
endif()
endif()
if(NOT SYSTEM_QXMPP)
add_subdirectory(external/qxmpp)
endif()
## KIO
if (WITH_KIO)
find_package(KF5KIO CONFIG)
if (NOT KF5KIO_FOUND)
set(WITH_KIO OFF)
message("KIO package wasn't found, KIO support modules wouldn't be built")
else()
add_definitions(-DWITH_KIO)
message("Building with support of KIO")
endif()
endif()
## KWallet
if (WITH_KWALLET)
find_package(KF5Wallet CONFIG)
if (NOT KF5Wallet_FOUND)
set(WITH_KWALLET OFF)
message("KWallet package wasn't found, KWallet support module wouldn't be built")
else()
add_definitions(-DWITH_KWALLET)
message("Building with support of KWallet")
endif()
endif()
# Linking
target_link_libraries(squawk PRIVATE Qt5::Widgets)
target_link_libraries(squawk PRIVATE Qt5::DBus)
target_link_libraries(squawk PRIVATE Qt5::Network)
target_link_libraries(squawk PRIVATE Qt5::Gui)
target_link_libraries(squawk PRIVATE Qt5::Xml)
target_link_libraries(squawk PRIVATE qxmpp)
target_link_libraries(squawk PRIVATE lmdb)
target_link_libraries(squawk PRIVATE simpleCrypt)
target_link_libraries(squawk PRIVATE uuid)
# Build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
@ -51,61 +115,9 @@ set(TS_FILES
qt5_add_translation(QM_FILES ${TS_FILES})
add_custom_target(translations ALL DEPENDS ${QM_FILES})
qt5_use_modules(squawk LINK_PUBLIC Core Widgets)
qt5_add_resources(RCC resources/resources.qrc)
option(SYSTEM_QXMPP "Use system qxmpp lib" ON)
option(WITH_KWALLET "Build KWallet support module" ON)
option(WITH_KIO "Build KIO support module" ON)
if (SYSTEM_QXMPP)
find_package(QXmpp CONFIG)
if (NOT QXmpp_FOUND)
set(SYSTEM_QXMPP OFF)
message("QXmpp package wasn't found, trying to build with bundled QXmpp")
else()
message("Building with system QXmpp")
endif()
endif()
if(NOT SYSTEM_QXMPP)
add_subdirectory(external/qxmpp)
endif()
if (WITH_KWALLET)
find_package(KF5Wallet CONFIG)
if (NOT KF5Wallet_FOUND)
set(WITH_KWALLET OFF)
message("KWallet package wasn't found, KWallet support module wouldn't be built")
else()
add_definitions(-DWITH_KWALLET)
message("Building with support of KWallet")
endif()
endif()
target_sources(squawk PRIVATE ${RCC})
target_link_libraries(squawk PRIVATE Qt5::Widgets)
target_link_libraries(squawk PRIVATE Qt5::DBus)
target_link_libraries(squawk PRIVATE Qt5::Network)
target_link_libraries(squawk PRIVATE Qt5::Gui)
target_link_libraries(squawk PRIVATE Qt5::Xml)
target_link_libraries(squawk PRIVATE qxmpp)
target_link_libraries(squawk PRIVATE lmdb)
target_link_libraries(squawk PRIVATE simpleCrypt)
if (WITH_KIO)
find_package(KF5KIO CONFIG)
if (NOT KF5KIO_FOUND)
set(WITH_KIO OFF)
message("KIO package wasn't found, KIO support modules wouldn't be built")
else()
add_definitions(-DWITH_KIO)
message("Building with support of KIO")
endif()
endif()
add_subdirectory(ui)
add_subdirectory(core)
@ -113,8 +125,6 @@ add_subdirectory(plugins)
add_subdirectory(external/simpleCrypt)
target_link_libraries(squawk PRIVATE uuid)
add_dependencies(${CMAKE_PROJECT_NAME} translations)
# Install the executable

15
cmake/FindSignal.cmake Normal file
View File

@ -0,0 +1,15 @@
find_path(Signal_INCLUDE_DIR NAMES signal/signal_protocol.h)
find_library(Signal_LIBRARY signal-protocol-c)
mark_as_advanced(Signal_INCLUDE_DIR Signal_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Signal REQUIRED_VARS Signal_LIBRARY Signal_INCLUDE_DIR)
if (Signal_FOUND AND NOT TARGET Signal::Signal)
add_library(Signal::Signal UNKNOWN IMPORTED)
set_target_properties(Signal::Signal PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${Signal_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Signal_INCLUDE_DIR}"
)
endif ()

View File

@ -25,10 +25,3 @@ target_sources(squawk PRIVATE
add_subdirectory(handlers)
add_subdirectory(passwordStorageEngines)
#if(SYSTEM_QXMPP)
# get_target_property(QXMPP_INTERFACE_INCLUDE_DIRECTORIES QXmpp::QXmpp INTERFACE_INCLUDE_DIRECTORIES)
# target_include_directories(squawk PRIVATE ${QXMPP_INTERFACE_INCLUDE_DIRECTORIES})
#endif()
# Use the Widgets module from Qt 5.

View File

@ -1,21 +1,9 @@
if (WITH_KWALLET)
target_sources(squawk PRIVATE
wrappers/kwallet.cpp
blue marked this conversation as resolved
Review

А вот так вот точно нельзя, это должно быть миниатюрной разделяемой библиотекой, я её в рантайме пробую загрузить как плагин

А вот так вот точно нельзя, это должно быть миниатюрной разделяемой библиотекой, я её в рантайме пробую загрузить как плагин
kwallet.cpp
kwallet.h
)
if (WITH_KWALLET)
# get_target_property(KWALLET_INTERFACE_INCLUDE_DIRECTORIES KF5::Wallet INTERFACE_INCLUDE_DIRECTORIES)
# get_target_property(Qt5GUI_INTERFACE_INCLUDE_DIRECTORIES Qt5::Gui INTERFACE_INCLUDE_DIRECTORIES)
#
# target_include_directories(squawk PRIVATE ${KWALLET_INTERFACE_INCLUDE_DIRECTORIES})
# target_include_directories(squawk PRIVATE ${Qt5GUI_INTERFACE_INCLUDE_DIRECTORIES})
target_link_libraries(squawk PUBLIC Qt5::Core Qt5::Gui KF5::Wallet)
# target_include_directories(kwalletWrapper PUBLIC ${KWALLET_INTERFACE_INCLUDE_DIRECTORIES})
# target_include_directories(kwalletWrapper PUBLIC ${Qt5GUI_INTERFACE_INCLUDE_DIRECTORIES})
# target_link_libraries(kwalletWrapper KF5::Wallet)
# target_link_libraries(kwalletWrapper Qt5::Core)
target_link_libraries(squawk PUBLIC KF5::Wallet)
endif ()

View File

@ -1,26 +1,4 @@
cmake_minimum_required(VERSION 3.3)
project(plugins)
if (WITH_KIO)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Core CONFIG REQUIRED)
set(openFileManagerWindowJob_SRC
openfilemanagerwindowjob.cpp
)
add_library(openFileManagerWindowJob SHARED ${openFileManagerWindowJob_SRC})
get_target_property(Qt5CORE_INTERFACE_INCLUDE_DIRECTORIES Qt5::Core INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(KIO_WIDGETS_INTERFACE_INCLUDE_DIRECTORIES KF5::KIOWidgets INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(CORE_ADDONS_INTERFACE_INCLUDE_DIRECTORIES KF5::CoreAddons INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(openFileManagerWindowJob PUBLIC ${KIO_WIDGETS_INTERFACE_INCLUDE_DIRECTORIES})
target_include_directories(openFileManagerWindowJob PUBLIC ${CORE_ADDONS_INTERFACE_INCLUDE_DIRECTORIES})
target_include_directories(openFileManagerWindowJob PUBLIC ${Qt5CORE_INTERFACE_INCLUDE_DIRECTORIES})
target_link_libraries(openFileManagerWindowJob KF5::KIOWidgets)
target_link_libraries(openFileManagerWindowJob Qt5::Core)
install(TARGETS openFileManagerWindowJob DESTINATION ${CMAKE_INSTALL_LIBDIR})
target_sources(squawk PRIVATE openfilemanagerwindowjob.cpp)
blue marked this conversation as resolved Outdated
Outdated
Review

Тут тоже нельзя, вот эту штуку надо сделать разделяемой либой

Тут тоже нельзя, вот эту штуку надо сделать разделяемой либой
Outdated
Review

ок, поправлю сейчас тогда

ок, поправлю сейчас тогда
target_link_libraries(squawk PRIVATE KF5::KIOWidgets)
endif ()

View File

@ -1,19 +1,19 @@
target_sources(squawk PRIVATE
${CMAKE_CURRENT_LIST_DIR}/enums.h
${CMAKE_CURRENT_LIST_DIR}/global.cpp
${CMAKE_CURRENT_LIST_DIR}/global.h
${CMAKE_CURRENT_LIST_DIR}/exception.cpp
${CMAKE_CURRENT_LIST_DIR}/exception.h
${CMAKE_CURRENT_LIST_DIR}/icons.cpp
${CMAKE_CURRENT_LIST_DIR}/icons.h
${CMAKE_CURRENT_LIST_DIR}/message.cpp
${CMAKE_CURRENT_LIST_DIR}/message.h
${CMAKE_CURRENT_LIST_DIR}/messageinfo.cpp
${CMAKE_CURRENT_LIST_DIR}/messageinfo.h
${CMAKE_CURRENT_LIST_DIR}/order.h
${CMAKE_CURRENT_LIST_DIR}/shared.h
${CMAKE_CURRENT_LIST_DIR}/utils.cpp
${CMAKE_CURRENT_LIST_DIR}/utils.h
${CMAKE_CURRENT_LIST_DIR}/vcard.cpp
${CMAKE_CURRENT_LIST_DIR}/vcard.h
enums.h
global.cpp
global.h
exception.cpp
exception.h
icons.cpp
icons.h
message.cpp
message.h
messageinfo.cpp
messageinfo.h
order.h
shared.h
utils.cpp
utils.h
vcard.cpp
vcard.h
)

View File

@ -1,28 +1,28 @@
target_sources(squawk PRIVATE
${CMAKE_CURRENT_LIST_DIR}/abstractparticipant.cpp
${CMAKE_CURRENT_LIST_DIR}/abstractparticipant.h
${CMAKE_CURRENT_LIST_DIR}/account.cpp
${CMAKE_CURRENT_LIST_DIR}/account.h
${CMAKE_CURRENT_LIST_DIR}/accounts.cpp
${CMAKE_CURRENT_LIST_DIR}/accounts.h
${CMAKE_CURRENT_LIST_DIR}/contact.cpp
${CMAKE_CURRENT_LIST_DIR}/contact.h
${CMAKE_CURRENT_LIST_DIR}/element.cpp
${CMAKE_CURRENT_LIST_DIR}/element.h
${CMAKE_CURRENT_LIST_DIR}/group.cpp
${CMAKE_CURRENT_LIST_DIR}/group.h
${CMAKE_CURRENT_LIST_DIR}/item.cpp
${CMAKE_CURRENT_LIST_DIR}/item.h
${CMAKE_CURRENT_LIST_DIR}/messagefeed.cpp
${CMAKE_CURRENT_LIST_DIR}/messagefeed.h
${CMAKE_CURRENT_LIST_DIR}/participant.cpp
${CMAKE_CURRENT_LIST_DIR}/participant.h
${CMAKE_CURRENT_LIST_DIR}/presence.cpp
${CMAKE_CURRENT_LIST_DIR}/presence.h
${CMAKE_CURRENT_LIST_DIR}/reference.cpp
${CMAKE_CURRENT_LIST_DIR}/reference.h
${CMAKE_CURRENT_LIST_DIR}/room.cpp
${CMAKE_CURRENT_LIST_DIR}/room.h
${CMAKE_CURRENT_LIST_DIR}/roster.cpp
${CMAKE_CURRENT_LIST_DIR}/roster.h
abstractparticipant.cpp
abstractparticipant.h
account.cpp
account.h
accounts.cpp
accounts.h
contact.cpp
contact.h
element.cpp
element.h
group.cpp
group.h
item.cpp
item.h
messagefeed.cpp
messagefeed.h
participant.cpp
participant.h
presence.cpp
presence.h
reference.cpp
reference.h
room.cpp
room.h
roster.cpp
roster.h
)

View File

@ -1,26 +1,26 @@
target_sources(squawk PRIVATE
${CMAKE_CURRENT_LIST_DIR}/badge.cpp
${CMAKE_CURRENT_LIST_DIR}/badge.h
${CMAKE_CURRENT_LIST_DIR}/comboboxdelegate.cpp
${CMAKE_CURRENT_LIST_DIR}/comboboxdelegate.h
${CMAKE_CURRENT_LIST_DIR}/exponentialblur.cpp
${CMAKE_CURRENT_LIST_DIR}/exponentialblur.h
${CMAKE_CURRENT_LIST_DIR}/feedview.cpp
${CMAKE_CURRENT_LIST_DIR}/feedview.h
${CMAKE_CURRENT_LIST_DIR}/flowlayout.cpp
${CMAKE_CURRENT_LIST_DIR}/flowlayout.h
${CMAKE_CURRENT_LIST_DIR}/image.cpp
${CMAKE_CURRENT_LIST_DIR}/image.h
${CMAKE_CURRENT_LIST_DIR}/message.cpp
${CMAKE_CURRENT_LIST_DIR}/message.h
${CMAKE_CURRENT_LIST_DIR}/messagedelegate.cpp
${CMAKE_CURRENT_LIST_DIR}/messagedelegate.h
${CMAKE_CURRENT_LIST_DIR}/messageline.cpp
${CMAKE_CURRENT_LIST_DIR}/messageline.h
${CMAKE_CURRENT_LIST_DIR}/progress.cpp
${CMAKE_CURRENT_LIST_DIR}/progress.h
${CMAKE_CURRENT_LIST_DIR}/resizer.cpp
${CMAKE_CURRENT_LIST_DIR}/resizer.h
${CMAKE_CURRENT_LIST_DIR}/shadowoverlay.cpp
${CMAKE_CURRENT_LIST_DIR}/shadowoverlay.h
badge.cpp
badge.h
comboboxdelegate.cpp
comboboxdelegate.h
exponentialblur.cpp
exponentialblur.h
feedview.cpp
feedview.h
flowlayout.cpp
flowlayout.h
image.cpp
image.h
message.cpp
message.h
messagedelegate.cpp
messagedelegate.h
messageline.cpp
messageline.h
progress.cpp
progress.h
resizer.cpp
resizer.h
shadowoverlay.cpp
shadowoverlay.h
)

View File

@ -1,23 +1,23 @@
target_sources(squawk PRIVATE
${CMAKE_CURRENT_LIST_DIR}/account.cpp
${CMAKE_CURRENT_LIST_DIR}/account.h
${CMAKE_CURRENT_LIST_DIR}/account.ui
${CMAKE_CURRENT_LIST_DIR}/accounts.cpp
${CMAKE_CURRENT_LIST_DIR}/accounts.h
${CMAKE_CURRENT_LIST_DIR}/accounts.ui
${CMAKE_CURRENT_LIST_DIR}/chat.cpp
${CMAKE_CURRENT_LIST_DIR}/chat.h
${CMAKE_CURRENT_LIST_DIR}/conversation.cpp
${CMAKE_CURRENT_LIST_DIR}/conversation.h
${CMAKE_CURRENT_LIST_DIR}/conversation.ui
${CMAKE_CURRENT_LIST_DIR}/joinconference.cpp
${CMAKE_CURRENT_LIST_DIR}/joinconference.h
${CMAKE_CURRENT_LIST_DIR}/joinconference.ui
${CMAKE_CURRENT_LIST_DIR}/newcontact.cpp
${CMAKE_CURRENT_LIST_DIR}/newcontact.h
${CMAKE_CURRENT_LIST_DIR}/newcontact.ui
${CMAKE_CURRENT_LIST_DIR}/room.cpp
${CMAKE_CURRENT_LIST_DIR}/room.h
account.cpp
account.h
account.ui
accounts.cpp
accounts.h
accounts.ui
chat.cpp
chat.h
conversation.cpp
conversation.h
conversation.ui
joinconference.cpp
joinconference.h
joinconference.ui
newcontact.cpp
newcontact.h
newcontact.ui
room.cpp
room.h
)
add_subdirectory(vcard)

View File

@ -1,9 +1,9 @@
target_sources(squawk PRIVATE
${CMAKE_CURRENT_LIST_DIR}/emailsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/emailsmodel.h
${CMAKE_CURRENT_LIST_DIR}/phonesmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/phonesmodel.h
${CMAKE_CURRENT_LIST_DIR}/vcard.cpp
${CMAKE_CURRENT_LIST_DIR}/vcard.h
${CMAKE_CURRENT_LIST_DIR}/vcard.ui
emailsmodel.cpp
emailsmodel.h
phonesmodel.cpp
phonesmodel.h
vcard.cpp
vcard.h
vcard.ui
)