aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2021-01-15 08:19:22 +0100
committerGitHub <noreply@github.com>2021-01-15 08:19:22 +0100
commit544ec34b4563aacac6fd5b2f4aa64813096cd4b8 (patch)
tree878a6db1895d75c89292b8278731d63fadf248e1 /CMakeLists.txt
parent17d6e00597fdc1c8f25808735cbc728c4a6b3506 (diff)
parentb0d3ecc774ca4aec24bceb5ec1f1ded844a7213a (diff)
downloadlibquotient-544ec34b4563aacac6fd5b2f4aa64813096cd4b8.tar.gz
libquotient-544ec34b4563aacac6fd5b2f4aa64813096cd4b8.zip
Merge branch 'master' into dfaure/stricter-flags
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt151
1 files changed, 79 insertions, 72 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4bb2bd31..29dea14a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,33 +6,19 @@ endif()
set(API_VERSION "0.7")
project(Quotient VERSION "${API_VERSION}.0" LANGUAGES CXX)
-option(${PROJECT_NAME}_INSTALL_TESTS "install quotest (former qmc-example) application" ON)
-# https://github.com/quotient-im/libQuotient/issues/369
-option(${PROJECT_NAME}_ENABLE_E2EE "end-to-end encryption (E2EE) support" OFF)
+message(STATUS)
+message(STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION} ==>")
-include(CheckCXXCompilerFlag)
-if (WIN32)
- if (NOT CMAKE_INSTALL_LIBDIR)
- set(CMAKE_INSTALL_LIBDIR ".")
- endif ()
-
- if (NOT CMAKE_INSTALL_BINDIR)
- set(CMAKE_INSTALL_BINDIR ".")
- endif ()
+include(FeatureSummary)
- if (NOT CMAKE_INSTALL_INCLUDEDIR)
- set(CMAKE_INSTALL_INCLUDEDIR "include")
- endif ()
-else()
- include(GNUInstallDirs)
- set(INCLUDEDIR_INIT ${PROJECT_NAME})
-endif(WIN32)
-set(${PROJECT_NAME}_INSTALL_INCLUDEDIR
- "${CMAKE_INSTALL_INCLUDEDIR}/${INCLUDEDIR_INIT}" CACHE PATH
- "directory to install ${PROJECT_NAME} include files to")
+option(${PROJECT_NAME}_INSTALL_TESTS "install quotest (former qmc-example) application" ON)
+add_feature_info(InstallQuotest ${PROJECT_NAME}_INSTALL_TESTS
+ "the library functional test suite")
-# Instruct CMake to run moc automatically when needed.
-set(CMAKE_AUTOMOC ON)
+# https://github.com/quotient-im/libQuotient/issues/369
+option(${PROJECT_NAME}_ENABLE_E2EE "end-to-end encryption (E2EE) support" OFF)
+add_feature_info(EnableE2EE ${PROJECT_NAME}_ENABLE_E2EE
+ "end-to-end encryption (WORK IN PROGRESS)")
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
@@ -42,7 +28,12 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()
+if (CMAKE_BUILD_TYPE)
+ message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
+endif(CMAKE_BUILD_TYPE)
+message(STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" )
+include(CheckCXXCompilerFlag)
if (MSVC)
add_compile_options(/EHsc /W4
/wd4100 /wd4127 /wd4242 /wd4244 /wd4245 /wd4267 /wd4365 /wd4456 /wd4459
@@ -59,8 +50,34 @@ else()
endforeach ()
endif()
-find_package(Qt5 5.9 REQUIRED Network Gui Multimedia Test)
+if (WIN32)
+ if (NOT CMAKE_INSTALL_LIBDIR)
+ set(CMAKE_INSTALL_LIBDIR ".")
+ endif ()
+
+ if (NOT CMAKE_INSTALL_BINDIR)
+ set(CMAKE_INSTALL_BINDIR ".")
+ endif ()
+
+ if (NOT CMAKE_INSTALL_INCLUDEDIR)
+ set(CMAKE_INSTALL_INCLUDEDIR "include")
+ endif ()
+else()
+ include(GNUInstallDirs)
+ set(INCLUDEDIR_INIT ${PROJECT_NAME})
+endif(WIN32)
+set(${PROJECT_NAME}_INSTALL_INCLUDEDIR
+ "${CMAKE_INSTALL_INCLUDEDIR}/${INCLUDEDIR_INIT}" CACHE PATH
+ "directory to install ${PROJECT_NAME} include files to")
+message(STATUS "Install Prefix: ${CMAKE_INSTALL_PREFIX}")
+message(STATUS " Header files will be installed to ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_INCLUDEDIR}")
+
+# Instruct CMake to run moc automatically when needed.
+set(CMAKE_AUTOMOC ON)
+
+find_package(Qt5 5.9 REQUIRED Core Network Gui Multimedia Test)
get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE)
+message(STATUS "Using Qt ${Qt5_VERSION} at ${Qt5_Prefix}")
if (${PROJECT_NAME}_ENABLE_E2EE)
if ((NOT DEFINED USE_INTREE_LIBQOLM OR USE_INTREE_LIBQOLM)
@@ -71,19 +88,30 @@ if (${PROJECT_NAME}_ENABLE_E2EE)
set (USE_INTREE_LIBQOLM 1)
endif ()
endif ()
- if (NOT USE_INTREE_LIBQOLM)
+ if (USE_INTREE_LIBQOLM)
+ message( STATUS "Using in-tree libQtOlm")
+ find_package(Git QUIET)
+ if (GIT_FOUND)
+ execute_process(COMMAND
+ "${GIT_EXECUTABLE}" rev-parse -q HEAD
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/3rdparty/libQtOlm
+ OUTPUT_VARIABLE QTOLM_GIT_SHA1
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ message( STATUS " Library git SHA1: ${QTOLM_GIT_SHA1}")
+ endif (GIT_FOUND)
+ else ()
set(SAVED_CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
set(CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
find_package(QtOlm 3.0.1 REQUIRED)
- if (NOT QtOlm_FOUND)
- message( WARNING "libQtOlm not found; configuration will most likely fail.")
- message( WARNING "Make sure you have installed libQtOlm development files")
- message( WARNING "as a package or checked out the library sources in lib/.")
- message( WARNING "See also BUILDING.md")
- endif ()
+ set_package_properties(QtOlm PROPERTIES
+ DESCRIPTION "QtOlm is a Qt wrapper around libOlm"
+ PURPOSE "libQtOlm is required to support end-to-end encryption. See also BUILDING.md"
+ URL "https://gitlab.com/b0/libqtolm"
+ )
+ if (QtOlm_FOUND)
+ message(STATUS "Using libQtOlm ${QtOlm_VERSION} at ${QtOlm_DIR}")
+ endif()
endif ()
-else ()
- message( STATUS "End-to-end encryption (E2EE) support is turned off.")
endif ()
if (GTAD_PATH)
@@ -93,52 +121,28 @@ if (MATRIX_DOC_PATH)
get_filename_component(ABS_API_DEF_PATH "${MATRIX_DOC_PATH}/api" REALPATH)
endif ()
if (ABS_GTAD_PATH AND ABS_API_DEF_PATH)
+ message( STATUS "Using GTAD at ${ABS_GTAD_PATH}" )
+ message( STATUS "Using API files at ${ABS_API_DEF_PATH}" )
+ set(API_GENERATION_ENABLED 1)
if (NOT CLANG_FORMAT)
set(CLANG_FORMAT clang-format)
endif()
get_filename_component(ABS_CLANG_FORMAT "${CLANG_FORMAT}" PROGRAM)
-endif()
-
-message( STATUS )
-message( STATUS "=============================================================================" )
-message( STATUS " ${PROJECT_NAME} Build Information" )
-message( STATUS "=============================================================================" )
-message( STATUS "Version: ${PROJECT_VERSION}, API version: ${API_VERSION}")
-if (CMAKE_BUILD_TYPE)
- message( STATUS "Build type: ${CMAKE_BUILD_TYPE}")
-endif(CMAKE_BUILD_TYPE)
-message( STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" )
-message( STATUS "Install Prefix: ${CMAKE_INSTALL_PREFIX}" )
-message( STATUS " Header files will be installed to ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_INCLUDEDIR}" )
-message( STATUS "Using Qt ${Qt5_VERSION} at ${Qt5_Prefix}" )
-if (ABS_API_DEF_PATH AND ABS_GTAD_PATH)
- message( STATUS "Generating API stubs enabled (use --target update-api)" )
- message( STATUS " Using GTAD at ${ABS_GTAD_PATH}" )
- message( STATUS " Using API files at ${ABS_API_DEF_PATH}" )
if (ABS_CLANG_FORMAT)
+ set(API_FORMATTING_ENABLED 1)
message( STATUS "clang-format is at ${ABS_CLANG_FORMAT}")
else ()
message( STATUS "${CLANG_FORMAT} is NOT FOUND; API files won't be reformatted")
endif ()
-endif ()
-find_package(Git)
-if (${PROJECT_NAME}_ENABLE_E2EE)
- if (USE_INTREE_LIBQOLM)
- message( STATUS "Using in-tree libQtOlm")
- if (GIT_FOUND)
- execute_process(COMMAND
- "${GIT_EXECUTABLE}" rev-parse -q HEAD
- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/3rdparty/libQtOlm
- OUTPUT_VARIABLE QTOLM_GIT_SHA1
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- message( STATUS " Library git SHA1: ${QTOLM_GIT_SHA1}")
- endif (GIT_FOUND)
- else ()
- message( STATUS "Using libQtOlm ${QtOlm_VERSION} at ${QtOlm_DIR}")
- endif ()
-endif ()
-message( STATUS "=============================================================================" )
-message( STATUS )
+endif()
+add_feature_info(EnableApiCodeGeneration "${API_GENERATION_ENABLED}"
+ "build target update-api")
+add_feature_info(EnableApiFormatting "${API_FORMATTING_ENABLED}"
+ "formatting of generated API files with clang-format")
+
+message(STATUS)
+feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES
+ FATAL_ON_MISSING_REQUIRED_PACKAGES)
# Set up source files
set(lib_SRCS
@@ -179,6 +183,7 @@ set(lib_SRCS
lib/events/encryptionevent.cpp
lib/events/encryptedevent.cpp
lib/events/roomkeyevent.cpp
+ lib/events/stickerevent.cpp
lib/jobs/requestdata.cpp
lib/jobs/basejob.cpp
lib/jobs/syncjob.cpp
@@ -326,7 +331,7 @@ install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${ConfigFilesLocation}
)
-install(EXPORT_ANDROID_MK ${PROJECT_NAME}Targets DESTINATION share/ndk-modules)
+install(EXPORT_ANDROID_MK ${PROJECT_NAME}Targets DESTINATION ${CMAKE_INSTALL_DATADIR}/ndk-modules)
if (WIN32)
install(FILES mime/packages/freedesktop.org.xml DESTINATION mime/packages)
@@ -340,3 +345,5 @@ if (UNIX AND NOT APPLE)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
+
+message(STATUS "<== End of libQuotient configuration")