Skip to content

Commit

Permalink
Added install rules for tests (openvinotoolkit#6344)
Browse files Browse the repository at this point in the history
* 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 da53986.

* Installed only core component

* Replaced ENABLE_DEV_PKG_INSTALL with EXCLUDE_FROM_ALL

* Removed extra cmake options
  • Loading branch information
ilya-lavrenov authored Jun 25, 2021
1 parent 5f90f33 commit 391aeeb
Show file tree
Hide file tree
Showing 20 changed files with 117 additions and 20 deletions.
1 change: 0 additions & 1 deletion cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ if(THREADING STREQUAL "OMP")
install(FILES ${source_list}
DESTINATION "deployment_tools/inference_engine/external/omp/lib"
COMPONENT omp)

endif()

## TBB package
Expand Down
5 changes: 5 additions & 0 deletions cmake/developer_package/add_ie_target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,9 @@ function(addIeTargetTest)

add_test(NAME ${ARG_NAME} COMMAND ${ARG_NAME})
set_property(TEST ${ARG_NAME} PROPERTY LABELS ${ARG_LABELS})

install(TARGETS ${ARG_NAME}
RUNTIME DESTINATION tests
COMPONENT tests
EXCLUDE_FROM_ALL)
endfunction()
36 changes: 27 additions & 9 deletions cmake/developer_package/packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
# SPDX-License-Identifier: Apache-2.0
#

include(CMakeParseArguments)
include(CPackComponent)
unset(IE_CPACK_COMPONENTS_ALL CACHE)

set(IE_CPACK_IE_DIR deployment_tools/inference_engine)

#
# ie_cpack_set_library_dir()
#
# Set library directory for cpack
#
set(IE_CPACK_IE_DIR deployment_tools/inference_engine)
function(ie_cpack_set_library_dir)
if(WIN32)
set(IE_CPACK_LIBRARY_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} PARENT_SCOPE)
Expand All @@ -31,25 +30,44 @@ ie_cpack_set_library_dir()
#
# Wraps original `cpack_add_component` and adds component to internal IE list
#
unset(IE_CPACK_COMPONENTS_ALL CACHE)
macro(ie_cpack_add_component NAME)
list(APPEND IE_CPACK_COMPONENTS_ALL ${NAME})
set(IE_CPACK_COMPONENTS_ALL "${IE_CPACK_COMPONENTS_ALL}" CACHE STRING "" FORCE)
cpack_add_component(${NAME} ${ARGN})

cpack_add_component(${NAME} ${args})
endmacro()

# create test component
if(ENABLE_TESTS)
cpack_add_component(tests DISABLED)
endif()

macro(ie_cpack)
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}")
if(WIN32)
set(CPACK_PACKAGE_NAME inference-engine_${CMAKE_BUILD_TYPE})
else()
set(CPACK_PACKAGE_NAME inference-engine)
endif()
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_PACKAGE_VENDOR "Intel")
set(CPACK_COMPONENTS_ALL ${ARGN})
set(CPACK_STRIP_FILES ON)

foreach(ver IN LISTS MAJOR MINOR PATCH)
if(DEFINED IE_VERSION_${ver})
set(CPACK_PACKAGE_VERSION_${ver} ${IE_VERSION_${ver}})
endif()
endforeach()

if(OS_FOLDER)
set(CPACK_SYSTEM_NAME "${OS_FOLDER}")
Expand Down
18 changes: 14 additions & 4 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,33 @@ if(NOT ENABLE_DOCKER)
set(InferenceEngine_DIR ${CMAKE_BINARY_DIR})
endif()

if (NGRAPH_ONNX_IMPORT_ENABLE)
if(NGRAPH_ONNX_IMPORT_ENABLE)
add_subdirectory(onnx_custom_op)
endif()
add_subdirectory(template_extension)

set(all_docs_targets
ie_docs_snippets
template_extension
templatePlugin TemplateBehaviorTests TemplateFunctionalTests)
template_extension templatePlugin templateFuncTests)
foreach(target_name IN LISTS all_docs_targets)
if (TARGET ${target_name})
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

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()

set(LINKCHECKER_PY "" CACHE FILEPATH "Path to linkchecker.py for documentation check")
Expand Down
1 change: 0 additions & 1 deletion docs/template_plugin/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,5 @@ endif()

# install(TARGETS ${TARGET_NAME}
# RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH}
# ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH}
# LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH}
# COMPONENT ${component_name})
4 changes: 2 additions & 2 deletions inference-engine/cmake/vpu_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ foreach(firmware_name IN LISTS VPU_SUPPORTED_FIRMWARES)
VERBATIM)

