Build code snippets together with doc (#13541)
* Build code snippets together with doc * Added separate step for code snippets * Try to enable CI step * Disabe myriad * Try to fix Windows * Detect number of cores * Reduced build time of code snippets
This commit is contained in:
@@ -2,42 +2,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
if(NOT ENABLE_DOCKER)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
ie_add_compiler_flags(-Wall)
|
||||
endif()
|
||||
|
||||
# Detect OpenVINO
|
||||
find_package(OpenVINO QUIET
|
||||
PATHS "${CMAKE_BINARY_DIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
if(NOT OpenVINO_FOUND)
|
||||
set(OpenVINO_DIR ${CMAKE_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
add_subdirectory(snippets)
|
||||
|
||||
set(all_docs_targets
|
||||
ie_docs_snippets ov_template_func_tests
|
||||
template_extension openvino_template_extension openvino_template_plugin)
|
||||
foreach(target_name IN LISTS all_docs_targets)
|
||||
if(TARGET ${target_name})
|
||||
set_target_properties(${target_name} PROPERTIES FOLDER docs)
|
||||
if(WIN32)
|
||||
set_target_properties(${target_name} PROPERTIES COMPILE_PDB_NAME ${target_name})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# install
|
||||
|
||||
foreach(target openvino_template_plugin template_extension openvino_template_extension)
|
||||
if(TARGET ${target})
|
||||
install(TARGETS ${target}
|
||||
LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
add_subdirectory(snippets)
|
||||
|
||||
set(LINKCHECKER_PY "" CACHE FILEPATH "Path to linkchecker.py for documentation check dir.")
|
||||
set(ENABLE_OPENVINO_NOTEBOOKS OFF CACHE BOOL "Build with openvino notebooks")
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
|
||||
set(TARGET_NAME ie_docs_snippets)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
ie_add_compiler_flags(-Wall)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
|
||||
ie_add_compiler_flags(-Wno-unused-variable)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
@@ -12,6 +16,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
|
||||
endif()
|
||||
|
||||
file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/vpu/*.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/gpu/*.cpp")
|
||||
|
||||
@@ -77,7 +83,17 @@ list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/dldt_optimization_guide2.c
|
||||
# create a static library
|
||||
|
||||
add_library(${TARGET_NAME} STATIC ${SOURCES})
|
||||
target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src/core/template_extension/new/")
|
||||
target_include_directories(${TARGET_NAME} PRIVATE "${OpenVINO_SOURCE_DIR}/src/inference/include/ie"
|
||||
"${OpenVINO_SOURCE_DIR}/src/inference/include"
|
||||
"${OpenVINO_SOURCE_DIR}/src/inference/dev_api"
|
||||
"${OpenVINO_SOURCE_DIR}/src/core/include"
|
||||
"${OpenVINO_SOURCE_DIR}/src/bindings/c/include"
|
||||
"${OpenVINO_SOURCE_DIR}/src/common/transformations/include"
|
||||
"${OpenVINO_SOURCE_DIR}/src/common/preprocessing"
|
||||
"${OpenVINO_SOURCE_DIR}/src/common/util/include"
|
||||
"${OpenVINO_SOURCE_DIR}/src/common/low_precision_transformations/include"
|
||||
"${OpenVINO_SOURCE_DIR}/src/frontends/common/include"
|
||||
"${OpenVINO_SOURCE_DIR}/src/core/template_extension/new/")
|
||||
|
||||
if(OpenCL_FOUND AND OpenCL_HEADERS)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${OpenCL_LIB})
|
||||
@@ -99,17 +115,19 @@ if(OpenCV_FOUND)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE opencv_core)
|
||||
endif()
|
||||
|
||||
if(ENABLE_OV_ONNX_FRONTEND)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE openvino_onnx_frontend)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime openvino::runtime::dev)
|
||||
|
||||
# ov_ncc_naming_style(FOR_TARGET "${TARGET_NAME}"
|
||||
# SOURCE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
# ADDITIONAL_INCLUDE_DIRECTORIES
|
||||
# $<TARGET_PROPERTY:openvino::runtime,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
|
||||
# Detect OpenVINO
|
||||
find_package(OpenVINO QUIET
|
||||
PATHS "${CMAKE_BINARY_DIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
if(NOT OpenVINO_FOUND)
|
||||
set(OpenVINO_DIR ${CMAKE_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
#
|
||||
# Example
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user