-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR #11587 from Eran: external json & pybind11_json
- Loading branch information
Showing
33 changed files
with
165 additions
and
24,851 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
include(ExternalProject) | ||
|
||
|
||
|
||
# We use a function to enforce a scoped variables creation only for the build | ||
# (i.e turn off BUILD_SHARED_LIBS which is used on LRS build as well) | ||
function(get_nlohmann_json) | ||
|
||
message( STATUS #CHECK_START | ||
"Fetching nlohmann/json..." ) | ||
#list( APPEND CMAKE_MESSAGE_INDENT " " ) # Indent outputs | ||
|
||
# We want to clone the pybind repo and build it here, during configuration, so we can use it. | ||
# But ExternalProject_add is limited in that it only does its magic during build. | ||
# This is possible in CMake 3.12+ with FetchContent and FetchContent_MakeAvailable in 3.14+ (meaning Ubuntu 20) | ||
# but we need to adhere to CMake 3.10 (Ubuntu 18). | ||
# So instead, we invoke a new CMake project just to download pybind: | ||
configure_file( CMake/json-download.cmake.in | ||
${CMAKE_BINARY_DIR}/external-projects/json-download/CMakeLists.txt ) | ||
execute_process( COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . | ||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/external-projects/json-download" | ||
OUTPUT_QUIET | ||
RESULT_VARIABLE configure_ret ) | ||
execute_process( COMMAND "${CMAKE_COMMAND}" --build . | ||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/external-projects/json-download" | ||
OUTPUT_QUIET | ||
RESULT_VARIABLE build_ret ) | ||
|
||
if( configure_ret OR build_ret ) | ||
message( FATAL_ERROR "Failed to download nlohmann/json" ) | ||
endif() | ||
|
||
message( STATUS #CHECK_PASS | ||
"Fetching nlohmann/json - Done" ) | ||
#list( POP_BACK CMAKE_MESSAGE_INDENT ) # Unindent outputs (requires cmake 3.15) | ||
|
||
endfunction() | ||
|
||
# Trigger the build | ||
get_nlohmann_json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
project(nlohmann-json-download NONE) | ||
|
||
include(ExternalProject) | ||
ExternalProject_Add( | ||
nlohmann_json | ||
PREFIX . | ||
GIT_REPOSITORY "https://github.com/nlohmann/json.git" | ||
#GIT_TAG v3.11.2 | ||
GIT_CONFIG advice.detachedHead=false # otherwise we'll get "You are in 'detached HEAD' state..." | ||
SOURCE_DIR "${CMAKE_BINARY_DIR}/third-party/json" | ||
GIT_SHALLOW 1 # No history needed (requires cmake 3.6) | ||
# Override default steps with no action, we just want the clone step. | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND "" | ||
INSTALL_COMMAND "" | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
project(pybind11-json-download NONE) | ||
|
||
include(ExternalProject) | ||
ExternalProject_Add( | ||
pybind11_json | ||
PREFIX . | ||
GIT_REPOSITORY "https://github.com/pybind/pybind11_json.git" | ||
GIT_TAG 0.2.13 | ||
GIT_CONFIG advice.detachedHead=false # otherwise we'll get "You are in 'detached HEAD' state..." | ||
SOURCE_DIR "${CMAKE_BINARY_DIR}/third-party/pybind11-json" | ||
GIT_SHALLOW ON # No history needed (requires cmake 3.6) | ||
# Override default steps with no action, we just want the clone step. | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND "" | ||
INSTALL_COMMAND "" | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.