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:
parent
b8c92fce70
commit
055e34a77a
@ -59,10 +59,17 @@ if(NOT TARGET nlohmann_json::nlohmann_json)
|
|||||||
|
|
||||||
if(NOT nlohmann_json_FOUND)
|
if(NOT nlohmann_json_FOUND)
|
||||||
if(EXISTS "${Samples_SOURCE_DIR}/thirdparty/nlohmann_json")
|
if(EXISTS "${Samples_SOURCE_DIR}/thirdparty/nlohmann_json")
|
||||||
|
# OpenVINO package puts thirdparty to samples dir
|
||||||
# suppress shadowing names warning
|
# suppress shadowing names warning
|
||||||
set(JSON_SystemInclude ON CACHE BOOL "" FORCE)
|
set(JSON_SystemInclude ON CACHE BOOL "" FORCE)
|
||||||
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/nlohmann_json"
|
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/nlohmann_json"
|
||||||
"${Samples_BINARY_DIR}/thirdparty/nlohmann_json" EXCLUDE_FROM_ALL)
|
"${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()
|
else()
|
||||||
message(FATAL_ERROR "Failed to find / build nlohmann_json library")
|
message(FATAL_ERROR "Failed to find / build nlohmann_json library")
|
||||||
endif()
|
endif()
|
||||||
|
@ -25,14 +25,24 @@ if(NOT TARGET zlib::zlib)
|
|||||||
if(zlib_FOUND)
|
if(zlib_FOUND)
|
||||||
message(STATUS "${PKG_CONFIG_EXECUTABLE}: zlib (${zlib_VERSION}) is found at ${zlib_PREFIX}")
|
message(STATUS "${PKG_CONFIG_EXECUTABLE}: zlib (${zlib_VERSION}) is found at ${zlib_PREFIX}")
|
||||||
elseif(EXISTS "${Samples_SOURCE_DIR}/thirdparty/zlib")
|
elseif(EXISTS "${Samples_SOURCE_DIR}/thirdparty/zlib")
|
||||||
|
# OpenVINO package puts thirdparty to samples dir
|
||||||
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/zlib"
|
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/zlib"
|
||||||
"${Samples_BINARY_DIR}/thirdparty/zlib" EXCLUDE_FROM_ALL)
|
"${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()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EXISTS "${Samples_SOURCE_DIR}/thirdparty/cnpy")
|
if(EXISTS "${Samples_SOURCE_DIR}/thirdparty/cnpy")
|
||||||
|
# OpenVINO package puts thirdparty to samples dir
|
||||||
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/cnpy"
|
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/cnpy"
|
||||||
"${Samples_BINARY_DIR}/thirdparty/cnpy" EXCLUDE_FROM_ALL)
|
"${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()
|
endif()
|
||||||
|
|
||||||
# add sample
|
# add sample
|
||||||
|
Loading…
Reference in New Issue
Block a user