diff options
-rw-r--r-- | .travis.yml | 7 | ||||
-rw-r--r-- | CMakeLists.txt | 13 | ||||
-rw-r--r-- | cmake/FindOlm.cmake | 30 |
3 files changed, 49 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml index 3aaa4039..72be46cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,13 @@ 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 - git clone https://github.com/QMatrixClient/matrix-doc.git - git clone --recursive https://github.com/KitsuneRal/gtad.git - pushd gtad diff --git a/CMakeLists.txt b/CMakeLists.txt index ca597469..6718000c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,12 @@ if (NOT WIN32) include(GNUInstallDirs) 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) + # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) @@ -47,6 +53,8 @@ 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 (GTAD_PATH) get_filename_component(ABS_GTAD_PATH "${GTAD_PATH}" ABSOLUTE) @@ -64,11 +72,13 @@ 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 "Using Qt ${Qt5_VERSION} at ${Qt5_Prefix}" ) 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 () message( STATUS "=============================================================================" ) message( STATUS ) @@ -157,8 +167,9 @@ set_property(TARGET QMatrixClient APPEND PROPERTY target_include_directories(QMatrixClient PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> + "${Olm_INCLUDE_DIRS}" ) -target_link_libraries(QMatrixClient Qt5::Core Qt5::Network Qt5::Gui Qt5::Multimedia) +target_link_libraries(QMatrixClient Qt5::Core Qt5::Network Qt5::Gui Qt5::Multimedia ${Olm_LIBRARIES}) add_executable(qmc-example ${example_SRCS}) target_link_libraries(qmc-example Qt5::Core QMatrixClient) 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) |