Skip to content

Commit

Permalink
include nlohmann/json during installation of geoflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Ylannl committed Apr 15, 2020
1 parent b01b5d2 commit 54710a2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DGF_USE_EXTERNAL_JSON=OFF -DCMAKE_PREFIX_PATH=D:\software -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows
cmake .. -DCMAKE_PREFIX_PATH=D:\software -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows
cmake --build . --parallel 4 --config Release
- name: Install NSIS
run: |
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Build
run: |
mkdir build && cd build
../cmake-3.15.2-Linux-x86_64/bin/cmake .. -DGF_USE_EXTERNAL_JSON=OFF -DCMAKE_INSTALL_PREFIX=~/usr
../cmake-3.15.2-Linux-x86_64/bin/cmake .. -DCMAKE_INSTALL_PREFIX=~/usr
../cmake-3.15.2-Linux-x86_64/bin/cmake --build . --parallel 4 --target install --config Release
macOS:
Expand All @@ -72,9 +72,9 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: brew install glfw glm nlohmann-json
run: brew install glfw glm
- name: Build
run: |
mkdir build && cd build
cmake .. -DGF_USE_EXTERNAL_JSON=ON
cmake ..
cmake --build . --parallel 4 --target install --config Release
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DGF_USE_EXTERNAL_JSON=OFF -DCMAKE_PREFIX_PATH=D:\software -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows
cmake .. -DCMAKE_PREFIX_PATH=D:\software -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows
cmake --build . --parallel 4 --config Release
- name: Install NSIS
run: |
Expand Down
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ project (Geoflow VERSION 0.0.1)

option(GF_BUILD_GUI "Build the GUI components of geoflow" TRUE)
option(GF_BUILD_GUI_FILE_DIALOGS "Build GUI with OS native file dialogs" TRUE)
option(GF_USE_EXTERNAL_JSON "Use an external JSON library" OFF)
# option(GF_USE_EXTERNAL_JSON "Use an external JSON library" OFF)

# dependencies
if(GF_BUILD_GUI)
find_package(glfw3 3.3 REQUIRED)
#message(STATUS "GLFW libs: ${GLFW_LIBRARIES}")
find_package(glm)
endif()
if(GF_USE_EXTERNAL_JSON)
find_package(nlohmann_json 3.2.0 REQUIRED)
endif()
# if(GF_USE_EXTERNAL_JSON)
# find_package(nlohmann_json 3.2.0 REQUIRED)
# endif()

add_subdirectory(thirdparty)
set(THREADS_PREFER_PTHREAD_FLAG ON)
Expand Down Expand Up @@ -203,6 +203,8 @@ install(TARGETS geoflow-core EXPORT geoflow-targets
PUBLIC_HEADER DESTINATION include/geoflow)
install(EXPORT geoflow-targets DESTINATION lib/cmake/geoflow)

install(FILES thirdparty/json/single_include/nlohmann/json.hpp DESTINATION include/geoflow/nlohmann)

include ( CMakePackageConfigHelpers )
configure_package_config_file(cmake/geoflow-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/geoflow-config.cmake
Expand Down
2 changes: 1 addition & 1 deletion src/geoflow/parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <variant>
#include <vector>

#include <nlohmann/json.hpp>
#include "nlohmann/json.hpp"
using json = nlohmann::json;

namespace geoflow {
Expand Down
12 changes: 6 additions & 6 deletions thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
set(GF_GIT_SUBMODULES "filesystem")
set(GF_GIT_SUBMODULES filesystem json)
if(${GF_BUILD_GUI})
set(GF_GIT_SUBMODULES ${GF_GIT_SUBMODULES} imgui)
if(${GF_BUILD_GUI_FILE_DIALOGS})
set(GF_GIT_SUBMODULES ${GF_GIT_SUBMODULES} osdialog)
endif()
endif()

if(NOT GF_USE_EXTERNAL_JSON)
set(GF_GIT_SUBMODULES ${GF_GIT_SUBMODULES} json)
endif()
# if(NOT GF_USE_EXTERNAL_JSON)
# set(GF_GIT_SUBMODULES ${GF_GIT_SUBMODULES} json)
# endif()


if(EXISTS "${PROJECT_SOURCE_DIR}/.gitmodules")
Expand All @@ -18,8 +18,8 @@ if(EXISTS "${PROJECT_SOURCE_DIR}/.gitmodules")
)
endif()

if(NOT GF_USE_EXTERNAL_JSON)
# if(NOT GF_USE_EXTERNAL_JSON)
set(JSON_BuildTests OFF CACHE INTERNAL "")
set(JSON_Install OFF CACHE INTERNAL "")
add_subdirectory(json)
endif()
# endif()

0 comments on commit 54710a2

Please sign in to comment.