diff options
author | redsky17 <joedonofry@gmail.com> | 2019-02-24 19:50:31 +0000 |
---|---|---|
committer | redsky17 <joedonofry@gmail.com> | 2019-02-24 20:05:11 +0000 |
commit | 75fb95855d9f48f531c62028c30d3b588a23710a (patch) | |
tree | efa3aca1f0e3cadd3ff34320fc1c2a35f56de3e9 | |
parent | Merge pull request #32 from Vistaus/master (diff) | |
download | nheko-75fb95855d9f48f531c62028c30d3b588a23710a.tar.xz |
Nlohmann build updates
-rw-r--r-- | CMakeLists.txt | 13 | ||||
-rw-r--r-- | appveyor.yml | 1 | ||||
-rw-r--r-- | deps/CMakeLists.txt | 11 | ||||
-rw-r--r-- | deps/cmake/Json.cmake | 29 | ||||
-rw-r--r-- | src/Cache.h | 2 | ||||
-rw-r--r-- | src/MatrixClient.h | 2 | ||||
-rw-r--r-- | src/dialogs/RawMessage.h | 2 |
7 files changed, 51 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ca343881..352542a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -251,6 +251,8 @@ set(SRC_FILES # ExternalProject dependencies set(EXTERNAL_PROJECT_DEPS "") +include(FeatureSummary) + set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_STATIC_RUNTIME OFF) set(Boost_USE_MULTITHREADED ON) @@ -269,6 +271,12 @@ find_package(MatrixClient 0.1.0 REQUIRED) find_package(Olm 2 REQUIRED) find_package(spdlog 1.0.0 CONFIG REQUIRED) find_package(cmark REQUIRED) +find_package(nlohmann_json 3.2.0) +set_package_properties(nlohmann_json PROPERTIES + DESCRIPTION "JSON for Modern C++, a C++11 header-only JSON class" + URL "https://nlohmann.github.io/json/" + TYPE REQUIRED +) if(NOT LMDBXX_INCLUDE_DIR) find_path(LMDBXX_INCLUDE_DIR @@ -296,6 +304,8 @@ include_directories(${Boost_INCLUDE_DIRS}) # local inclue directory include_directories(includes) +feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) + qt5_wrap_cpp(MOC_HEADERS # Dialogs src/dialogs/CreateRoom.h @@ -387,7 +397,8 @@ set(COMMON_LIBS Qt5::Widgets Qt5::Svg Qt5::Concurrent - Qt5::Multimedia) + Qt5::Multimedia + nlohmann_json::nlohmann_json) if(APPVEYOR_BUILD) set(NHEKO_LIBS ${COMMON_LIBS} lmdb) diff --git a/appveyor.yml b/appveyor.yml index 176c79df..d0cf82b7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,6 +21,7 @@ install: - set PATH=%PATH%;C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" - vcpkg install + nlohmann-json:%PLATFORM%-windows boost-asio:%PLATFORM%-windows boost-beast:%PLATFORM%-windows boost-iostreams:%PLATFORM%-windows diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 9d70d104..418ec82e 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -29,6 +29,7 @@ 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_CLIENT "Use the bundled version of mtxclient." ${USE_BUNDLED}) +option(USE_BUNDLED_JSON "Use the bundled version of nlohmann json." ${USE_BUNDLED}) if(USE_BUNDLED_BOOST) # bundled boost is 1.68, which requires CMake 3.12 or greater. @@ -44,11 +45,10 @@ set(BOOST_SHA256 set( MTXCLIENT_URL - https://github.com/Nheko-Reborn/mtxclient/archive/8659d011f93cad63de34a79f9b0543705d5da825.tar.gz + https://github.com/Nheko-Reborn/mtxclient/archive/67d39691666bcdf3cc660db19ccc0d9941df13fd.tar.gz ) set(MTXCLIENT_HASH - 7857a16cd2dd9c42ab51a8c188f4c60ca318eabbd6f7fd5db6815e60ef1cd3ad) - + 4aeb69a3261aec96bd1fbce2fedc10e3771d87a5a82657bab8bc6006b7f1ad10) set( TWEENY_URL https://github.com/mobius3/tweeny/archive/b94ce07cfb02a0eb8ac8aaf66137dabdaea857cf.tar.gz @@ -78,8 +78,9 @@ set(JSON_HEADER_URL set(JSON_HEADER_HASH ce6b5610a051ec6795fa11c33854abebb086f0fd67c311f5921c3c07f9531b44) -file(DOWNLOAD ${JSON_HEADER_URL} ${DEPS_INSTALL_DIR}/include/json.hpp - EXPECTED_HASH SHA256=${JSON_HEADER_HASH}) +if(USE_BUNDLED_JSON) + include(Json) +endif() if(USE_BUNDLED_BOOST) include(Boost) diff --git a/deps/cmake/Json.cmake b/deps/cmake/Json.cmake new file mode 100644 index 00000000..a37cc325 --- /dev/null +++ b/deps/cmake/Json.cmake @@ -0,0 +1,29 @@ +ExternalProject_Add( + Json + PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/Json + GIT_REPOSITORY https://github.com/nlohmann/json.git + # For shallow git clone (without downloading whole history) + # GIT_SHALLOW 1 + # For point at certain tag + GIT_TAG v3.2.0 + #disables auto update on every build + UPDATE_DISCONNECTED 1 + #disable following + CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_DIR "" INSTALL_COMMAND "" + ) +# Update json target +add_custom_target(external-Json-update + COMMENT "Updated Nlohmann/Json" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Json/src/Json + COMMAND ${GIT_EXECUTABLE} pull + DEPENDS Json) + +#ExternalProject_Add( +# json +# +# +# DOWNLOAD_COMMAND file(DOWNLOAD ${JSON_HEADER_URL} ${DEPS_INSTALL_DIR}/include/json.hpp +# EXPECTED_HASH SHA256=${JSON_HEADER_HASH}) +#) + +list(APPEND THIRD_PARTY_DEPS Json) diff --git a/src/Cache.h b/src/Cache.h index 1a133618..f06a7920 100644 --- a/src/Cache.h +++ b/src/Cache.h @@ -24,7 +24,7 @@ #include <QImage> #include <QString> -#include <json.hpp> +#include <nlohmann/json.hpp> #include <lmdb++.h> #include <mtx/events/join_rules.hpp> #include <mtx/responses.hpp> diff --git a/src/MatrixClient.h b/src/MatrixClient.h index 981c6b1c..2af57267 100644 --- a/src/MatrixClient.h +++ b/src/MatrixClient.h @@ -4,7 +4,7 @@ #include <QObject> #include <QString> -#include "json.hpp" +#include "nlohmann/json.hpp" #include <mtx/responses.hpp> #include <mtxclient/http/client.hpp> diff --git a/src/dialogs/RawMessage.h b/src/dialogs/RawMessage.h index 5a7335f4..c69fad60 100644 --- a/src/dialogs/RawMessage.h +++ b/src/dialogs/RawMessage.h @@ -6,7 +6,7 @@ #include <QVBoxLayout> #include <QWidget> -#include "json.hpp" +#include "nlohmann/json.hpp" #include "Logging.h" #include "MainWindow.h" |