From 90623dd4a191d4cce2ddd514f313f689d0a135b0 Mon Sep 17 00:00:00 2001 From: Felix Rohrbach Date: Sun, 2 Oct 2016 08:01:22 +0900 Subject: Include olm via cmake (should work on Linux and MinGW) --- cmake/FindOlm.cmake | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 cmake/FindOlm.cmake (limited to 'cmake') diff --git a/cmake/FindOlm.cmake b/cmake/FindOlm.cmake new file mode 100644 index 00000000..3fea7b46 --- /dev/null +++ b/cmake/FindOlm.cmake @@ -0,0 +1,30 @@ +# - Try to find LibOlm + +# Uses the following variables to help find libolm: +# Olm_INCLUDE_DIR - include files +# Olm_LIBRARY_DIR - libraries +# Once done this will define +# Olm_FOUND - System has olm +# Olm_INCLUDE_DIRS - The olm include directories +# Olm_LIBRARIES - The libraries needed to use olm + +find_path(Olm_INCLUDE_DIRS NAMES + olm/olm.h + olm/inbound_group_session.h + olm/outbound_group_session.h + PATHS "${Olm_INCLUDE_DIR}" + DOC "Path to a directory with libolm header files" +) + +find_library(Olm_LIBRARIES NAMES olm + PATHS "${Olm_LIBRARY_DIR}" + DOC "Path to a directory with libolm libraries" +) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set OLM_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(olm DEFAULT_MSG + Olm_LIBRARIES Olm_INCLUDE_DIRS) + +mark_as_advanced(Olm_INCLUDE_DIRS Olm_LIBRARIES) -- cgit v1.2.3 From af623d68df8cec92277e9a40f18beac617b5d397 Mon Sep 17 00:00:00 2001 From: Alexey Andreyev Date: Fri, 24 May 2019 15:18:14 +0300 Subject: Add libQtOlm --- .gitmodules | 3 +++ CMakeLists.txt | 39 +++++++++++++++++++++++++++++++++------ cmake/QMatrixClientConfig.cmake | 3 +++ lib/libQtOlm | 1 + 4 files changed, 40 insertions(+), 6 deletions(-) create mode 160000 lib/libQtOlm (limited to 'cmake') diff --git a/.gitmodules b/.gitmodules index e69de29b..23158cd2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/libQtOlm"] + path = lib/libQtOlm + url = git@gitlab.com:aa13q/libqtolm.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 92d8a969..6b6cd0f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,6 @@ if (NOT WIN32) endif(NOT WIN32) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -include(cmake/FindOlm.cmake) # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -53,8 +52,24 @@ endforeach () # upstream Qt 5.4 is required. find_package(Qt5 5.4.1 REQUIRED Network Gui Multimedia) get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE) -find_package(Olm REQUIRED) -get_filename_component(Olm_Prefix "${Olm_INCLUDE_DIRS}/.." ABSOLUTE) + +if ((NOT DEFINED USE_INTREE_LIBQOLM OR USE_INTREE_LIBQOLM) + AND EXISTS ${PROJECT_SOURCE_DIR}/lib/libQtOlm/lib/utils.h) + add_subdirectory(lib/libQtOlm EXCLUDE_FROM_ALL) + include_directories(lib/libQtOlm) + if (NOT DEFINED USE_INTREE_LIBQOLM) + set (USE_INTREE_LIBQOLM 1) + endif () +endif () +if (NOT USE_INTREE_LIBQOLM) + find_package(QtOlm 0.1.0 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 () +endif () if (GTAD_PATH) get_filename_component(ABS_GTAD_PATH "${GTAD_PATH}" ABSOLUTE) @@ -78,7 +93,20 @@ if (MATRIX_DOC_PATH AND GTAD_PATH) message( STATUS "Generating API stubs enabled" ) message( STATUS " Using GTAD at ${ABS_GTAD_PATH}" ) message( STATUS " Using API files at ${ABS_API_DEF_PATH}" ) - message( STATUS "Using libolm at ${Olm_Prefix}" ) +endif () +find_package(Git) +if (USE_INTREE_LIBQOLM) + message( STATUS "Using in-tree libQtOlm") + if (GIT_FOUND) + execute_process(COMMAND + "${GIT_EXECUTABLE}" rev-parse -q HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/libQtOlm/lib + OUTPUT_VARIABLE LIB_GIT_SHA1 + OUTPUT_STRIP_TRAILING_WHITESPACE) + message( STATUS " Library git SHA1: ${LIB_GIT_SHA1}") + endif (GIT_FOUND) +else () + message( STATUS "Using libQtOlm ${QtOlm_VERSION} at ${QtOlm_DIR}") endif () message( STATUS "=============================================================================" ) message( STATUS ) @@ -168,9 +196,8 @@ set_property(TARGET QMatrixClient APPEND PROPERTY target_include_directories(QMatrixClient PUBLIC $ $ - "${Olm_INCLUDE_DIRS}" ) -target_link_libraries(QMatrixClient Qt5::Core Qt5::Network Qt5::Gui Qt5::Multimedia ${Olm_LIBRARIES}) +target_link_libraries(QMatrixClient QtOlm Qt5::Core Qt5::Network Qt5::Gui Qt5::Multimedia) add_executable(qmc-example ${example_SRCS}) target_link_libraries(qmc-example Qt5::Core QMatrixClient) diff --git a/cmake/QMatrixClientConfig.cmake b/cmake/QMatrixClientConfig.cmake index 900038a5..64180cca 100644 --- a/cmake/QMatrixClientConfig.cmake +++ b/cmake/QMatrixClientConfig.cmake @@ -1 +1,4 @@ +include(CMakeFindDependencyMacro) + +find_dependency(QtOlm) include("${CMAKE_CURRENT_LIST_DIR}/QMatrixClientTargets.cmake") diff --git a/lib/libQtOlm b/lib/libQtOlm new file mode 160000 index 00000000..37bebdc9 --- /dev/null +++ b/lib/libQtOlm @@ -0,0 +1 @@ +Subproject commit 37bebdc96aee620df44d211ef91b55b86d8cfbc7 -- cgit v1.2.3 From b5f9e1bd20f985c18ec630fa496510018547b728 Mon Sep 17 00:00:00 2001 From: Alexey Andreyev Date: Wed, 26 Jun 2019 16:36:45 +0300 Subject: Change libQtOlm location. Fix .travis.yml and .appveyor.yml --- .appveyor.yml | 3 +++ .gitmodules | 6 +++--- .travis.yml | 10 +++------- 3rdparty/libQtOlm | 1 + CMakeLists.txt | 17 ++++++----------- cmake/FindOlm.cmake | 30 ------------------------------ lib/libQtOlm | 1 - 7 files changed, 16 insertions(+), 52 deletions(-) create mode 160000 3rdparty/libQtOlm delete mode 100644 cmake/FindOlm.cmake delete mode 160000 lib/libQtOlm (limited to 'cmake') diff --git a/.appveyor.yml b/.appveyor.yml index 410ad12e..fb5903c1 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -26,6 +26,9 @@ init: before_build: - git submodule update --init --recursive +- cd 3rdparty/libQtOlm +- git clone https://gitlab.matrix.org/matrix-org/olm.git +- cd ../.. - if %MAKETOOL% == cmake cmake -G "NMake Makefiles JOM" -H. -Bbuild -DCMAKE_CXX_FLAGS="/EHsc /W3" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="%DEPLOY_DIR%" build_script: diff --git a/.gitmodules b/.gitmodules index 23158cd2..eb4c1815 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "lib/libQtOlm"] - path = lib/libQtOlm - url = git@gitlab.com:aa13q/libqtolm.git +[submodule "3rdparty/libQtOlm"] + path = 3rdparty/libQtOlm + url = https://gitlab.com/b0/libqtolm.git diff --git a/.travis.yml b/.travis.yml index 72be46cb..859cabfc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,13 +32,9 @@ before_install: - if [ "$TRAVIS_OS_NAME" = "linux" ]; then USE_NINJA="-GNinja"; VALGRIND="valgrind $VALGRIND_OPTIONS"; . /opt/qt57/bin/qt57-env.sh; fi install: -# olm -- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; else sudo apt-get update -qq; fi -- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install qt5; export PATH="$PATH:/usr/local/opt/qt/bin"; else sudo apt-get install -y qt5-default; fi -- git clone https://matrix.org/git/olm.git && cd olm && make && sudo make install && cd .. -- mkdir build && cd build -- cmake .. -# matrix-doc and gtad +- pushd 3rdparty/libQtOlm +- git clone https://gitlab.matrix.org/matrix-org/olm.git +- popd - git clone https://github.com/QMatrixClient/matrix-doc.git - git clone --recursive https://github.com/KitsuneRal/gtad.git - pushd gtad diff --git a/3rdparty/libQtOlm b/3rdparty/libQtOlm new file mode 160000 index 00000000..f610197b --- /dev/null +++ b/3rdparty/libQtOlm @@ -0,0 +1 @@ +Subproject commit f610197ba38ef87bbab8bcff1053bda684a5994a diff --git a/CMakeLists.txt b/CMakeLists.txt index d3906ffb..19fbdcbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,11 +10,6 @@ if (NOT WIN32) include(GNUInstallDirs) endif(NOT WIN32) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - -# Find includes in corresponding build directories -set(CMAKE_INCLUDE_CURRENT_DIR ON) - # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) @@ -54,9 +49,9 @@ find_package(Qt5 5.4.1 REQUIRED Network Gui Multimedia) get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE) if ((NOT DEFINED USE_INTREE_LIBQOLM OR USE_INTREE_LIBQOLM) - AND EXISTS ${PROJECT_SOURCE_DIR}/lib/libQtOlm/lib/utils.h) - add_subdirectory(lib/libQtOlm EXCLUDE_FROM_ALL) - include_directories(lib/libQtOlm) + AND EXISTS ${PROJECT_SOURCE_DIR}/3rdparty/libQtOlm/lib/utils.h) + add_subdirectory(3rdparty/libQtOlm EXCLUDE_FROM_ALL) + include_directories(3rdparty/libQtOlm) if (NOT DEFINED USE_INTREE_LIBQOLM) set (USE_INTREE_LIBQOLM 1) endif () @@ -100,10 +95,10 @@ if (USE_INTREE_LIBQOLM) if (GIT_FOUND) execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse -q HEAD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/libQtOlm/lib - OUTPUT_VARIABLE LIB_GIT_SHA1 + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/3rdparty/libQtOlm + OUTPUT_VARIABLE QTOLM_GIT_SHA1 OUTPUT_STRIP_TRAILING_WHITESPACE) - message( STATUS " Library git SHA1: ${LIB_GIT_SHA1}") + message( STATUS " Library git SHA1: ${QTOLM_GIT_SHA1}") endif (GIT_FOUND) else () message( STATUS "Using libQtOlm ${QtOlm_VERSION} at ${QtOlm_DIR}") diff --git a/cmake/FindOlm.cmake b/cmake/FindOlm.cmake deleted file mode 100644 index 3fea7b46..00000000 --- a/cmake/FindOlm.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# - Try to find LibOlm - -# Uses the following variables to help find libolm: -# Olm_INCLUDE_DIR - include files -# Olm_LIBRARY_DIR - libraries -# Once done this will define -# Olm_FOUND - System has olm -# Olm_INCLUDE_DIRS - The olm include directories -# Olm_LIBRARIES - The libraries needed to use olm - -find_path(Olm_INCLUDE_DIRS NAMES - olm/olm.h - olm/inbound_group_session.h - olm/outbound_group_session.h - PATHS "${Olm_INCLUDE_DIR}" - DOC "Path to a directory with libolm header files" -) - -find_library(Olm_LIBRARIES NAMES olm - PATHS "${Olm_LIBRARY_DIR}" - DOC "Path to a directory with libolm libraries" -) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set OLM_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(olm DEFAULT_MSG - Olm_LIBRARIES Olm_INCLUDE_DIRS) - -mark_as_advanced(Olm_INCLUDE_DIRS Olm_LIBRARIES) diff --git a/lib/libQtOlm b/lib/libQtOlm deleted file mode 160000 index 5bfc4241..00000000 --- a/lib/libQtOlm +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5bfc42417d8ee741d2f5a723a2939c895734b92b -- cgit v1.2.3