diff --git a/.gitmodules b/.gitmodules index 4b624c6f867..16915b5aa7a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -59,6 +59,11 @@ [submodule "tools/pot/thirdparty/open_model_zoo"] path = tools/pot/thirdparty/open_model_zoo url = https://github.com/openvinotoolkit/open_model_zoo.git -[submodule "thirdparty/nlohmann_json"] - path = thirdparty/nlohmann_json +[submodule "thirdparty/json/nlohmann_json"] + path = thirdparty/json/nlohmann_json url = https://github.com/nlohmann/json.git + shallow = true +[submodule "thirdparty/json/nlohmann_json_schema_validator"] + path = thirdparty/json/nlohmann_json_schema_validator + url = https://github.com/pboettch/json-schema-validator.git + shallow = true diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt b/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt index 009a222e19a..6c9f0148e00 100644 --- a/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt +++ b/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt @@ -38,7 +38,7 @@ function(add_common_utils ADD_TARGET_NAME) ) # detecting regex support - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) set(USE_BOOST_RE ON) endif() if (USE_BOOST_RE) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index ec80e6c12ce..333251ffadb 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -20,7 +20,7 @@ openvino_developer_export_targets(COMPONENT openvino_common TARGETS format_reade # install C++ samples -ie_cpack_add_component(cpp_samples DEPENDS cpp_samples_deps core) +ie_cpack_add_component(cpp_samples DEPENDS core_dev) if(UNIX) install(DIRECTORY cpp/ diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt index 6c6d14af94e..ecc9c60edc4 100644 --- a/samples/cpp/CMakeLists.txt +++ b/samples/cpp/CMakeLists.txt @@ -119,6 +119,10 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cnpy") add_subdirectory(thirdparty/cnpy EXCLUDE_FROM_ALL) endif() +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json") + add_subdirectory(thirdparty/json EXCLUDE_FROM_ALL) +endif() + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/utils") add_subdirectory(common/utils) endif() diff --git a/samples/cpp/benchmark_app/CMakeLists.txt b/samples/cpp/benchmark_app/CMakeLists.txt index a17ebdae0df..0f1ee52bde2 100644 --- a/samples/cpp/benchmark_app/CMakeLists.txt +++ b/samples/cpp/benchmark_app/CMakeLists.txt @@ -54,6 +54,7 @@ endif() find_package(OpenCV COMPONENTS core QUIET) if(NOT OpenCV_FOUND) message(WARNING "OpenCV is disabled or not found, ${TARGET_NAME} will be built without OpenCV support. Set OpenCV_DIR") + target_link_libraries(${TARGET_NAME} PRIVATE nlohmann_json_schema_validator) else() target_compile_definitions(${TARGET_NAME} PRIVATE USE_OPENCV) target_link_libraries(${TARGET_NAME} PRIVATE opencv_core) diff --git a/src/common/offline_transformations/CMakeLists.txt b/src/common/offline_transformations/CMakeLists.txt index bd4c884cb05..36e41831f76 100644 --- a/src/common/offline_transformations/CMakeLists.txt +++ b/src/common/offline_transformations/CMakeLists.txt @@ -20,6 +20,7 @@ source_group("include" FILES ${PUBLIC_HEADERS}) add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${LIBRARY_SRC} ${PUBLIC_HEADERS}) target_link_libraries(${TARGET_NAME} PUBLIC ngraph inference_engine_transformations ngraph::reference + nlohmann_json_schema_validator PRIVATE openvino::itt pugixml::static) target_include_directories(${TARGET_NAME} PUBLIC ${PUBLIC_HEADERS_DIR} diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index fe0fc93fc80..8737df02196 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -192,27 +192,34 @@ endif() # nlohmann json # -if(ENABLE_SAMPLES OR ENABLE_OV_PDPD_FRONTEND OR ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_TF_FRONTEND) - add_subdirectory(nlohmann_json EXCLUDE_FROM_ALL) -endif() +add_subdirectory(json) + +openvino_developer_export_targets(COMPONENT openvino_common + TARGETS nlohmann_json nlohmann_json_schema_validator) + +ov_install_static_lib(nlohmann_json openvino_common) +ov_install_static_lib(nlohmann_json_schema_validator openvino_common) # # Install # -ie_cpack_add_component(cpp_samples_deps) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gflags DESTINATION "samples/cpp/thirdparty" - COMPONENT cpp_samples_deps + COMPONENT cpp_samples USE_SOURCE_PERMISSIONS) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/zlib DESTINATION "samples/cpp/thirdparty" - COMPONENT cpp_samples_deps + COMPONENT cpp_samples USE_SOURCE_PERMISSIONS) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cnpy DESTINATION "samples/cpp/thirdparty" - COMPONENT cpp_samples_deps + COMPONENT cpp_samples + USE_SOURCE_PERMISSIONS) + +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/json + DESTINATION "samples/cpp/thirdparty" + COMPONENT cpp_samples USE_SOURCE_PERMISSIONS) diff --git a/thirdparty/json/CMakeLists.txt b/thirdparty/json/CMakeLists.txt new file mode 100644 index 00000000000..18107b7ef82 --- /dev/null +++ b/thirdparty/json/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +# suppress shadowing names warning +set(JSON_SystemInclude ON CACHE BOOL "" FORCE) +add_subdirectory(nlohmann_json EXCLUDE_FROM_ALL) + +set(BUILD_SHARED_LIBS OFF) +set(JSON_VALIDATOR_BUILD_TESTS OFF CACHE BOOL "" FORCE) +set(JSON_VALIDATOR_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) +add_subdirectory(nlohmann_json_schema_validator EXCLUDE_FROM_ALL) + +set_target_properties(nlohmann_json_schema_validator PROPERTIES FOLDER thirdparty) + +# WA for CentOS with gcc < 4.9: override defitions to remove boost usage +set_property(TARGET nlohmann_json_schema_validator PROPERTY COMPILE_DEFINITIONS "") +set_property(TARGET nlohmann_json_schema_validator PROPERTY INTERFACE_LINK_LIBRARIES nlohmann_json) +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) + target_compile_definitions(nlohmann_json_schema_validator PRIVATE JSON_SCHEMA_NO_REGEX) + target_compile_options(nlohmann_json_schema_validator PRIVATE -Wno-missing-field-initializers -Wno-shadow) +endif() + +# WA for nlohmann_json_schema_validator: +# nlohmann_json must be in the same export set of nlohmann_json_schema_validator targets +install(TARGETS nlohmann_json EXPORT nlohmann_json_schema_validatorTargets + ARCHIVE DESTINATION lib EXCLUDE_FROM_ALL) diff --git a/thirdparty/json/nlohmann_json b/thirdparty/json/nlohmann_json new file mode 160000 index 00000000000..fec56a1a16c --- /dev/null +++ b/thirdparty/json/nlohmann_json @@ -0,0 +1 @@ +Subproject commit fec56a1a16c6e1c1b1f4e116a20e79398282626c diff --git a/thirdparty/json/nlohmann_json_schema_validator b/thirdparty/json/nlohmann_json_schema_validator new file mode 160000 index 00000000000..b1ef8628326 --- /dev/null +++ b/thirdparty/json/nlohmann_json_schema_validator @@ -0,0 +1 @@ +Subproject commit b1ef8628326cf0b53612f12784fd245e5e4382f1 diff --git a/thirdparty/nlohmann_json b/thirdparty/nlohmann_json deleted file mode 160000 index a09bfa5faa0..00000000000 --- a/thirdparty/nlohmann_json +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a09bfa5faa00da25944b07df131e0f8338d2251e