2020-01-24 17:35:49 +01:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
2017-04-06 01:06:42 +02:00
|
|
|
|
2017-10-01 21:38:46 +02:00
|
|
|
option(APPVEYOR_BUILD "Build on appveyor" OFF)
|
2020-01-24 17:35:49 +01:00
|
|
|
option(CI_BUILD "Set when building in CI. Enables -Werror where possible" OFF)
|
2018-05-04 17:11:03 +02:00
|
|
|
option(ASAN "Compile with address sanitizers" OFF)
|
2019-12-14 23:48:02 +01:00
|
|
|
option(QML_DEBUGGING "Enable qml debugging" OFF)
|
2020-06-27 03:06:16 +02:00
|
|
|
option(COMPILE_QML "Compile Qml. It will make Nheko faster, but you will need to recompile it, when you update Qt." OFF)
|
2017-05-02 03:22:33 +02:00
|
|
|
|
2020-01-24 17:35:49 +01:00
|
|
|
set(
|
2020-01-25 00:58:22 +01:00
|
|
|
CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/toolchain.cmake"
|
|
|
|
CACHE
|
|
|
|
FILEPATH "Default toolchain"
|
|
|
|
)
|
2020-05-25 11:12:01 +02:00
|
|
|
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard")
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "Require C++ standard to be supported")
|
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "compile as PIC by default")
|
2020-01-24 17:35:49 +01:00
|
|
|
|
|
|
|
option(HUNTER_ENABLED "Enable Hunter package manager" OFF)
|
|
|
|
include("cmake/HunterGate.cmake")
|
|
|
|
HunterGate(
|
2020-07-01 00:46:44 +02:00
|
|
|
URL "https://github.com/cpp-pm/hunter/archive/v0.23.260.tar.gz"
|
|
|
|
SHA1 "13775235910a3fa85644568d1c5be8271de72e1c"
|
|
|
|
)
|
2020-01-24 17:35:49 +01:00
|
|
|
|
|
|
|
option(USE_BUNDLED_BOOST "Use the bundled version of Boost." ${HUNTER_ENABLED})
|
|
|
|
option(USE_BUNDLED_SPDLOG "Use the bundled version of spdlog."
|
2020-01-25 00:58:22 +01:00
|
|
|
${HUNTER_ENABLED})
|
2020-01-24 17:35:49 +01:00
|
|
|
option(USE_BUNDLED_OLM "Use the bundled version of libolm." ${HUNTER_ENABLED})
|
|
|
|
option(USE_BUNDLED_GTEST "Use the bundled version of Google Test."
|
2020-01-25 00:58:22 +01:00
|
|
|
${HUNTER_ENABLED})
|
2020-01-24 17:35:49 +01:00
|
|
|
option(USE_BUNDLED_CMARK "Use the bundled version of cmark."
|
|
|
|
${HUNTER_ENABLED})
|
|
|
|
option(USE_BUNDLED_JSON "Use the bundled version of nlohmann json."
|
|
|
|
${HUNTER_ENABLED})
|
|
|
|
option(USE_BUNDLED_OPENSSL "Use the bundled version of OpenSSL."
|
2020-01-25 00:58:22 +01:00
|
|
|
${HUNTER_ENABLED})
|
2020-01-24 17:35:49 +01:00
|
|
|
option(USE_BUNDLED_MTXCLIENT "Use the bundled version of the Matrix Client library." ${HUNTER_ENABLED})
|
|
|
|
option(USE_BUNDLED_LMDB "Use the bundled version of lmdb."
|
2020-01-25 00:58:22 +01:00
|
|
|
${HUNTER_ENABLED})
|
2020-01-24 17:35:49 +01:00
|
|
|
option(USE_BUNDLED_LMDBXX "Use the bundled version of lmdb++."
|
2020-01-25 00:58:22 +01:00
|
|
|
${HUNTER_ENABLED})
|
2020-01-24 17:35:49 +01:00
|
|
|
option(USE_BUNDLED_TWEENY "Use the bundled version of tweeny."
|
2020-01-25 00:58:22 +01:00
|
|
|
${HUNTER_ENABLED})
|
2020-01-24 17:35:49 +01:00
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
2017-11-06 16:17:21 +01:00
|
|
|
|
2020-01-26 18:53:24 +01:00
|
|
|
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
|
|
|
|
message("Adding FetchContent_MakeAvailable")
|
|
|
|
# from cmakes sources
|
|
|
|
macro(FetchContent_MakeAvailable)
|
|
|
|
|
|
|
|
foreach(contentName IN ITEMS ${ARGV})
|
|
|
|
string(TOLOWER ${contentName} contentNameLower)
|
|
|
|
FetchContent_GetProperties(${contentName})
|
|
|
|
if(NOT ${contentNameLower}_POPULATED)
|
|
|
|
FetchContent_Populate(${contentName})
|
|
|
|
|
|
|
|
# Only try to call add_subdirectory() if the populated content
|
|
|
|
# can be treated that way. Protecting the call with the check
|
|
|
|
# allows this function to be used for projects that just want
|
|
|
|
# to ensure the content exists, such as to provide content at
|
|
|
|
# a known location.
|
|
|
|
if(EXISTS ${${contentNameLower}_SOURCE_DIR}/CMakeLists.txt)
|
|
|
|
add_subdirectory(${${contentNameLower}_SOURCE_DIR}
|
|
|
|
${${contentNameLower}_BINARY_DIR})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
endmacro()
|
|
|
|
endif()
|
|
|
|
|
2018-01-09 19:34:01 +01:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2017-11-06 16:17:21 +01:00
|
|
|
# Include Qt basic functions
|
|
|
|
include(QtCommon)
|
|
|
|
|
2020-01-24 17:35:49 +01:00
|
|
|
project(nheko LANGUAGES CXX C)
|
2018-03-22 15:20:22 +01:00
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR "0")
|
2019-12-14 17:08:36 +01:00
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR "7")
|
2020-06-13 01:39:21 +02:00
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH "2")
|
2018-03-22 18:13:38 +01:00
|
|
|
set(PROJECT_VERSION_MAJOR ${CPACK_PACKAGE_VERSION_MAJOR})
|
|
|
|
set(PROJECT_VERSION_MINOR ${CPACK_PACKAGE_VERSION_MINOR})
|
|
|
|
set(PROJECT_VERSION_PATCH ${CPACK_PACKAGE_VERSION_PATCH})
|
2017-11-06 16:17:21 +01:00
|
|
|
|
2018-03-22 18:13:38 +01:00
|
|
|
# Set PROJECT_VERSION_PATCH & PROJECT_VERSION_TWEAK to 0 if not present
|
|
|
|
# Needed by add_project_meta.
|
2017-11-06 16:17:21 +01:00
|
|
|
fix_project_version()
|
|
|
|
|
|
|
|
# Set additional project information
|
|
|
|
set(COMPANY "Nheko")
|
2019-12-14 17:08:36 +01:00
|
|
|
set(COPYRIGHT "Copyright (c) 2019 Nheko Contributors")
|
2018-05-05 21:40:24 +02:00
|
|
|
set(IDENTIFIER "com.github.mujx.nheko")
|
2017-11-06 16:17:21 +01:00
|
|
|
|
|
|
|
add_project_meta(META_FILES_TO_INCLUDE)
|
|
|
|
|
2018-06-04 15:07:47 +02:00
|
|
|
if(NOT MSVC AND NOT APPLE)
|
2020-01-25 00:58:22 +01:00
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
|
|
find_package(Threads REQUIRED)
|
2018-06-04 15:07:47 +02:00
|
|
|
endif()
|
|
|
|
|
2018-07-02 17:39:49 +02:00
|
|
|
if (BUILD_DOCS)
|
2020-01-25 00:58:22 +01:00
|
|
|
find_package(Doxygen)
|
|
|
|
|
|
|
|
if (DOXYGEN_FOUND)
|
|
|
|
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Doxyfile.in)
|
|
|
|
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
|
|
|
|
|
|
|
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT})
|
|
|
|
|
|
|
|
add_custom_target(docs ALL
|
|
|
|
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
COMMENT "Generating API documentation with Doxygen"
|
|
|
|
VERBATIM )
|
|
|
|
else (DOXYGEN_FOUND)
|
|
|
|
message("Doxygen need to be installed to generate the doxygen documentation")
|
|
|
|
endif (DOXYGEN_FOUND)
|
2018-07-02 17:39:49 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2017-07-29 10:49:00 +02:00
|
|
|
#
|
|
|
|
# LMDB
|
|
|
|
#
|
2020-01-24 17:35:49 +01:00
|
|
|
#include(LMDB)
|
|
|
|
if(USE_BUNDLED_LMDB)
|
|
|
|
hunter_add_package(lmdb)
|
|
|
|
find_package(liblmdb CONFIG REQUIRED)
|
|
|
|
else()
|
2020-02-14 00:32:08 +01:00
|
|
|
find_package(LMDB)
|
2020-01-24 17:35:49 +01:00
|
|
|
endif()
|
2017-07-29 10:49:00 +02:00
|
|
|
|
2017-07-09 11:49:17 +02:00
|
|
|
#
|
|
|
|
# Discover Qt dependencies.
|
|
|
|
#
|
2019-11-08 14:39:45 +01:00
|
|
|
find_package(Qt5 COMPONENTS Core Widgets LinguistTools Concurrent Svg Multimedia Qml QuickControls2 QuickWidgets REQUIRED)
|
2019-10-27 22:01:40 +01:00
|
|
|
find_package(Qt5QuickCompiler)
|
2018-07-11 16:33:02 +02:00
|
|
|
find_package(Qt5DBus)
|
2017-04-06 01:06:42 +02:00
|
|
|
|
2017-07-01 15:34:36 +02:00
|
|
|
if (APPLE)
|
2020-01-25 00:58:22 +01:00
|
|
|
find_package(Qt5MacExtras REQUIRED)
|
2017-07-01 15:34:36 +02:00
|
|
|
endif(APPLE)
|
|
|
|
|
2017-05-30 13:35:01 +02:00
|
|
|
if (Qt5Widgets_FOUND)
|
2020-01-25 00:58:22 +01:00
|
|
|
if (Qt5Widgets_VERSION VERSION_LESS 5.9.0)
|
|
|
|
message(STATUS "Qt version ${Qt5Widgets_VERSION}")
|
|
|
|
message(WARNING "Minimum supported Qt5 version is 5.9!")
|
|
|
|
endif()
|
2017-05-30 13:35:01 +02:00
|
|
|
endif(Qt5Widgets_FOUND)
|
|
|
|
|
2017-04-06 01:06:42 +02:00
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
2018-06-04 15:07:47 +02:00
|
|
|
if(NOT MSVC)
|
2020-01-25 00:58:22 +01:00
|
|
|
set(
|
|
|
|
CMAKE_CXX_FLAGS
|
|
|
|
"${CMAKE_CXX_FLAGS} \
|
|
|
|
-Wall \
|
|
|
|
-Wextra \
|
|
|
|
-pipe \
|
|
|
|
-pedantic \
|
|
|
|
-fsized-deallocation \
|
|
|
|
-fdiagnostics-color=always \
|
|
|
|
-Wunreachable-code \
|
|
|
|
-std=c++17"
|
|
|
|
)
|
|
|
|
if (NOT CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
# -Wshadow is buggy and broken in GCC, so do not enable it.
|
|
|
|
# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79328
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
|
|
|
|
endif()
|
2018-06-04 15:07:47 +02:00
|
|
|
endif()
|
2017-04-06 01:06:42 +02:00
|
|
|
|
2019-01-28 03:03:07 +01:00
|
|
|
if (MSVC)
|
2020-01-25 00:58:22 +01:00
|
|
|
set(
|
|
|
|
CMAKE_CXX_FLAGS
|
|
|
|
"${CMAKE_CXX_FLAGS} /bigobj"
|
|
|
|
)
|
2019-01-28 03:03:07 +01:00
|
|
|
endif()
|
|
|
|
|
2018-06-14 01:17:38 +02:00
|
|
|
if(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))
|
2020-01-25 00:58:22 +01:00
|
|
|
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
|
|
|
|
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
|
|
|
FORCE)
|
|
|
|
message("Setting build type to '${CMAKE_BUILD_TYPE}'")
|
2018-06-14 01:17:38 +02:00
|
|
|
else(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))
|
2020-01-25 00:58:22 +01:00
|
|
|
message("Build type set to '${CMAKE_BUILD_TYPE}'")
|
2018-06-14 01:17:38 +02:00
|
|
|
endif(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))
|
2017-04-11 17:25:39 +02:00
|
|
|
|
2018-10-06 16:45:56 +02:00
|
|
|
set(SPDLOG_DEBUG_ON false)
|
|
|
|
|
|
|
|
# Windows doesn't handle CMAKE_BUILD_TYPE.
|
|
|
|
if(NOT WIN32)
|
2020-01-25 00:58:22 +01:00
|
|
|
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
|
|
|
set(SPDLOG_DEBUG_ON true)
|
|
|
|
else()
|
|
|
|
set(SPDLOG_DEBUG_ON false)
|
|
|
|
endif()
|
2018-09-30 13:33:54 +02:00
|
|
|
endif()
|
|
|
|
|
2018-03-22 15:20:22 +01:00
|
|
|
find_program(GIT git)
|
|
|
|
if(GIT)
|
2020-01-25 00:58:22 +01:00
|
|
|
execute_process(
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
COMMAND ${GIT} rev-parse --short HEAD
|
|
|
|
OUTPUT_VARIABLE GIT_OUT OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
if(GIT_OUT)
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}-${GIT_OUT}")
|
|
|
|
else()
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
|
|
|
|
endif()
|
2018-03-22 15:20:22 +01:00
|
|
|
endif(GIT)
|
2017-04-11 17:25:39 +02:00
|
|
|
|
|
|
|
set(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
|
|
|
|
set(PROJECT_VERSION ${CPACK_PACKAGE_VERSION})
|
|
|
|
|
|
|
|
message(STATUS "Version: ${PROJECT_VERSION}")
|
|
|
|
|
2018-03-22 15:20:22 +01:00
|
|
|
cmake_host_system_information(RESULT BUILD_HOST QUERY HOSTNAME)
|
|
|
|
set(BUILD_USER $ENV{USER})
|
2018-09-30 13:33:54 +02:00
|
|
|
configure_file(cmake/nheko.h config/nheko.h)
|
2018-03-22 15:20:22 +01:00
|
|
|
|
2018-03-24 22:36:27 +01:00
|
|
|
|
2017-07-09 11:49:17 +02:00
|
|
|
#
|
|
|
|
# Declare source and header files.
|
|
|
|
#
|
2017-04-06 01:06:42 +02:00
|
|
|
set(SRC_FILES
|
2020-01-25 00:58:22 +01:00
|
|
|
# Dialogs
|
|
|
|
src/dialogs/CreateRoom.cpp
|
2020-02-23 11:42:29 +01:00
|
|
|
src/dialogs/FallbackAuth.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/dialogs/ImageOverlay.cpp
|
|
|
|
src/dialogs/InviteUsers.cpp
|
|
|
|
src/dialogs/JoinRoom.cpp
|
|
|
|
src/dialogs/LeaveRoom.cpp
|
|
|
|
src/dialogs/Logout.cpp
|
2020-02-23 11:42:29 +01:00
|
|
|
src/dialogs/MemberList.cpp
|
|
|
|
src/dialogs/PreviewUploadOverlay.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/dialogs/ReCaptcha.cpp
|
2020-02-23 11:42:29 +01:00
|
|
|
src/dialogs/ReadReceipts.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/dialogs/RoomSettings.cpp
|
|
|
|
|
|
|
|
# Emoji
|
|
|
|
src/emoji/Category.cpp
|
2020-05-13 06:35:26 +02:00
|
|
|
src/emoji/EmojiModel.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/emoji/ItemDelegate.cpp
|
|
|
|
src/emoji/Panel.cpp
|
|
|
|
src/emoji/PickButton.cpp
|
|
|
|
src/emoji/Provider.cpp
|
2020-06-11 04:34:14 +02:00
|
|
|
src/emoji/Provider_new.cpp
|
|
|
|
|
2020-01-25 00:58:22 +01:00
|
|
|
|
|
|
|
# Timeline
|
2020-07-09 23:15:22 +02:00
|
|
|
src/timeline/EventStore.cpp
|
2020-07-19 12:22:54 +02:00
|
|
|
src/timeline/Reaction.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/timeline/TimelineViewManager.cpp
|
|
|
|
src/timeline/TimelineModel.cpp
|
|
|
|
src/timeline/DelegateChooser.cpp
|
|
|
|
|
|
|
|
# UI components
|
|
|
|
src/ui/Avatar.cpp
|
|
|
|
src/ui/Badge.cpp
|
2020-01-31 06:12:02 +01:00
|
|
|
src/ui/DropShadow.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/ui/LoadingIndicator.cpp
|
|
|
|
src/ui/InfoMessage.cpp
|
|
|
|
src/ui/FlatButton.cpp
|
|
|
|
src/ui/FloatingButton.cpp
|
|
|
|
src/ui/Label.cpp
|
|
|
|
src/ui/OverlayModal.cpp
|
|
|
|
src/ui/SnackBar.cpp
|
|
|
|
src/ui/RaisedButton.cpp
|
|
|
|
src/ui/Ripple.cpp
|
|
|
|
src/ui/RippleOverlay.cpp
|
|
|
|
src/ui/OverlayWidget.cpp
|
|
|
|
src/ui/TextField.cpp
|
|
|
|
src/ui/TextLabel.cpp
|
|
|
|
src/ui/ToggleButton.cpp
|
|
|
|
src/ui/Theme.cpp
|
|
|
|
src/ui/ThemeManager.cpp
|
2020-05-17 15:34:47 +02:00
|
|
|
src/ui/UserProfile.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
|
|
|
|
src/AvatarProvider.cpp
|
2020-03-01 19:55:43 +01:00
|
|
|
src/BlurhashProvider.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/Cache.cpp
|
|
|
|
src/ChatPage.cpp
|
2020-03-01 19:55:43 +01:00
|
|
|
src/ColorImageProvider.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/CommunitiesList.cpp
|
2020-03-01 19:55:43 +01:00
|
|
|
src/CommunitiesListItem.cpp
|
2020-03-13 21:05:18 +01:00
|
|
|
src/DeviceVerificationFlow.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/EventAccessors.cpp
|
|
|
|
src/InviteeItem.cpp
|
|
|
|
src/Logging.cpp
|
2020-03-01 19:55:43 +01:00
|
|
|
src/LoginPage.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/MainWindow.cpp
|
|
|
|
src/MatrixClient.cpp
|
|
|
|
src/MxcImageProvider.cpp
|
|
|
|
src/Olm.cpp
|
2020-03-01 19:55:43 +01:00
|
|
|
src/QuickSwitcher.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/RegisterPage.cpp
|
|
|
|
src/RoomInfoListItem.cpp
|
|
|
|
src/RoomList.cpp
|
2020-05-09 23:31:00 +02:00
|
|
|
src/SSOHandler.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/SideBarActions.cpp
|
|
|
|
src/Splitter.cpp
|
|
|
|
src/TextInputWidget.cpp
|
|
|
|
src/TopRoomBar.cpp
|
|
|
|
src/TrayIcon.cpp
|
|
|
|
src/UserInfoWidget.cpp
|
|
|
|
src/UserSettingsPage.cpp
|
2020-03-01 19:55:43 +01:00
|
|
|
src/Utils.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/WelcomePage.cpp
|
2020-03-01 19:55:43 +01:00
|
|
|
src/popups/PopupItem.cpp
|
|
|
|
src/popups/SuggestionsPopup.cpp
|
|
|
|
src/popups/UserMentions.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
src/main.cpp
|
2020-03-01 19:55:43 +01:00
|
|
|
|
|
|
|
third_party/blurhash/blurhash.cpp
|
2020-01-25 00:58:22 +01:00
|
|
|
)
|
2017-04-06 01:06:42 +02:00
|
|
|
|
2018-03-29 08:59:04 +02:00
|
|
|
|
2019-02-24 20:50:31 +01:00
|
|
|
include(FeatureSummary)
|
|
|
|
|
2020-01-24 17:35:49 +01:00
|
|
|
if(USE_BUNDLED_BOOST)
|
2020-01-25 00:58:22 +01:00
|
|
|
hunter_add_package(Boost COMPONENTS iostreams system thread)
|
2020-01-24 17:35:49 +01:00
|
|
|
endif()
|
2019-12-03 17:25:22 +01:00
|
|
|
find_package(Boost 1.70 REQUIRED
|
2020-01-25 00:58:22 +01:00
|
|
|
COMPONENTS iostreams
|
|
|
|
system
|
|
|
|
thread)
|
2020-05-15 22:48:30 +02:00
|
|
|
|
2020-01-24 17:35:49 +01:00
|
|
|
if(USE_BUNDLED_OPENSSL)
|
|
|
|
hunter_add_package(OpenSSL)
|
|
|
|
endif()
|
2020-07-01 00:46:44 +02:00
|
|
|
find_package(OpenSSL 1.1.0 REQUIRED)
|
2020-01-24 17:35:49 +01:00
|
|
|
if(USE_BUNDLED_MTXCLIENT)
|
|
|
|
include(FetchContent)
|
|
|
|
set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
|
|
|
|
set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")
|
|
|
|
FetchContent_Declare(
|
|
|
|
MatrixClient
|
|
|
|
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
|
2020-08-30 13:35:54 +02:00
|
|
|
GIT_TAG 0665c8baf4af0ce192adb8ca97761b63b681d569
|
2020-01-24 17:35:49 +01:00
|
|
|
)
|
|
|
|
FetchContent_MakeAvailable(MatrixClient)
|
|
|
|
else()
|
2020-06-13 02:44:53 +02:00
|
|
|
find_package(MatrixClient 0.3.1 REQUIRED)
|
2020-01-24 17:35:49 +01:00
|
|
|
endif()
|
|
|
|
if(USE_BUNDLED_OLM)
|
|
|
|
include(FetchContent)
|
2020-01-25 19:41:52 +01:00
|
|
|
set(OLM_TESTS OFF CACHE INTERNAL "")
|
2020-01-24 17:35:49 +01:00
|
|
|
FetchContent_Declare(
|
|
|
|
Olm
|
|
|
|
GIT_REPOSITORY https://gitlab.matrix.org/matrix-org/olm.git
|
|
|
|
GIT_TAG 3.1.4
|
|
|
|
)
|
|
|
|
FetchContent_MakeAvailable(Olm)
|
|
|
|
else()
|
|
|
|
find_package(Olm 3)
|
|
|
|
set_package_properties(Olm PROPERTIES
|
|
|
|
DESCRIPTION "An implementation of the Double Ratchet cryptographic ratchet"
|
|
|
|
URL "https://git.matrix.org/git/olm/about/"
|
|
|
|
TYPE REQUIRED
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(USE_BUNDLED_SPDLOG)
|
|
|
|
hunter_add_package(spdlog)
|
|
|
|
endif()
|
2018-08-08 13:15:14 +02:00
|
|
|
find_package(spdlog 1.0.0 CONFIG REQUIRED)
|
2020-01-24 17:35:49 +01:00
|
|
|
|
|
|
|
if(USE_BUNDLED_CMARK)
|
|
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(
|
|
|
|
cmark
|
|
|
|
GIT_REPOSITORY https://github.com/commonmark/cmark.git
|
2020-01-25 18:48:04 +01:00
|
|
|
GIT_TAG 242e277a661ec7e51f34dcaf86c1925d550b1498 #0.29.0 << doesn't work with fetch content yet
|
2020-01-25 19:47:54 +01:00
|
|
|
CMAKE_ARGS "CMARK_STATIC=ON CMARK_SHARED=OFF CMARK_TESTS=OFF CMARK_TESTS=OFF"
|
2020-01-24 17:35:49 +01:00
|
|
|
)
|
|
|
|
FetchContent_MakeAvailable(cmark)
|
2020-01-26 15:44:56 +01:00
|
|
|
if (MSVC)
|
|
|
|
add_library(cmark::cmark ALIAS libcmark)
|
|
|
|
else()
|
|
|
|
add_library(cmark::cmark ALIAS libcmark_static)
|
|
|
|
endif()
|
2020-01-24 17:35:49 +01:00
|
|
|
else()
|
2020-04-15 23:29:53 +02:00
|
|
|
find_package(cmark REQUIRED 0.29.0)
|
2020-01-24 17:35:49 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_BUNDLED_JSON)
|
|
|
|
hunter_add_package(nlohmann_json)
|
|
|
|
endif()
|
2019-02-24 20:50:31 +01:00
|
|
|
find_package(nlohmann_json 3.2.0)
|
|
|
|
set_package_properties(nlohmann_json PROPERTIES
|
2020-01-25 00:58:22 +01:00
|
|
|
DESCRIPTION "JSON for Modern C++, a C++11 header-only JSON class"
|
|
|
|
URL "https://nlohmann.github.io/json/"
|
|
|
|
TYPE REQUIRED
|
|
|
|
)
|
2018-03-03 12:02:33 +01:00
|
|
|
|
2020-01-24 17:35:49 +01:00
|
|
|
if(USE_BUNDLED_LMDBXX)
|
|
|
|
hunter_add_package(lmdbxx)
|
|
|
|
find_package(lmdbxx CONFIG REQUIRED)
|
|
|
|
else()
|
|
|
|
if(NOT LMDBXX_INCLUDE_DIR)
|
|
|
|
find_path(LMDBXX_INCLUDE_DIR
|
|
|
|
NAMES lmdb++.h
|
|
|
|
PATHS /usr/include
|
|
|
|
/usr/local/include
|
|
|
|
$ENV{LIB_DIR}/include
|
|
|
|
$ENV{LIB_DIR}/include/lmdbxx)
|
|
|
|
|
|
|
|
endif()
|
|
|
|
add_library(lmdbxx INTERFACE)
|
|
|
|
target_include_directories(lmdbxx INTERFACE ${LMDBXX_INCLUDE_DIR})
|
|
|
|
add_library(lmdbxx::lmdbxx ALIAS lmdbxx)
|
2018-03-29 08:59:04 +02:00
|
|
|
endif()
|
2017-08-06 10:01:46 +02:00
|
|
|
|
2020-01-24 17:35:49 +01:00
|
|
|
if(USE_BUNDLED_TWEENY)
|
|
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(
|
|
|
|
Tweeny
|
|
|
|
GIT_REPOSITORY https://github.com/mobius3/tweeny.git
|
2020-01-25 00:30:01 +01:00
|
|
|
GIT_TAG 6a5033372fe53c4c731c66c8a2d56261746cd85c #v3 <- v3 has unfixed warnings
|
2020-01-24 17:35:49 +01:00
|
|
|
)
|
|
|
|
FetchContent_MakeAvailable(Tweeny)
|
|
|
|
else()
|
|
|
|
find_package(Tweeny REQUIRED)
|
|
|
|
endif()
|
2019-01-26 19:03:49 +01:00
|
|
|
|
2020-02-23 13:40:04 +01:00
|
|
|
# single instance functionality
|
|
|
|
set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
|
2020-05-25 13:01:37 +02:00
|
|
|
add_subdirectory(third_party/SingleApplication-3.1.3.1/)
|
2020-02-23 13:40:04 +01:00
|
|
|
|
2019-02-24 20:50:31 +01:00
|
|
|
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
|
|
|
|
2017-04-06 01:06:42 +02:00
|
|
|
qt5_wrap_cpp(MOC_HEADERS
|
2020-01-25 00:58:22 +01:00
|
|
|
# Dialogs
|
|
|
|
src/dialogs/CreateRoom.h
|
2020-02-23 11:42:29 +01:00
|
|
|
src/dialogs/FallbackAuth.h
|
2020-01-25 00:58:22 +01:00
|
|
|
src/dialogs/ImageOverlay.h
|
|
|
|
src/dialogs/InviteUsers.h
|
|
|
|
src/dialogs/JoinRoom.h
|
|
|
|
src/dialogs/LeaveRoom.h
|
|
|
|
src/dialogs/Logout.h
|
2020-02-23 11:42:29 +01:00
|
|
|
src/dialogs/MemberList.h
|
|
|
|
src/dialogs/PreviewUploadOverlay.h
|
2020-01-25 00:58:22 +01:00
|
|
|
src/dialogs/RawMessage.h
|
|
|
|
src/dialogs/ReCaptcha.h
|
2020-02-23 11:42:29 +01:00
|
|
|
src/dialogs/ReadReceipts.h
|
2020-01-25 00:58:22 +01:00
|
|
|
src/dialogs/RoomSettings.h
|
|
|
|
|
|
|
|
# Emoji
|
|
|
|
src/emoji/Category.h
|
2020-05-13 06:35:26 +02:00
|
|
|
src/emoji/EmojiModel.h
|
2020-01-25 00:58:22 +01:00
|
|
|
src/emoji/ItemDelegate.h
|
|
|
|
src/emoji/Panel.h
|
|
|
|
src/emoji/PickButton.h
|
2020-05-13 06:35:26 +02:00
|
|
|
src/emoji/Provider.h
|
2020-01-25 00:58:22 +01:00
|
|
|
|
|
|
|
# Timeline
|
2020-07-09 23:15:22 +02:00
|
|
|
src/timeline/EventStore.h
|
2020-07-19 12:22:54 +02:00
|
|
|
src/timeline/Reaction.h
|
2020-01-25 00:58:22 +01:00
|
|
|
src/timeline/TimelineViewManager.h
|
|
|
|
src/timeline/TimelineModel.h
|
|
|
|
src/timeline/DelegateChooser.h
|
|
|
|
|
|
|
|
# UI components
|
|
|
|
src/ui/Avatar.h
|
|
|
|
src/ui/Badge.h
|
|
|
|
src/ui/LoadingIndicator.h
|
|
|
|
src/ui/InfoMessage.h
|
|
|
|
src/ui/FlatButton.h
|
|
|
|
src/ui/Label.h
|
|
|
|
src/ui/FloatingButton.h
|
|
|
|
src/ui/Menu.h
|
|
|
|
src/ui/OverlayWidget.h
|
|
|
|
src/ui/SnackBar.h
|
|
|
|
src/ui/RaisedButton.h
|
|
|
|
src/ui/Ripple.h
|
|
|
|
src/ui/RippleOverlay.h
|
|
|
|
src/ui/TextField.h
|
|
|
|
src/ui/TextLabel.h
|
|
|
|
src/ui/ToggleButton.h
|
|
|
|
src/ui/Theme.h
|
|
|
|
src/ui/ThemeManager.h
|
2020-05-17 15:34:47 +02:00
|
|
|
src/ui/UserProfile.h
|
2020-01-25 00:58:22 +01:00
|
|
|
|
|
|
|
src/notifications/Manager.h
|
|
|
|
|
|
|
|
src/AvatarProvider.h
|
2020-03-04 01:56:58 +01:00
|
|
|
src/BlurhashProvider.h
|
2020-01-25 00:58:22 +01:00
|
|
|
src/Cache_p.h
|
|
|
|
src/ChatPage.h
|
|
|
|
src/CommunitiesList.h
|
2020-03-01 19:55:43 +01:00
|
|
|
src/CommunitiesListItem.h
|
2020-03-13 21:05:18 +01:00
|
|
|
src/DeviceVerificationFlow.h
|
2020-03-01 19:55:43 +01:00
|
|
|
src/InviteeItem.h
|
2020-01-25 00:58:22 +01:00
|
|
|
src/LoginPage.h
|
|
|
|
src/MainWindow.h
|
|
|
|
src/MxcImageProvider.h
|
|
|
|
src/QuickSwitcher.h
|
|
|
|
src/RegisterPage.h
|
|
|
|
src/RoomInfoListItem.h
|
|
|
|
src/RoomList.h
|
2020-05-09 23:31:00 +02:00
|
|
|
src/SSOHandler.h
|
2020-01-25 00:58:22 +01:00
|
|
|
src/SideBarActions.h
|
|
|
|
src/Splitter.h
|
|
|
|
src/TextInputWidget.h
|
|
|
|
src/TopRoomBar.h
|
|
|
|
src/TrayIcon.h
|
|
|
|
src/UserInfoWidget.h
|
|
|
|
src/UserSettingsPage.h
|
|
|
|
src/WelcomePage.h
|
2020-03-01 19:55:43 +01:00
|
|
|
src/popups/PopupItem.h
|
|
|
|
src/popups/SuggestionsPopup.h
|
|
|
|
src/popups/UserMentions.h
|
2020-01-25 00:58:22 +01:00
|
|
|
)
|
2017-04-06 01:06:42 +02:00
|
|
|
|
2017-07-09 11:49:17 +02:00
|
|
|
#
|
|
|
|
# Bundle translations.
|
|
|
|
#
|
2018-03-29 08:59:04 +02:00
|
|
|
include(Translations)
|
|
|
|
set(TRANSLATION_DEPS ${LANG_QRC} ${QRC} ${QM_SRC})
|
2017-05-29 18:09:12 +02:00
|
|
|
|
2018-05-05 21:40:24 +02:00
|
|
|
if (APPLE)
|
2020-01-25 00:58:22 +01:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Foundation -framework Cocoa")
|
|
|
|
set(SRC_FILES ${SRC_FILES} src/notifications/ManagerMac.mm src/emoji/MacHelper.mm)
|
2020-05-30 16:53:57 +02:00
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
|
|
|
|
set_source_files_properties( src/notifications/ManagerMac.mm src/emoji/MacHelper.mm PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
|
|
|
|
endif()
|
2018-05-05 21:40:24 +02:00
|
|
|
elseif (WIN32)
|
2020-01-25 00:58:22 +01:00
|
|
|
file(DOWNLOAD
|
|
|
|
"https://raw.githubusercontent.com/mohabouje/WinToast/41ed1c58d5dce0ee9c01dbdeac05be45358d4f57/src/wintoastlib.cpp"
|
|
|
|
${PROJECT_SOURCE_DIR}/src/wintoastlib.cpp
|
|
|
|
EXPECTED_HASH SHA256=1A1A7CE41C1052B12946798F4A6C67CE1FAD209C967F5ED4D720B173527E2073)
|
2018-06-30 23:23:16 +02:00
|
|
|
|
2020-01-25 00:58:22 +01:00
|
|
|
file(DOWNLOAD
|
|
|
|
"https://raw.githubusercontent.com/mohabouje/WinToast/41ed1c58d5dce0ee9c01dbdeac05be45358d4f57/src/wintoastlib.h"
|
|
|
|
${PROJECT_SOURCE_DIR}/src/wintoastlib.h
|
|
|
|
EXPECTED_HASH SHA256=b4481023c5782733795838be22bf1a75f45d87458cd4d9a5a75f664a146eea11)
|
2018-06-30 23:23:16 +02:00
|
|
|
|
2020-01-25 00:58:22 +01:00
|
|
|
set(SRC_FILES ${SRC_FILES} src/notifications/ManagerWin.cpp src/wintoastlib.cpp)
|
2018-05-05 21:40:24 +02:00
|
|
|
else ()
|
2020-01-25 00:58:22 +01:00
|
|
|
set(SRC_FILES ${SRC_FILES} src/notifications/ManagerLinux.cpp)
|
2018-05-05 21:40:24 +02:00
|
|
|
endif ()
|
|
|
|
|
2018-03-29 08:59:04 +02:00
|
|
|
set(NHEKO_DEPS
|
2020-01-25 00:58:22 +01:00
|
|
|
${SRC_FILES}
|
|
|
|
${UI_HEADERS}
|
|
|
|
${MOC_HEADERS}
|
|
|
|
${TRANSLATION_DEPS}
|
|
|
|
${META_FILES_TO_INCLUDE})
|
2017-10-08 15:49:56 +02:00
|
|
|
|
2018-05-04 17:11:03 +02:00
|
|
|
if(ASAN)
|
2020-01-25 00:58:22 +01:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined")
|
2018-05-04 17:11:03 +02:00
|
|
|
endif()
|
|
|
|
|
2020-03-23 11:09:27 +01:00
|
|
|
if(WIN32)
|
|
|
|
add_executable (nheko WIN32 ${OS_BUNDLE} ${NHEKO_DEPS})
|
|
|
|
else()
|
|
|
|
add_executable (nheko ${OS_BUNDLE} ${NHEKO_DEPS})
|
|
|
|
endif()
|
|
|
|
|
2017-10-08 15:49:56 +02:00
|
|
|
if(APPLE)
|
2020-01-25 00:58:22 +01:00
|
|
|
target_link_libraries (nheko PRIVATE Qt5::MacExtras)
|
2017-10-08 15:49:56 +02:00
|
|
|
elseif(WIN32)
|
2020-01-25 00:58:22 +01:00
|
|
|
target_compile_definitions(nheko PRIVATE WIN32_LEAN_AND_MEAN)
|
|
|
|
target_link_libraries (nheko PRIVATE ${NTDLIB} Qt5::WinMain)
|
2017-10-08 15:49:56 +02:00
|
|
|
else()
|
2020-01-25 00:58:22 +01:00
|
|
|
target_link_libraries (nheko PRIVATE Qt5::DBus)
|
2017-05-02 03:22:33 +02:00
|
|
|
endif()
|
2020-05-09 23:31:00 +02:00
|
|
|
target_include_directories(nheko PRIVATE src includes third_party/blurhash third_party/cpp-httplib-0.5.12)
|
2018-01-09 19:34:01 +01:00
|
|
|
|
2020-01-25 00:58:22 +01:00
|
|
|
target_link_libraries(nheko PRIVATE
|
|
|
|
MatrixClient::MatrixClient
|
|
|
|
Boost::iostreams
|
|
|
|
Boost::system
|
|
|
|
Boost::thread
|
|
|
|
cmark::cmark
|
|
|
|
spdlog::spdlog
|
|
|
|
Qt5::Widgets
|
|
|
|
Qt5::Svg
|
|
|
|
Qt5::Concurrent
|
|
|
|
Qt5::Multimedia
|
|
|
|
Qt5::Qml
|
|
|
|
Qt5::QuickControls2
|
|
|
|
Qt5::QuickWidgets
|
|
|
|
nlohmann_json::nlohmann_json
|
|
|
|
lmdbxx::lmdbxx
|
2020-02-14 00:32:08 +01:00
|
|
|
liblmdb::lmdb
|
2020-02-23 13:40:04 +01:00
|
|
|
tweeny
|
|
|
|
SingleApplication::SingleApplication)
|
2020-01-25 00:58:22 +01:00
|
|
|
|
2020-05-25 13:02:31 +02:00
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
|
|
|
|
target_precompile_headers(nheko
|
|
|
|
PRIVATE
|
|
|
|
<string>
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-02-14 00:32:08 +01:00
|
|
|
if(MSVC)
|
|
|
|
target_link_libraries(nheko PRIVATE ntdll)
|
2020-01-25 00:58:22 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2019-12-14 23:48:02 +01:00
|
|
|
if(QML_DEBUGGING)
|
|
|
|
target_compile_definitions(nheko PRIVATE QML_DEBUGGING)
|
|
|
|
endif()
|
|
|
|
|
2020-01-25 00:58:22 +01:00
|
|
|
|
|
|
|
if(NOT MSVC)
|
|
|
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR CI_BUILD)
|
|
|
|
target_compile_options(nheko PRIVATE "-Werror")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2019-06-26 12:27:43 +02:00
|
|
|
set_target_properties(nheko PROPERTIES SKIP_BUILD_RPATH TRUE)
|
|
|
|
|
2018-01-09 19:34:01 +01:00
|
|
|
if(UNIX AND NOT APPLE)
|
2020-01-25 00:58:22 +01:00
|
|
|
install (TARGETS nheko RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
|
|
|
install (FILES "resources/nheko-16.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps" RENAME "nheko.png")
|
|
|
|
install (FILES "resources/nheko-32.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps" RENAME "nheko.png")
|
|
|
|
install (FILES "resources/nheko-48.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps" RENAME "nheko.png")
|
|
|
|
install (FILES "resources/nheko-64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/64x64/apps" RENAME "nheko.png")
|
|
|
|
install (FILES "resources/nheko-128.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps" RENAME "nheko.png")
|
|
|
|
install (FILES "resources/nheko-256.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps" RENAME "nheko.png")
|
|
|
|
install (FILES "resources/nheko-512.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps" RENAME "nheko.png")
|
2020-01-31 02:30:09 +01:00
|
|
|
install (FILES "resources/nheko.svg" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps" RENAME "nheko.svg")
|
2020-01-25 00:58:22 +01:00
|
|
|
install (FILES "resources/nheko.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
|
|
|
|
install (FILES "resources/nheko.appdata.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
|
|
|
|
|
|
|
|
if(NOT TARGET uninstall)
|
|
|
|
configure_file(
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
|
|
|
IMMEDIATE @ONLY)
|
|
|
|
add_custom_target(uninstall
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
|
|
|
endif()
|
2018-01-09 19:34:01 +01:00
|
|
|
endif()
|