Added install rules for tests (#6344)

* Moved cmake/templates to <root>

* Removed ngraph versioning, reused IE one

* Merged converage

* Removed duplicatde ngraph cmake options

* Moved dependencies to <root>/cmake

* Removed installing of VERSION

* Start #1

* cpack

* Added component type

* Added installation of tests targets

* Added ngraph tests target install

* Fixed runtime dependencies location

* Disable GNA unit tests

* Revert "Disable GNA unit tests"

This reverts commit da5398622f.

* Installed only core component

* Replaced ENABLE_DEV_PKG_INSTALL with EXCLUDE_FROM_ALL

* Removed extra cmake options
This commit is contained in:
Ilya Lavrenov 2021-06-25 15:17:17 +03:00 committed by GitHub
parent 5f90f33731
commit 391aeebf7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 117 additions and 20 deletions

View File

@ -95,7 +95,6 @@ if(THREADING STREQUAL "OMP")
install(FILES ${source_list} install(FILES ${source_list}
DESTINATION "deployment_tools/inference_engine/external/omp/lib" DESTINATION "deployment_tools/inference_engine/external/omp/lib"
COMPONENT omp) COMPONENT omp)
endif() endif()
## TBB package ## TBB package

View File

@ -159,4 +159,9 @@ function(addIeTargetTest)
add_test(NAME ${ARG_NAME} COMMAND ${ARG_NAME}) add_test(NAME ${ARG_NAME} COMMAND ${ARG_NAME})
set_property(TEST ${ARG_NAME} PROPERTY LABELS ${ARG_LABELS}) set_property(TEST ${ARG_NAME} PROPERTY LABELS ${ARG_LABELS})
install(TARGETS ${ARG_NAME}
RUNTIME DESTINATION tests
COMPONENT tests
EXCLUDE_FROM_ALL)
endfunction() endfunction()

View File

@ -2,16 +2,15 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
include(CMakeParseArguments)
include(CPackComponent) include(CPackComponent)
unset(IE_CPACK_COMPONENTS_ALL CACHE)
set(IE_CPACK_IE_DIR deployment_tools/inference_engine)
# #
# ie_cpack_set_library_dir() # ie_cpack_set_library_dir()
# #
# Set library directory for cpack # Set library directory for cpack
# #
set(IE_CPACK_IE_DIR deployment_tools/inference_engine)
function(ie_cpack_set_library_dir) function(ie_cpack_set_library_dir)
if(WIN32) if(WIN32)
set(IE_CPACK_LIBRARY_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} PARENT_SCOPE) set(IE_CPACK_LIBRARY_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} PARENT_SCOPE)
@ -31,25 +30,44 @@ ie_cpack_set_library_dir()
# #
# Wraps original `cpack_add_component` and adds component to internal IE list # Wraps original `cpack_add_component` and adds component to internal IE list
# #
unset(IE_CPACK_COMPONENTS_ALL CACHE)
macro(ie_cpack_add_component NAME) macro(ie_cpack_add_component NAME)
list(APPEND IE_CPACK_COMPONENTS_ALL ${NAME}) list(APPEND IE_CPACK_COMPONENTS_ALL ${NAME})
set(IE_CPACK_COMPONENTS_ALL "${IE_CPACK_COMPONENTS_ALL}" CACHE STRING "" FORCE) set(IE_CPACK_COMPONENTS_ALL "${IE_CPACK_COMPONENTS_ALL}" CACHE STRING "" FORCE)
cpack_add_component(${NAME} ${ARGN})
cpack_add_component(${NAME} ${args})
endmacro() endmacro()
# create test component
if(ENABLE_TESTS)
cpack_add_component(tests DISABLED)
endif()
macro(ie_cpack) macro(ie_cpack)
set(CPACK_GENERATOR "TGZ") set(CPACK_GENERATOR "TGZ")
set(CPACK_SOURCE_GENERATOR "")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenVINO toolkit")
set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED OFF)
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) # multiple components
set(CPACK_PACKAGE_VENDOR "Intel Corporation")
set(CPACK_VERBATIM_VARIABLES ON)
set(CPACK_COMPONENTS_ALL ${ARGN})
set(CPACK_STRIP_FILES ON)
set(CPACK_THREADS 8)
string(REPLACE "/" "_" CPACK_PACKAGE_VERSION "${CI_BUILD_NUMBER}") string(REPLACE "/" "_" CPACK_PACKAGE_VERSION "${CI_BUILD_NUMBER}")
if(WIN32) if(WIN32)
set(CPACK_PACKAGE_NAME inference-engine_${CMAKE_BUILD_TYPE}) set(CPACK_PACKAGE_NAME inference-engine_${CMAKE_BUILD_TYPE})
else() else()
set(CPACK_PACKAGE_NAME inference-engine) set(CPACK_PACKAGE_NAME inference-engine)
endif() endif()
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) foreach(ver IN LISTS MAJOR MINOR PATCH)
set(CPACK_PACKAGE_VENDOR "Intel") if(DEFINED IE_VERSION_${ver})
set(CPACK_COMPONENTS_ALL ${ARGN}) set(CPACK_PACKAGE_VERSION_${ver} ${IE_VERSION_${ver}})
set(CPACK_STRIP_FILES ON) endif()
endforeach()
if(OS_FOLDER) if(OS_FOLDER)
set(CPACK_SYSTEM_NAME "${OS_FOLDER}") set(CPACK_SYSTEM_NAME "${OS_FOLDER}")

