Allow running samples CMakeLists.txt as stand alone (#14826)

* Allow running samples CMakeLists.txt as stand alone

* Don't add cnpy twice

* Fix binary path
This commit is contained in:
Zlobin Vladimir authored and GitHub committed 2022-12-27 13:44:46 +00:00
1 parent b8c92fce70
commit 055e34a77a
2 files changed
+17

No files matched your search

+7
View File
@@ -59,10 +59,17 @@ if(NOT TARGET nlohmann_json::nlohmann_json)
if(NOT nlohmann_json_FOUND)
if(EXISTS "${Samples_SOURCE_DIR}/thirdparty/nlohmann_json")
# OpenVINO package puts thirdparty to samples dir
# suppress shadowing names warning
set(JSON_SystemInclude ON CACHE BOOL "" FORCE)
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/nlohmann_json"
"${Samples_BINARY_DIR}/thirdparty/nlohmann_json" EXCLUDE_FROM_ALL)
elseif(EXISTS "${Samples_SOURCE_DIR}../../thirdparty/nlohmann_json")
# Allow running samples CMakeLists.txt as stand alone from openvino sources
# suppress shadowing names warning
set(JSON_SystemInclude ON CACHE BOOL "" FORCE)
add_subdirectory("${Samples_SOURCE_DIR}../../thirdparty/nlohmann_json"
"${Samples_BINARY_DIR}/thirdparty/nlohmann_json" EXCLUDE_FROM_ALL)
else()
message(FATAL_ERROR "Failed to find / build nlohmann_json library")
endif()
+10
View File
@@ -25,14 +25,24 @@ if(NOT TARGET zlib::zlib)
if(zlib_FOUND)
message(STATUS "${PKG_CONFIG_EXECUTABLE}: zlib (${zlib_VERSION}) is found at ${zlib_PREFIX}")
elseif(EXISTS "${Samples_SOURCE_DIR}/thirdparty/zlib")
# OpenVINO package puts thirdparty to samples dir
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/zlib"
"${Samples_BINARY_DIR}/thirdparty/zlib" EXCLUDE_FROM_ALL)
elseif(EXISTS "${Samples_SOURCE_DIR}/thirdparty/zlib")
# Allow running samples CMakeLists.txt as stand alone from openvino sources
add_subdirectory("${Samples_SOURCE_DIR}/../../thirdparty/zlib"
"${Samples_BINARY_DIR}/thirdparty/zlib" EXCLUDE_FROM_ALL)
endif()
endif()
if(EXISTS "${Samples_SOURCE_DIR}/thirdparty/cnpy")
# OpenVINO package puts thirdparty to samples dir
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/cnpy"
"${Samples_BINARY_DIR}/thirdparty/cnpy" EXCLUDE_FROM_ALL)
elseif(EXISTS "${Samples_SOURCE_DIR}/../../thirdparty/cnpy" AND NOT TARGET cnpy)
# Allow running samples CMakeLists.txt as stand alone from openvino sources
add_subdirectory("${Samples_SOURCE_DIR}/../../thirdparty/cnpy"
"${Samples_BINARY_DIR}/thirdparty/cnpy" EXCLUDE_FROM_ALL)
endif()
# add sample