From c0d32ef319f9fad0e2857f580c763cdb14d0cbb5 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sun, 17 Jun 2018 00:23:49 +0300 Subject: [PATCH] Update CI instructions --- .ci/script.sh | 1 - CMakeLists.txt | 21 +++++++++------------ Makefile | 15 ++++++++++----- appveyor.yml | 6 ------ deps/CMakeLists.txt | 2 +- deps/cmake/Olm.cmake | 8 ++++++++ deps/cmake/OlmConfig.cmake.in | 4 ++-- deps/cmake/SpdLog.cmake | 9 +++++++-- src/dialogs/PreviewUploadOverlay.cc | 6 +++--- 9 files changed, 40 insertions(+), 32 deletions(-) diff --git a/.ci/script.sh b/.ci/script.sh index f596634..377f23e 100755 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -11,7 +11,6 @@ if [ $TRAVIS_OS_NAME == osx ]; then fi # Build & install dependencies -mkdir -p .deps/usr/{lib,include}/ cmake -Hdeps -B.deps \ -DUSE_BUNDLED_BOOST=${USE_BUNDLED_BOOST} \ -DUSE_BUNDLED_SPDLOG=${USE_BUNDLED_SPDLOG} diff --git a/CMakeLists.txt b/CMakeLists.txt index ef20be3..e9bf05b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,12 +29,6 @@ set(IDENTIFIER "com.github.mujx.nheko") add_project_meta(META_FILES_TO_INCLUDE) -set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" - CACHE PATH "Path prefix for finding dependencies") -list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}) - -include_directories(SYSTEM ${DEPS_PREFIX}/include) - if(APPLE) set(OPENSSL_ROOT_DIR /usr/local/opt/openssl) endif() @@ -208,8 +202,10 @@ set(EXTERNAL_PROJECT_DEPS "") find_package(ZLIB REQUIRED) find_package(OpenSSL REQUIRED) -find_package(MatrixStructs REQUIRED) -find_package(MatrixClient REQUIRED) +find_package(MatrixStructs 0.1.0 REQUIRED) +find_package(MatrixClient 0.1.0 REQUIRED) +find_package(Olm 2 REQUIRED) +find_package(spdlog 0.16.0 CONFIG REQUIRED) # # tweeny @@ -315,7 +311,8 @@ set(COMMON_LIBS MatrixClient::MatrixClient Qt5::Widgets Qt5::Svg - Qt5::Concurrent) + Qt5::Concurrent + Qt5::Multimedia) if(APPVEYOR_BUILD) set(NHEKO_LIBS ${COMMON_LIBS} lmdb) @@ -345,13 +342,13 @@ endif() if(APPLE) add_executable (nheko ${OS_BUNDLE} ${NHEKO_DEPS}) - target_link_libraries (nheko ${NHEKO_LIBS} Qt5::MacExtras Qt5::Multimedia) + target_link_libraries (nheko ${NHEKO_LIBS} Qt5::MacExtras) elseif(WIN32) add_executable (nheko ${OS_BUNDLE} ${ICON_FILE} ${NHEKO_DEPS}) - target_link_libraries (nheko ${NTDLIB} ${NHEKO_LIBS} Qt5::WinMain Qt5::Multimedia) + target_link_libraries (nheko ${NTDLIB} ${NHEKO_LIBS} Qt5::WinMain) else() add_executable (nheko ${OS_BUNDLE} ${NHEKO_DEPS}) - target_link_libraries (nheko ${NHEKO_LIBS} Qt5::Multimedia) + target_link_libraries (nheko ${NHEKO_LIBS}) endif() if(EXTERNAL_PROJECT_DEPS) diff --git a/Makefile b/Makefile index 833d81a..584aafa 100644 --- a/Makefile +++ b/Makefile @@ -2,25 +2,30 @@ DEPS_BUILD_DIR=.deps DEPS_SOURCE_DIR=deps debug: - @cmake -H. -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 + @cmake -H. -GNinja \ + -Bbuild \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \ + -DCMAKE_INSTALL_PREFIX=${DEPS_BUILD_DIR}/usr @cmake --build build -third_party: - @mkdir -p ${DEPS_BUILD_DIR}/usr/{lib,include}/ +third-party: @cmake -GNinja -H${DEPS_SOURCE_DIR} -B${DEPS_BUILD_DIR} \ -DCMAKE_BUILD_TYPE=Release \ -DUSE_BUNDLED_BOOST=OFF @cmake --build ${DEPS_BUILD_DIR} ci: - mkdir -p ${DEPS_BUILD_DIR}/usr/{lib,include}/ cmake -H${DEPS_SOURCE_DIR} -B${DEPS_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release cmake --build ${DEPS_BUILD_DIR} cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=RelWithDebInfo cmake --build build release: - @cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=RelWithDebInfo + @cmake -H. -GNinja \ + -Bbuild \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=${DEPS_BUILD_DIR}/usr @cmake --build build linux-install: diff --git a/appveyor.yml b/appveyor.yml index c9f3023..dfd637e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,6 @@ install: - set QT_DIR=C:\Qt\5.10.1\msvc2017_64 - set PATH=%PATH%;%QT_DIR%\bin;C:\MinGW\bin - set PATH=%PATH%;C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin - - mingw32-make.exe --version - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" - vcpkg install boost-asio:%PLATFORM%-windows @@ -28,7 +27,6 @@ install: libsodium:%PLATFORM%-windows lmdb:%PLATFORM%-windows openssl:%PLATFORM%-windows - spdlog:%PLATFORM%-windows zlib:%PLATFORM%-windows build_script: @@ -53,16 +51,12 @@ build_script: # Build & install the dependencies - cmake -G "Visual Studio 15 2017 Win64" -Hdeps -B.deps -DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake - -DCMAKE_BUILD_TYPE=Release -DUSE_BUNDLED_BOOST=OFF - -DUSE_BUNDLED_SPDLOG=OFF - -DUSE_BUNDLED_GTEST=OFF - cmake --build .deps --config Release # Build nheko - cmake -G "Visual Studio 15 2017 Win64" -H. -Bbuild -DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake - -DCMAKE_BUILD_TYPE=Release - cmake --build build --config Release after_build: diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 7ea44bb..34bcea3 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -40,7 +40,7 @@ set(MATRIX_STRUCTS_URL https://github.com/mujx/matrix-structs) set(MATRIX_STRUCTS_TAG eeb7373729a1618e2b3838407863342b88b8a0de) set(MTXCLIENT_URL https://github.com/mujx/mtxclient) -set(MTXCLIENT_TAG c566fa0a254dce3282435723eb58590880be2b53) +set(MTXCLIENT_TAG e45b1c85fce52f8ed516fd98a9cbb6a110a20d09) set(OLM_URL https://git.matrix.org/git/olm.git) set(OLM_TAG 4065c8e11a33ba41133a086ed3de4da94dcb6bae) diff --git a/deps/cmake/Olm.cmake b/deps/cmake/Olm.cmake index eb4f53e..a5b8be7 100644 --- a/deps/cmake/Olm.cmake +++ b/deps/cmake/Olm.cmake @@ -1,3 +1,9 @@ +set(WINDOWS_FLAGS "") + +if(MSVC) + set(WINDOWS_FLAGS "-DCMAKE_GENERATOR_PLATFORM=x64") +endif() + ExternalProject_Add( Olm @@ -16,11 +22,13 @@ ExternalProject_Add( -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} -DCMAKE_BUILD_TYPE=Release ${DEPS_BUILD_DIR}/olm + ${WINDOWS_FLAGS} BUILD_COMMAND ${CMAKE_COMMAND} --build ${DEPS_BUILD_DIR}/olm --config Release INSTALL_COMMAND ${CMAKE_COMMAND} --build ${DEPS_BUILD_DIR}/olm + --config Release --target install) list(APPEND THIRD_PARTY_DEPS Olm) diff --git a/deps/cmake/OlmConfig.cmake.in b/deps/cmake/OlmConfig.cmake.in index a7541f7..b670fe8 100644 --- a/deps/cmake/OlmConfig.cmake.in +++ b/deps/cmake/OlmConfig.cmake.in @@ -4,8 +4,8 @@ include(CMakeFindDependencyMacro) list(APPEND CMAKE_MODULE_PATH ${Olm_CMAKE_DIR}) list(REMOVE_AT CMAKE_MODULE_PATH -1) -if(NOT TARGET Olm::olm) +if(NOT TARGET Olm::Olm) include("${Olm_CMAKE_DIR}/OlmTargets.cmake") endif() -set(Olm_LIBRARIES Olm::olm) +set(Olm_LIBRARIES Olm::Olm) diff --git a/deps/cmake/SpdLog.cmake b/deps/cmake/SpdLog.cmake index 1335725..5a5f318 100644 --- a/deps/cmake/SpdLog.cmake +++ b/deps/cmake/SpdLog.cmake @@ -1,3 +1,9 @@ +set(WINDOWS_FLAGS "") + +if(MSVC) + set(WINDOWS_FLAGS "-DCMAKE_GENERATOR_PLATFORM=x64") +endif() + ExternalProject_Add( SpdLog @@ -10,8 +16,7 @@ ExternalProject_Add( -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} -DSPDLOG_BUILD_EXAMPLES=0 -DSPDLOG_BUILD_TESTING=0 - -DCMAKE_BUILD_TYPE=Release ${DEPS_BUILD_DIR}/spdlog -) + ${WINDOWS_FLAGS}) list(APPEND THIRD_PARTY_DEPS SpdLog) diff --git a/src/dialogs/PreviewUploadOverlay.cc b/src/dialogs/PreviewUploadOverlay.cc index db1e31f..e01d2b1 100644 --- a/src/dialogs/PreviewUploadOverlay.cc +++ b/src/dialogs/PreviewUploadOverlay.cc @@ -31,8 +31,8 @@ using namespace dialogs; -static constexpr const char *DEFAULT = "Upload %1?"; -static constexpr const char *ERROR = "Failed to load image type '%1'. Continue upload?"; +constexpr const char *DEFAULT = "Upload %1?"; +constexpr const char *ERR_MSG = "Failed to load image type '%1'. Continue upload?"; PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent) : QWidget{parent} @@ -105,7 +105,7 @@ PreviewUploadOverlay::setLabels(const QString &type, const QString &mime, uint64 { if (mediaType_ == "image") { if (!image_.loadFromData(data_)) { - titleLabel_.setText(QString{tr(ERROR)}.arg(type)); + titleLabel_.setText(QString{tr(ERR_MSG)}.arg(type)); } else { titleLabel_.setText(QString{tr(DEFAULT)}.arg(mediaType_)); }