2021-01-07 21:50:12 +00:00
|
|
|
cmake_minimum_required(VERSION 3.4)
|
2021-05-11 17:29:08 +00:00
|
|
|
project(squawk VERSION 0.1.6 LANGUAGES CXX)
|
2019-03-29 14:54:34 +00:00
|
|
|
|
2021-05-11 17:29:08 +00:00
|
|
|
cmake_policy(SET CMP0076 NEW)
|
|
|
|
cmake_policy(SET CMP0079 NEW)
|
2021-03-22 18:04:26 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2019-10-05 11:27:39 +00:00
|
|
|
|
2019-03-29 14:54:34 +00:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_AUTOUIC ON)
|
2019-06-21 19:33:38 +00:00
|
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
|
2021-05-11 17:29:08 +00:00
|
|
|
add_executable(squawk)
|
|
|
|
target_include_directories(squawk PRIVATE ${CMAKE_SOURCE_DIR})
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
|
|
|
|
2019-10-07 15:35:55 +00:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2021-05-11 18:35:12 +00:00
|
|
|
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
|
2021-05-11 17:29:08 +00:00
|
|
|
find_package(Qt5Widgets CONFIG REQUIRED COMPONENTS Widgets DBus Core)
|
|
|
|
find_package(Qt5Core CONFIG REQUIRED)
|
|
|
|
find_package(Qt5Gui CONFIG REQUIRED)
|
|
|
|
find_package(Qt5Network CONFIG REQUIRED)
|
|
|
|
find_package(Qt5Xml CONFIG REQUIRED)
|
2021-05-11 18:35:12 +00:00
|
|
|
find_package(Qt5LinguistTools)
|
|
|
|
|
2021-05-11 17:29:08 +00:00
|
|
|
find_package(LMDB REQUIRED)
|
2021-05-11 18:35:12 +00:00
|
|
|
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
|
2019-10-05 11:27:39 +00:00
|
|
|
|
2019-11-15 13:30:29 +00:00
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE Debug)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message("Build type: ${CMAKE_BUILD_TYPE}")
|
|
|
|
|
2021-05-11 17:29:08 +00:00
|
|
|
target_compile_options(squawk PRIVATE
|
|
|
|
"-Wall;-Wextra"
|
|
|
|
"$<$<CONFIG:DEBUG>:-g>"
|
|
|
|
"$<$<CONFIG:RELEASE>:-O3>"
|
2020-04-03 22:28:15 +00:00
|
|
|
)
|
|
|
|
|
2021-05-11 17:29:08 +00:00
|
|
|
add_subdirectory(shared)
|
2019-03-29 14:54:34 +00:00
|
|
|
|
2019-10-08 09:01:14 +00:00
|
|
|
configure_file(resources/images/logo.svg squawk.svg COPYONLY)
|
|
|
|
execute_process(COMMAND convert -background none -size 48x48 squawk.svg squawk48.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
execute_process(COMMAND convert -background none -size 64x64 squawk.svg squawk64.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
execute_process(COMMAND convert -background none -size 128x128 squawk.svg squawk128.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
execute_process(COMMAND convert -background none -size 256x256 squawk.svg squawk256.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
|
|
|
configure_file(packaging/squawk.desktop squawk.desktop COPYONLY)
|
|
|
|
|
2021-05-11 17:29:08 +00:00
|
|
|
set(TS_FILES
|
2019-10-05 11:27:39 +00:00
|
|
|
translations/squawk.ru.ts
|
|
|
|
)
|
|
|
|
qt5_add_translation(QM_FILES ${TS_FILES})
|
|
|
|
add_custom_target(translations ALL DEPENDS ${QM_FILES})
|
|
|
|
|
|
|
|
qt5_add_resources(RCC resources/resources.qrc)
|
|
|
|
|
2021-05-11 17:29:08 +00:00
|
|
|
target_sources(squawk PRIVATE ${RCC})
|
2021-05-06 14:44:43 +00:00
|
|
|
|
2019-10-10 11:45:21 +00:00
|
|
|
add_subdirectory(ui)
|
|
|
|
add_subdirectory(core)
|
2021-05-06 14:44:43 +00:00
|
|
|
add_subdirectory(plugins)
|
2019-10-10 11:45:21 +00:00
|
|
|
|
2020-04-07 20:33:03 +00:00
|
|
|
add_subdirectory(external/simpleCrypt)
|
|
|
|
|
2019-10-05 11:27:39 +00:00
|
|
|
add_dependencies(${CMAKE_PROJECT_NAME} translations)
|
|
|
|
|
2019-03-29 14:54:34 +00:00
|
|
|
# Install the executable
|
2019-10-07 15:35:55 +00:00
|
|
|
install(TARGETS squawk DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2019-10-10 11:45:21 +00:00
|
|
|
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/squawk/l10n)
|
2020-04-14 16:30:33 +00:00
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk48.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/48x48/apps RENAME squawk.png)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk64.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/64x64/apps RENAME squawk.png)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk128.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/128x128/apps RENAME squawk.png)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk256.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/256x256/apps RENAME squawk.png)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
|