View File

@ -25,23 +25,33 @@ if(NOT ENABLE_DOCKER)
set(InferenceEngine_DIR ${CMAKE_BINARY_DIR}) set(InferenceEngine_DIR ${CMAKE_BINARY_DIR})
endif() endif()
if (NGRAPH_ONNX_IMPORT_ENABLE) if(NGRAPH_ONNX_IMPORT_ENABLE)
add_subdirectory(onnx_custom_op) add_subdirectory(onnx_custom_op)
endif() endif()
add_subdirectory(template_extension) add_subdirectory(template_extension)
set(all_docs_targets set(all_docs_targets
ie_docs_snippets ie_docs_snippets
template_extension template_extension templatePlugin templateFuncTests)
templatePlugin TemplateBehaviorTests TemplateFunctionalTests)
foreach(target_name IN LISTS all_docs_targets) foreach(target_name IN LISTS all_docs_targets)
if (TARGET ${target_name}) if(TARGET ${target_name})
set_target_properties(${target_name} PROPERTIES FOLDER docs) set_target_properties(${target_name} PROPERTIES FOLDER docs)
if(WIN32) if(WIN32)
set_target_properties(${target_name} PROPERTIES COMPILE_PDB_NAME ${target_name}) set_target_properties(${target_name} PROPERTIES COMPILE_PDB_NAME ${target_name})
endif() endif()
endif() endif()
endforeach() endforeach()
# install
set(install_targets template_extension)
if(ENABLE_TEMPLATE_PLUGIN)
list(APPEND install_targets templatePlugin templateFuncTests)
endif()
install(TARGETS ${install_targets}
RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL)
endif() endif()
set(LINKCHECKER_PY "" CACHE FILEPATH "Path to linkchecker.py for documentation check") set(LINKCHECKER_PY "" CACHE FILEPATH "Path to linkchecker.py for documentation check")

View File

@ -50,6 +50,5 @@ endif()
# install(TARGETS ${TARGET_NAME} # install(TARGETS ${TARGET_NAME}
# RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} # RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH}
# ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH}
# LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} # LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH}
# COMPONENT ${component_name}) # COMPONENT ${component_name})

View File

