1
0
forked from blue/squawk

build: WIP CMakeLists refactoring continue - add FindSignal

This commit is contained in:
vae 2021-05-11 21:35:12 +03:00
parent 6e06a1d5bc
commit 0038aca1f6
Signed by untrusted user: vae
GPG Key ID: A9A33351400E00E5
11 changed files with 188 additions and 204 deletions

View File

@ -15,13 +15,77 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
include(GNUInstallDirs) 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(Qt5Widgets CONFIG REQUIRED COMPONENTS Widgets DBus Core)
find_package(Qt5LinguistTools)
find_package(Qt5Core CONFIG REQUIRED) find_package(Qt5Core CONFIG REQUIRED)
find_package(Qt5Gui CONFIG REQUIRED) find_package(Qt5Gui CONFIG REQUIRED)
find_package(Qt5Network CONFIG REQUIRED) find_package(Qt5Network CONFIG REQUIRED)
find_package(Qt5Xml CONFIG REQUIRED) find_package(Qt5Xml CONFIG REQUIRED)
find_package(Qt5LinguistTools)
find_package(LMDB REQUIRED) 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) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug) set(CMAKE_BUILD_TYPE Debug)
@ -51,61 +115,9 @@ set(TS_FILES
qt5_add_translation(QM_FILES ${TS_FILES}) qt5_add_translation(QM_FILES ${TS_FILES})
add_custom_target(translations ALL DEPENDS ${QM_FILES}) add_custom_target(translations ALL DEPENDS ${QM_FILES})
qt5_use_modules(squawk LINK_PUBLIC Core Widgets)
qt5_add_resources(RCC resources/resources.qrc) 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_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(ui)
add_subdirectory(core) add_subdirectory(core)
@ -113,8 +125,6 @@ add_subdirectory(plugins)
add_subdirectory(external/simpleCrypt) add_subdirectory(external/simpleCrypt)
target_link_libraries(squawk PRIVATE uuid)
add_dependencies(${CMAKE_PROJECT_NAME} translations) add_dependencies(${CMAKE_PROJECT_NAME} translations)
# Install the executable # 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(handlers)
add_subdirectory(passwordStorageEngines) 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 target_sources(squawk PRIVATE
wrappers/kwallet.cpp wrappers/kwallet.cpp
kwallet.cpp kwallet.cpp
kwallet.h kwallet.h
) )
if (WITH_KWALLET) target_link_libraries(squawk PUBLIC KF5::Wallet)
# 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)
endif () endif ()

View File

@ -1,26 +1,4 @@
cmake_minimum_required(VERSION 3.3)
project(plugins)
if (WITH_KIO) if (WITH_KIO)
set(CMAKE_AUTOMOC ON) target_sources(squawk PRIVATE openfilemanagerwindowjob.cpp)
target_link_libraries(squawk PRIVATE KF5::KIOWidgets)
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})
endif () endif ()

View File

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

View File

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

View File

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

View File

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

View File

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