Nlohmann build updates

This commit is contained in:
redsky17 2019-02-24 19:50:31 +00:00
parent ec83d9e6bd
commit 75fb95855d
No known key found for this signature in database
GPG Key ID: E8A1D78EF044B0CB
7 changed files with 51 additions and 9 deletions

View File

@ -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)

View File

@ -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

11
deps/CMakeLists.txt vendored
View File

@ -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)

29
deps/cmake/Json.cmake vendored Normal file
View File

@ -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)

View File

@ -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>

View File

@ -4,7 +4,7 @@
#include <QObject>
#include <QString>
#include "json.hpp"
#include "nlohmann/json.hpp"
#include <mtx/responses.hpp>
#include <mtxclient/http/client.hpp>

View File

@ -6,7 +6,7 @@
#include <QVBoxLayout>
#include <QWidget>
#include "json.hpp"
#include "nlohmann/json.hpp"
#include "Logging.h"
#include "MainWindow.h"