@ -81,8 +81,8 @@ foreach(firmware_name IN LISTS VPU_SUPPORTED_FIRMWARES)
VERBATIM) VERBATIM)
install(FILES ${${var_name}} install(FILES ${${var_name}}
DESTINATION ${IE_CPACK_RUNTIME_PATH} DESTINATION ${IE_CPACK_RUNTIME_PATH}
COMPONENT myriad) COMPONENT myriad)
endforeach() endforeach()
add_custom_target(vpu_copy_firmware add_custom_target(vpu_copy_firmware

View File

@ -273,6 +273,12 @@ install(FILES $<TARGET_FILE_DIR:${TARGET_NAME}>/plugins.xml
DESTINATION ${IE_CPACK_RUNTIME_PATH} DESTINATION ${IE_CPACK_RUNTIME_PATH}
COMPONENT core) COMPONENT core)
# for InferenceEngineUnitTest
install(FILES $<TARGET_FILE_DIR:${TARGET_NAME}>/plugins.xml
DESTINATION tests/lib
COMPONENT tests
EXCLUDE_FROM_ALL)
# Install cmake scripts # Install cmake scripts
install(EXPORT InferenceEngineTargets install(EXPORT InferenceEngineTargets

View File

@ -45,3 +45,13 @@ endif()
# code style # code style
add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME}) add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
# for ieFuncTests
install(TARGETS ${TARGET_NAME}
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT tests EXCLUDE_FROM_ALL)
# for InferenceEngineUnitTest
install(TARGETS ${TARGET_NAME}
RUNTIME DESTINATION tests/lib COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION tests/lib COMPONENT tests EXCLUDE_FROM_ALL)

View File

@ -56,3 +56,8 @@ openvino_developer_export_targets(COMPONENT inference_engine TARGETS ${TARGET_NA
# install(TARGETS ${TARGET_NAME} # install(TARGETS ${TARGET_NAME}
# RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core # RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core
# LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) # LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core)
# TODO: remove once install commands above are commented out
install(TARGETS ${TARGET_NAME}
RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL)

View File

@ -38,3 +38,7 @@ endif()
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine) target_link_libraries(${TARGET_NAME} PRIVATE inference_engine)
target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_PLUGIN) target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_PLUGIN)
install(TARGETS ${TARGET_NAME}
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT tests EXCLUDE_FROM_ALL)

View File

@ -68,6 +68,11 @@ function(enable_vpu TARGET_NAME FLAG_NAME PLUGIN_NAME)
add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME}) add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME})
set_property(TEST ${TARGET_NAME} PROPERTY LABELS VPU MYRIAD) set_property(TEST ${TARGET_NAME} PROPERTY LABELS VPU MYRIAD)
install(TARGETS ${TARGET_NAME}
RUNTIME DESTINATION tests
COMPONENT tests
EXCLUDE_FROM_ALL)
add_dependencies(${TARGET_NAME} ${DEPENDENCIES}) add_dependencies(${TARGET_NAME} ${DEPENDENCIES})
endfunction(enable_vpu) endfunction(enable_vpu)

View File

@ -34,3 +34,8 @@ endif()
add_test(NAME ${TARGET} COMMAND ${TARGET}) add_test(NAME ${TARGET} COMMAND ${TARGET})
set_property(TEST ${TARGET} PROPERTY LABELS IE PREPROC) set_property(TEST ${TARGET} PROPERTY LABELS IE PREPROC)
install(TARGETS ${TARGET}
RUNTIME DESTINATION tests
COMPONENT tests
EXCLUDE_FROM_ALL)

View File

@ -53,6 +53,11 @@ add_dependencies(${TARGET_NAME} ${DEPENDENCIES})
add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME}) add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME})
set_property(TEST ${TARGET_NAME} PROPERTY LABELS GNA) set_property(TEST ${TARGET_NAME} PROPERTY LABELS GNA)
install(TARGETS ${TARGET_NAME}
RUNTIME DESTINATION tests
COMPONENT tests
EXCLUDE_FROM_ALL)
if(GNA_LIBRARY_VERSION STREQUAL "GNA1") if(GNA_LIBRARY_VERSION STREQUAL "GNA1")
target_compile_definitions(${TARGET_NAME} PRIVATE GNA1_LIB) target_compile_definitions(${TARGET_NAME} PRIVATE GNA1_LIB)
endif() endif()

View File

@ -125,4 +125,9 @@ endif()
add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME}) add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME})
set_property(TEST ${TARGET_NAME} PROPERTY LABELS IE) set_property(TEST ${TARGET_NAME} PROPERTY LABELS IE)
install(TARGETS ${TARGET_NAME}
RUNTIME DESTINATION tests
COMPONENT tests
EXCLUDE_FROM_ALL)
add_dependencies(${TARGET_NAME} mock_engine) add_dependencies(${TARGET_NAME} mock_engine)

View File

