From 3bc8d791fb6537257ccaae883845485f4c8a1c84 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Wed, 4 Jul 2018 01:38:54 +0300 Subject: [PATCH] Don't download dependencies during build fixes #346 --- .ci/script.sh | 6 ++++-- CMakeLists.txt | 32 +++++++++++++++++--------------- appveyor.yml | 2 ++ cmake/LMDBXX.cmake | 23 ----------------------- cmake/Tweeny.cmake | 23 ----------------------- deps/CMakeLists.txt | 20 ++++++++++++++++++++ deps/cmake/Tweeny.cmake | 22 ++++++++++++++++++++++ src/timeline/TimelineView.cc | 2 +- src/ui/SnackBar.cc | 2 +- 9 files changed, 67 insertions(+), 65 deletions(-) delete mode 100644 cmake/LMDBXX.cmake delete mode 100644 cmake/Tweeny.cmake create mode 100644 deps/cmake/Tweeny.cmake diff --git a/.ci/script.sh b/.ci/script.sh index 377f23e1..6d873414 100755 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -11,13 +11,15 @@ if [ $TRAVIS_OS_NAME == osx ]; then fi # Build & install dependencies -cmake -Hdeps -B.deps \ +cmake -GNinja -Hdeps -B.deps \ -DUSE_BUNDLED_BOOST=${USE_BUNDLED_BOOST} \ -DUSE_BUNDLED_SPDLOG=${USE_BUNDLED_SPDLOG} cmake --build .deps # Build nheko -cmake -GNinja -H. -Bbuild -DCMAKE_BUILD_TYPE=RelWithDebInfo +cmake -GNinja -H. -Bbuild \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_INSTALL_PREFIX=.deps/usr cmake --build build if [ $TRAVIS_OS_NAME == osx ]; then diff --git a/CMakeLists.txt b/CMakeLists.txt index 51ec600f..840eae7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,23 +226,25 @@ find_package(MatrixClient 0.1.0 REQUIRED) find_package(Olm 2 REQUIRED) find_package(spdlog 0.16.0 CONFIG REQUIRED) -# -# tweeny -# -if(NOT TWEENY_INCLUDE_DIR) - include(Tweeny) - set(EXTERNAL_PROJECT_DEPS ${EXTERNAL_PROJECT_DEPS} Tweeny) -endif() -include_directories(SYSTEM ${TWEENY_INCLUDE_DIR}) - -# -# lmdbxx -# if(NOT LMDBXX_INCLUDE_DIR) - include(LMDBXX) - set(EXTERNAL_PROJECT_DEPS ${EXTERNAL_PROJECT_DEPS} lmdbxx) + find_path(LMDBXX_INCLUDE_DIR + NAMES lmdb++.h + PATHS /usr/include + /usr/local/include + $ENV{LIB_DIR}/include + $ENV{LIB_DIR}/include/lmdbxx) endif() -include_directories(SYSTEM ${LMDBXX_INCLUDE_DIR}) +include_directories(${LMDBXX_INCLUDE_DIR}) + +if(NOT TWEENY_INCLUDE_DIR) + find_path(TWEENY_INCLUDE_DIR + NAMES tweeny/tweeny.h + PATHS /usr/include/ + /usr/local/include/ + $ENV{LIB_DIR}/include/ + $ENV{LIB_DIR}/include/tweeny) +endif() +include_directories(${TWEENY_INCLUDE_DIR}) include_directories(include) include_directories(include/ui) diff --git a/appveyor.yml b/appveyor.yml index 3b6c4af1..ad815b1f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -61,6 +61,8 @@ build_script: # Build nheko - cmake -G "Visual Studio 15 2017 Win64" -H. -Bbuild -DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake + -DLMDBXX_INCLUDE_DIR=.deps/usr/include + -DTWEENY_INCLUDE_DIR=.deps/usr/include - cmake --build build --config Release after_build: diff --git a/cmake/LMDBXX.cmake b/cmake/LMDBXX.cmake deleted file mode 100644 index 3b9817d9..00000000 --- a/cmake/LMDBXX.cmake +++ /dev/null @@ -1,23 +0,0 @@ -include(ExternalProject) - -# -# Build lmdbxx. -# - -set(THIRD_PARTY_ROOT ${CMAKE_SOURCE_DIR}/.third-party) -set(LMDBXX_ROOT ${THIRD_PARTY_ROOT}/lmdbxx) - -set(LMDBXX_INCLUDE_DIR ${LMDBXX_ROOT}) - -ExternalProject_Add( - lmdbxx - - GIT_REPOSITORY https://github.com/bendiken/lmdbxx - GIT_TAG 0b43ca87d8cfabba392dfe884eb1edb83874de02 - - BUILD_IN_SOURCE 1 - SOURCE_DIR ${LMDBXX_ROOT} - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) diff --git a/cmake/Tweeny.cmake b/cmake/Tweeny.cmake deleted file mode 100644 index 537ac92c..00000000 --- a/cmake/Tweeny.cmake +++ /dev/null @@ -1,23 +0,0 @@ -include(ExternalProject) - -# -# Build tweeny -# - -set(THIRD_PARTY_ROOT ${CMAKE_SOURCE_DIR}/.third-party) -set(TWEENY_ROOT ${THIRD_PARTY_ROOT}/tweeny) - -set(TWEENY_INCLUDE_DIR ${TWEENY_ROOT}/include) - -ExternalProject_Add( - Tweeny - - GIT_REPOSITORY https://github.com/mobius3/tweeny - GIT_TAG b94ce07cfb02a0eb8ac8aaf66137dabdaea857cf - - BUILD_IN_SOURCE 1 - SOURCE_DIR ${TWEENY_ROOT} - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 99abbf35..c0d00d53 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -24,6 +24,8 @@ option(USE_BUNDLED "Use bundled dependencies." ON) option(USE_BUNDLED_BOOST "Use the bundled version of Boost." ${USE_BUNDLED}) option(USE_BUNDLED_SPDLOG "Use the bundled version of spdlog." ${USE_BUNDLED}) option(USE_BUNDLED_OLM "Use the bundled version of libolm." ${USE_BUNDLED}) +option(USE_BUNDLED_TWEENY "Use the bundled version of Tweeny." ${USE_BUNDLED}) +option(USE_BUNDLED_LMDBXX "Use the bundled version of lmdbxx." ${USE_BUNDLED}) option(USE_BUNDLED_MATRIX_STRUCTS "Use the bundled version of matrix-structs." ${USE_BUNDLED}) option(USE_BUNDLED_MATRIX_CLIENT "Use the bundled version of mtxclient." @@ -42,6 +44,15 @@ set(MATRIX_STRUCTS_TAG 3a052a95c555ce3ae12b8a2e0508e8bb73266fa1) set(MTXCLIENT_URL https://github.com/mujx/mtxclient) set(MTXCLIENT_TAG 73491268f94ddeb606284836bb5f512d11b0e249) +set(TWEENY_URL https://github.com/mobius3/tweeny) +set(TWEENY_TAG b94ce07cfb02a0eb8ac8aaf66137dabdaea857cf) + +set( + LMDBXX_HEADER_URL + https://raw.githubusercontent.com/bendiken/lmdbxx/0b43ca87d8cfabba392dfe884eb1edb83874de02/lmdb%2B%2B.h + ) +set(LMDBXX_SHA c57b501a4e8fa1187fa7fd348da415c7685a50a7cb25b17b3f257b9e9426f73d) + set(OLM_URL https://git.matrix.org/git/olm.git) set(OLM_TAG 4065c8e11a33ba41133a086ed3de4da94dcb6bae) @@ -64,6 +75,15 @@ if(USE_BUNDLED_MATRIX_STRUCTS) include(MatrixStructs) endif() +if(USE_BUNDLED_TWEENY) + include(Tweeny) +endif() + +if(USE_BUNDLED_LMDBXX) + file(DOWNLOAD ${LMDBXX_HEADER_URL} ${DEPS_INSTALL_DIR}/include/lmdb++.h + EXPECTED_HASH SHA256=${LMDBXX_SHA}) +endif() + if(WIN32) if("${TARGET_ARCH}" STREQUAL "X86_64") set(TARGET_ARCH x64) diff --git a/deps/cmake/Tweeny.cmake b/deps/cmake/Tweeny.cmake new file mode 100644 index 00000000..7c5b9748 --- /dev/null +++ b/deps/cmake/Tweeny.cmake @@ -0,0 +1,22 @@ +set(WINDOWS_FLAGS "") + +if(MSVC) + set(WINDOWS_FLAGS "-DCMAKE_GENERATOR_PLATFORM=x64") +endif() + +ExternalProject_Add( + Tweeny + + GIT_REPOSITORY ${TWEENY_URL} + GIT_TAG ${TWEENY_TAG} + + BUILD_IN_SOURCE 1 + SOURCE_DIR ${DEPS_BUILD_DIR}/tweeny + CONFIGURE_COMMAND ${CMAKE_COMMAND} + -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} + -DTWEENY_BUILD_EXAMPLES=OFF + -DTWEENY_BUILD_DOCUMENTATION=OFF + ${DEPS_BUILD_DIR}/tweeny + ${WINDOWS_FLAGS}) + +list(APPEND THIRD_PARTY_DEPS Tweeny) diff --git a/src/timeline/TimelineView.cc b/src/timeline/TimelineView.cc index 58387161..114c52df 100644 --- a/src/timeline/TimelineView.cc +++ b/src/timeline/TimelineView.cc @@ -489,7 +489,7 @@ TimelineView::init() scroll_widget_ = new QWidget(this); scroll_layout_ = new QVBoxLayout(scroll_widget_); - scroll_layout_->setContentsMargins(15, 0, 15, 15); + scroll_layout_->setContentsMargins(4, 0, 15, 15); scroll_layout_->addStretch(1); scroll_layout_->setSpacing(0); scroll_layout_->setObjectName("timelinescrollarea"); diff --git a/src/ui/SnackBar.cc b/src/ui/SnackBar.cc index c6e7ace8..43a4c85d 100644 --- a/src/ui/SnackBar.cc +++ b/src/ui/SnackBar.cc @@ -1,7 +1,7 @@ #include #include -#include +#include #include "SnackBar.h"