From fb2c087e38eb8ee476b388bf0fa925b250050579 Mon Sep 17 00:00:00 2001 From: Max Golovanov Date: Fri, 28 Aug 2020 03:30:25 -0700 Subject: [PATCH 1/5] Add json.hpp to CI and Build Tools --- ci/setup_cmake.sh | 6 ++++-- ci/setup_windows_ci_environment.ps1 | 5 +++++ ext/CMakeLists.txt | 2 ++ tools/setup-buildtools-mac.sh | 3 +++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ci/setup_cmake.sh b/ci/setup_cmake.sh index 34097dbaa3..b4011c6930 100755 --- a/ci/setup_cmake.sh +++ b/ci/setup_cmake.sh @@ -4,13 +4,15 @@ set -e export DEBIAN_FRONTEND=noninteractive apt-get update -apt-get install --no-install-recommends --no-install-suggests -y \ +apt-get install --ignore-missing --no-install-recommends --no-install-suggests -y \ cmake \ libbenchmark-dev \ libgtest-dev \ zlib1g-dev \ sudo \ - libcurl4-openssl-dev + libcurl4-openssl-dev \ + nlohmann-json-dev \ + nlohmann-json3-dev # Follows these instructions for setting up gtest # https://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/ diff --git a/ci/setup_windows_ci_environment.ps1 b/ci/setup_windows_ci_environment.ps1 index 6e2c91e467..8a935d6a5d 100755 --- a/ci/setup_windows_ci_environment.ps1 +++ b/ci/setup_windows_ci_environment.ps1 @@ -11,5 +11,10 @@ $VCPKG_DIR=(Get-Item -Path ".\").FullName # Patched Google Benchmark can be shared between vs2017 and vs2019 compilers ./vcpkg install --overlay-ports="$PSScriptRoot\ports" benchmark:x64-windows +# Google Test ./vcpkg install gtest:x64-windows + +# nlohmann-json +./vcpkg package nlohmann-json:x64-windows + Pop-Location diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index 75205ac71e..7891366866 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -1,5 +1,7 @@ add_subdirectory(src) +find_package(nlohmann_json REQUIRED) + if(BUILD_TESTING) add_subdirectory(test) endif() diff --git a/tools/setup-buildtools-mac.sh b/tools/setup-buildtools-mac.sh index b74c727df4..aee85a456f 100644 --- a/tools/setup-buildtools-mac.sh +++ b/tools/setup-buildtools-mac.sh @@ -26,3 +26,6 @@ sudo chown -R $(whoami) /usr/local/etc/bash_completion.d /usr/local/include /usr brew install cmake brew install wget brew install clang-format +brew install google-benchmark +brew tap nlohmann/json +brew install nlohmann-json From 4b7f1202df07cc78aab92db986703f2bf50619ba Mon Sep 17 00:00:00 2001 From: Max Golovanov Date: Fri, 28 Aug 2020 03:38:38 -0700 Subject: [PATCH 2/5] Fix an issue with Ubuntu 18.04 not liking --ignore-missing --- ci/setup_cmake.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/setup_cmake.sh b/ci/setup_cmake.sh index b4011c6930..6a7bef7fa7 100755 --- a/ci/setup_cmake.sh +++ b/ci/setup_cmake.sh @@ -4,7 +4,7 @@ set -e export DEBIAN_FRONTEND=noninteractive apt-get update -apt-get install --ignore-missing --no-install-recommends --no-install-suggests -y \ +echo \ cmake \ libbenchmark-dev \ libgtest-dev \ @@ -12,7 +12,7 @@ apt-get install --ignore-missing --no-install-recommends --no-install-suggests - sudo \ libcurl4-openssl-dev \ nlohmann-json-dev \ - nlohmann-json3-dev + nlohmann-json3-dev | xargs -n 1 apt-get install --ignore-missing --no-install-recommends --no-install-suggests -y # Follows these instructions for setting up gtest # https://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/ From 6a8f1e4d0c8cba9c0c1a4ca02c445bfae383a7a9 Mon Sep 17 00:00:00 2001 From: Max Golovanov Date: Fri, 28 Aug 2020 03:43:58 -0700 Subject: [PATCH 3/5] Package name for json.hpp is different between Ubuntu 18.xx and 20.xx - ignore if either of these isn't found --- ci/setup_cmake.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/setup_cmake.sh b/ci/setup_cmake.sh index 6a7bef7fa7..019e073f15 100755 --- a/ci/setup_cmake.sh +++ b/ci/setup_cmake.sh @@ -4,6 +4,8 @@ set -e export DEBIAN_FRONTEND=noninteractive apt-get update + +set +e echo \ cmake \ libbenchmark-dev \ @@ -13,6 +15,7 @@ echo \ libcurl4-openssl-dev \ nlohmann-json-dev \ nlohmann-json3-dev | xargs -n 1 apt-get install --ignore-missing --no-install-recommends --no-install-suggests -y +set -e # Follows these instructions for setting up gtest # https://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/ From a4d33da21efd0d671f67bf71506c4baf29e38de7 Mon Sep 17 00:00:00 2001 From: Max Golovanov Date: Fri, 28 Aug 2020 03:57:19 -0700 Subject: [PATCH 4/5] Install either v2 or v3 of nlohmann json.hpp depending on distro --- ci/setup_cmake.sh | 1 + ext/CMakeLists.txt | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/setup_cmake.sh b/ci/setup_cmake.sh index 019e073f15..5693064c65 100755 --- a/ci/setup_cmake.sh +++ b/ci/setup_cmake.sh @@ -14,6 +14,7 @@ echo \ sudo \ libcurl4-openssl-dev \ nlohmann-json-dev \ + nlohmann-json3 \ nlohmann-json3-dev | xargs -n 1 apt-get install --ignore-missing --no-install-recommends --no-install-suggests -y set -e diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index 7891366866..75205ac71e 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -1,7 +1,5 @@ add_subdirectory(src) -find_package(nlohmann_json REQUIRED) - if(BUILD_TESTING) add_subdirectory(test) endif() From 61411fddcc8c5f46f074a6ad978b63faa8b32de8 Mon Sep 17 00:00:00 2001 From: Max Golovanov Date: Fri, 28 Aug 2020 09:51:21 -0700 Subject: [PATCH 5/5] Update setup_windows_ci_environment.ps1 Fix script bug --- ci/setup_windows_ci_environment.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/setup_windows_ci_environment.ps1 b/ci/setup_windows_ci_environment.ps1 index 8a935d6a5d..e7cdfeda97 100755 --- a/ci/setup_windows_ci_environment.ps1 +++ b/ci/setup_windows_ci_environment.ps1 @@ -15,6 +15,6 @@ $VCPKG_DIR=(Get-Item -Path ".\").FullName ./vcpkg install gtest:x64-windows # nlohmann-json -./vcpkg package nlohmann-json:x64-windows +./vcpkg install nlohmann-json:x64-windows Pop-Location