@ -113,12 +113,12 @@ void GNAPropagateMatcher :: match() {
OutputsDataMap outputsInfo; OutputsDataMap outputsInfo;
auto loadNetworkFromIR = [&] () -> InferenceEngine::CNNNetwork { auto loadNetworkFromIR = [&] () -> InferenceEngine::CNNNetwork {
Core net_reader; Core core;
auto weights_fake = make_shared_blob<uint8_t>(TensorDesc(Precision::U8, auto weights_fake = make_shared_blob<uint8_t>(TensorDesc(Precision::U8,
SizeVector({std::numeric_limits<uint32_t>::max()/2}), Layout::C)); SizeVector({std::numeric_limits<uint32_t>::max()/2}), Layout::C));
weights_fake->allocate(); weights_fake->allocate();
auto net_original = net_reader.ReadNetwork(_env.model, weights_fake); auto net_original = core.ReadNetwork(_env.model, weights_fake);
size_t weightsSize = 0; size_t weightsSize = 0;
std::vector<std::string> dataBlobs = { std::vector<std::string> dataBlobs = {
"weights", "weights",
@ -157,7 +157,7 @@ void GNAPropagateMatcher :: match() {
fillWeights(weights); fillWeights(weights);
} }
auto net = net_reader.ReadNetwork(_env.model, weights); auto net = core.ReadNetwork(_env.model, weights);
sortedLayers = details::CNNNetSortTopologically(net); sortedLayers = details::CNNNetSortTopologically(net);
sortedLayers.insert(sortedLayers.end(), tiBodies.begin(), tiBodies.end()); sortedLayers.insert(sortedLayers.end(), tiBodies.begin(), tiBodies.end());

View File

@ -631,6 +631,11 @@ if (NGRAPH_INTERPRETER_ENABLE)
target_link_libraries(unit-test PRIVATE interpreter_backend) target_link_libraries(unit-test PRIVATE interpreter_backend)
endif() endif()
install(TARGETS unit-test
RUNTIME DESTINATION tests
COMPONENT tests
EXCLUDE_FROM_ALL)
############ FRONTEND ############ ############ FRONTEND ############
target_include_directories(unit-test PRIVATE ${FRONTEND_INCLUDE_PATH}) target_include_directories(unit-test PRIVATE ${FRONTEND_INCLUDE_PATH})
target_link_libraries(unit-test PRIVATE frontend_manager) target_link_libraries(unit-test PRIVATE frontend_manager)

View File

@ -14,3 +14,7 @@ target_link_libraries(mock1_ngraph_frontend PRIVATE frontend_manager)
add_dependencies(unit-test mock1_ngraph_frontend) add_dependencies(unit-test mock1_ngraph_frontend)
add_clang_format_target(mock1_ngraph_frontend_clang FOR_TARGETS mock1_ngraph_frontend) add_clang_format_target(mock1_ngraph_frontend_clang FOR_TARGETS mock1_ngraph_frontend)
install(TARGETS mock1_ngraph_frontend
RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT tests EXCLUDE_FROM_ALL)

View File

@ -64,5 +64,9 @@ if (NOT WIN32)
endif() endif()
target_include_directories(ngraph_backend PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(ngraph_backend PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
install(TARGETS ngraph_backend
RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL)
add_subdirectory(interpreter) add_subdirectory(interpreter)
add_subdirectory(ie) add_subdirectory(ie)

View File

@ -28,3 +28,7 @@ endif()
add_dependencies(ie_backend inference_engine) add_dependencies(ie_backend inference_engine)
target_include_directories(ie_backend PUBLIC ${IE_MAIN_SOURCE_DIR}/include) target_include_directories(ie_backend PUBLIC ${IE_MAIN_SOURCE_DIR}/include)
target_link_libraries(ie_backend PUBLIC ngraph_backend inference_engine) target_link_libraries(ie_backend PUBLIC ngraph_backend inference_engine)
install(TARGETS ie_backend
RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT tests EXCLUDE_FROM_ALL)

View File

@ -23,4 +23,8 @@ if (NGRAPH_INTERPRETER_ENABLE)
target_compile_definitions(interpreter_backend PRIVATE INTERPRETER_BACKEND_EXPORTS) target_compile_definitions(interpreter_backend PRIVATE INTERPRETER_BACKEND_EXPORTS)
target_link_libraries(interpreter_backend PUBLIC ngraph_backend) target_link_libraries(interpreter_backend PUBLIC ngraph_backend)
install(TARGETS interpreter_backend
RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT tests EXCLUDE_FROM_ALL)
endif() endif()