install(FILES ${${var_name}}
DESTINATION ${IE_CPACK_RUNTIME_PATH}
COMPONENT myriad)
DESTINATION ${IE_CPACK_RUNTIME_PATH}
COMPONENT myriad)
endforeach()

add_custom_target(vpu_copy_firmware
Expand Down
6 changes: 6 additions & 0 deletions inference-engine/src/inference_engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@ install(FILES $<TARGET_FILE_DIR:${TARGET_NAME}>/plugins.xml
DESTINATION ${IE_CPACK_RUNTIME_PATH}
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(EXPORT InferenceEngineTargets
Expand Down
10 changes: 10 additions & 0 deletions inference-engine/src/readers/ir_reader_v7/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,13 @@ endif()
# code style

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)
5 changes: 5 additions & 0 deletions inference-engine/src/snippets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,8 @@ openvino_developer_export_targets(COMPONENT inference_engine TARGETS ${TARGET_NA
# install(TARGETS ${TARGET_NAME}
# RUNTIME DESTINATION ${IE_CPACK_RUNTIME_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)
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ endif()
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine)

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)
5 changes: 5 additions & 0 deletions inference-engine/tests_deprecated/behavior/vpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ function(enable_vpu TARGET_NAME FLAG_NAME PLUGIN_NAME)
add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME})
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})
endfunction(enable_vpu)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ endif()

add_test(NAME ${TARGET} COMMAND ${TARGET})
set_property(TEST ${TARGET} PROPERTY LABELS IE PREPROC)

install(TARGETS ${TARGET}
RUNTIME DESTINATION tests
COMPONENT tests
EXCLUDE_FROM_ALL)
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ add_dependencies(${TARGET_NAME} ${DEPENDENCIES})
add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME})
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")
target_compile_definitions(${TARGET_NAME} PRIVATE GNA1_LIB)
endif()
5 changes: 5 additions & 0 deletions inference-engine/tests_deprecated/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,9 @@ endif()
add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME})
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)
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ void GNAPropagateMatcher :: match() {
OutputsDataMap outputsInfo;

auto loadNetworkFromIR = [&] () -> InferenceEngine::CNNNetwork {
Core net_reader;
Core core;
auto weights_fake = make_shared_blob<uint8_t>(TensorDesc(Precision::U8,
SizeVector({std::numeric_limits<uint32_t>::max()/2}), Layout::C));
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;
std::vector<std::string> dataBlobs = {
"weights",
Expand Down Expand Up @@ -157,7 +157,7 @@ void GNAPropagateMatcher :: match() {
fillWeights(weights);
}

auto net = net_reader.ReadNetwork(_env.model, weights);
auto net = core.ReadNetwork(_env.model, weights);
sortedLayers = details::CNNNetSortTopologically(net);
sortedLayers.insert(sortedLayers.end(), tiBodies.begin(), tiBodies.end());

Expand Down
5 changes: 5 additions & 0 deletions ngraph/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,11 @@ if (NGRAPH_INTERPRETER_ENABLE)
target_link_libraries(unit-test PRIVATE interpreter_backend)
endif()

install(TARGETS unit-test
RUNTIME DESTINATION tests
COMPONENT tests
EXCLUDE_FROM_ALL)

############ FRONTEND ############
target_include_directories(unit-test PRIVATE ${FRONTEND_INCLUDE_PATH})
target_link_libraries(unit-test PRIVATE frontend_manager)
Expand Down
4 changes: 4 additions & 0 deletions ngraph/test/frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ target_link_libraries(mock1_ngraph_frontend PRIVATE frontend_manager)
add_dependencies(unit-test 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)
4 changes: 4 additions & 0 deletions ngraph/test/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,9 @@ if (NOT WIN32)
endif()
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(ie)
4 changes: 4 additions & 0 deletions ngraph/test/runtime/ie/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ endif()
add_dependencies(ie_backend inference_engine)
target_include_directories(ie_backend PUBLIC ${IE_MAIN_SOURCE_DIR}/include)
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)
4 changes: 4 additions & 0 deletions ngraph/test/runtime/interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ if (NGRAPH_INTERPRETER_ENABLE)

target_compile_definitions(interpreter_backend PRIVATE INTERPRETER_BACKEND_EXPORTS)
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()

0 comments on commit 391aeeb

Please sign in to comment.