Skip to content

Commit

Permalink
Split developer targets per component
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov committed Dec 17, 2020
1 parent 4fbf86d commit 9e5f46e
Show file tree
Hide file tree
Showing 27 changed files with 81 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .ci/azure/linux_ngraph_onnx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
- task: CMake@1
inputs:
# CMake must get Python 3.x version by default
cmakeArgs: -GNinja -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_VPU=OFF -DENABLE_GNA=OFF -DENABLE_OPENCV=OFF -DENABLE_CPPLINT=OFF -DENABLE_TESTS=OFF -DENABLE_BEH_TESTS=OFF -DENABLE_FUNCTIONAL_TESTS=OFF -DENABLE_MKL_DNN=ON -DENABLE_CLDNN=OFF -DENABLE_PROFILING_ITT=OFF -DENABLE_SAMPLES=OFF -DENABLE_SPEECH_DEMO=OFF -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -DNGRAPH_ONNX_IMPORT_ENABLE=ON -DNGRAPH_INTERPRETER_ENABLE=ON -DNGRAPH_DEBUG_ENABLE=OFF -DNGRAPH_DYNAMIC_COMPONENTS_ENABLE=ON -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) $(REPO_DIR)
cmakeArgs: -GNinja -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_VPU=OFF -DENABLE_GNA=OFF -DENABLE_OPENCV=OFF -DENABLE_CPPLINT=OFF -DENABLE_TESTS=OFF -DENABLE_MKL_DNN=ON -DENABLE_CLDNN=OFF -DENABLE_PROFILING_ITT=OFF -DENABLE_SAMPLES=OFF -DENABLE_SPEECH_DEMO=OFF -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -DNGRAPH_ONNX_IMPORT_ENABLE=ON -DNGRAPH_INTERPRETER_ENABLE=ON -DNGRAPH_DEBUG_ENABLE=OFF -DNGRAPH_DYNAMIC_COMPONENTS_ENABLE=ON -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) $(REPO_DIR)
workingDirectory: $(BUILD_DIR)
enabled: false

Expand Down
2 changes: 0 additions & 2 deletions .ci/openvino-onnx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ RUN cmake .. \
-DENABLE_OPENCV=OFF \
-DENABLE_CPPLINT=OFF \
-DENABLE_TESTS=OFF \
-DENABLE_BEH_TESTS=OFF \
-DENABLE_FUNCTIONAL_TESTS=OFF \
-DENABLE_MKL_DNN=ON \
-DENABLE_CLDNN=OFF \
-DENABLE_PROFILING_ITT=OFF \
Expand Down
30 changes: 18 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ message (STATUS "CMAKE_C_COMPILER_ID ................... " ${CMAKE_C_COMPILER_ID
message (STATUS "CMAKE_BUILD_TYPE ...................... " ${CMAKE_BUILD_TYPE})

# remove file with exported developer targets to force its regeneration
file(REMOVE "${CMAKE_BINARY_DIR}/inference_engine_targets_developer.cmake")
file(REMOVE "${CMAKE_BINARY_DIR}/inference_engine_targets.cmake")
foreach(component IN LISTS openvino_export_components)
file(REMOVE "${CMAKE_BINARY_DIR}/${component}_dev_targets.cmake")
unset(${component} CACHE)
endforeach()

#
# Build
Expand Down Expand Up @@ -117,28 +119,32 @@ function(build_ngraph)
set(NGRAPH_LIBRARIES ngraph PARENT_SCOPE)
endfunction()

file(REMOVE "${CMAKE_BINARY_DIR}/openvino_targets_developer.cmake")
unset(OpenVINODeveloperPackageTargets CACHE)

function(openvino_developer_export_targets)
set(OpenVINODeveloperPackageTargets "${OpenVINODeveloperPackageTargets};${ARGV}")
cmake_parse_arguments(EXPORT "" "COMPONENT" "TARGETS" ${ARGN})

set(${EXPORT_COMPONENT} "${${EXPORT_COMPONENT}};${EXPORT_TARGETS}")

# to allow exporting of aliased targets with the original names
foreach(target_name ${OpenVINODeveloperPackageTargets})
foreach(target_name IN LISTS ${EXPORT_COMPONENT})
if(TARGET "${target_name}")
get_target_property(original_name ${target_name} ALIASED_TARGET)
if(TARGET "${original_name}")
message(STATUS "The name ${target_name} is an ALIAS for ${original_name}. "
"It will be exported to the InferenceEngineDeveloperPackage with the original name.")
list(REMOVE_ITEM OpenVINODeveloperPackageTargets ${target_name})
list(APPEND OpenVINODeveloperPackageTargets ${original_name})
list(REMOVE_ITEM ${EXPORT_COMPONENT} ${target_name})
list(APPEND ${EXPORT_COMPONENT} ${original_name})
endif()
endif()
endforeach()

list(REMOVE_DUPLICATES OpenVINODeveloperPackageTargets)
set(OpenVINODeveloperPackageTargets "${OpenVINODeveloperPackageTargets}" CACHE INTERNAL
"Paths to extra Inference Engine plugins" FORCE)
list(REMOVE_DUPLICATES ${EXPORT_COMPONENT})
set(${EXPORT_COMPONENT} "${${EXPORT_COMPONENT}}" CACHE INTERNAL
"A list of OpenVINO ${EXPORT_COMPONENT} exported targets" FORCE)

list(APPEND openvino_export_components ${EXPORT_COMPONENT})
list(REMOVE_DUPLICATES openvino_export_components)
set(openvino_export_components "${openvino_export_components}" CACHE INTERNAL
"A list of OpenVINO exported components" FORCE)
endfunction()

add_subdirectory(openvino)
Expand Down
10 changes: 4 additions & 6 deletions cmake/developer_package/add_ie_target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Example:
addIeTarget(
NAME core_lib
ADD_CPPLINT
DEVELOPER_PACKAGE
DEVELOPER_PACKAGE <component>
TYPE <SHARED / STATIC / EXECUTABLE>
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
ADDITIONAL_SOURCE_DIRS
Expand All @@ -31,14 +31,14 @@ addIeTarget(
function(addIeTarget)
set(options
ADD_CPPLINT # Enables code style checks for the target
DEVELOPER_PACKAGE # Enables exporting of the target through the developer package
)
set(oneValueRequiredArgs
TYPE # type of target, SHARED|STATIC|EXECUTABLE. SHARED and STATIC correspond to add_library, EXECUTABLE to add_executable
NAME # name of target
ROOT # root directory to be used for recursive search of source files
)
set(oneValueOptionalArgs
DEVELOPER_PACKAGE # Enables exporting of the target through the developer package
)
set(multiValueArgs
INCLUDES # Extra include directories
Expand Down Expand Up @@ -121,10 +121,8 @@ function(addIeTarget)
endif()
if (ARG_DEVELOPER_PACKAGE)
# developer package
ie_developer_export_targets(${ARG_NAME})
if (ARG_EXPORT_DEPENDENCIES)
ie_developer_export_targets(${ARG_NAME} ${ARG_EXPORT_DEPENDENCIES})
endif()
openvino_developer_export_targets(COMPONENT ${ARG_DEVELOPER_PACKAGE}
TARGETS ${ARG_NAME} ${ARG_EXPORT_DEPENDENCIES})
endif()
if(WIN32)
# Provide default compile pdb name equal to target name
Expand Down
4 changes: 4 additions & 0 deletions cmake/developer_package/features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ ie_option (ENABLE_CLANG_FORMAT "Enable clang-format checks during the build" ON)

ie_option (VERBOSE_BUILD "shows extra information about build" OFF)

ie_option (ENABLE_UNSAFE_LOCATIONS "skip check for MD5 for dependency" OFF)

ie_option (ENABLE_ALTERNATIVE_TEMP "in case of dependency conflict, to avoid modification in master, use local copy of dependency" ON)

#
# Check features
#
Expand Down
42 changes: 12 additions & 30 deletions inference-engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,20 @@ endif()

find_package(Threads REQUIRED)

unset(IEDeveloperPackageTargets CACHE)
function(ie_developer_export_targets)
set(IEDeveloperPackageTargets "${IEDeveloperPackageTargets};${ARGV}")

# to allow exporting of aliased targets with the original names
foreach(target_name ${IEDeveloperPackageTargets})
if(TARGET "${target_name}")
get_target_property(original_name ${target_name} ALIASED_TARGET)
if(TARGET "${original_name}")
message(STATUS "The name ${target_name} is an ALIAS for ${original_name}. "
"It will be exported to the InferenceEngineDeveloperPackage with the original name.")
list(REMOVE_ITEM IEDeveloperPackageTargets ${target_name})
list(APPEND IEDeveloperPackageTargets ${original_name})
endif()
endif()
endforeach()

list(REMOVE_DUPLICATES IEDeveloperPackageTargets)
set(IEDeveloperPackageTargets "${IEDeveloperPackageTargets}" CACHE INTERNAL
"Paths to extra Inference Engine plugins" FORCE)
openvino_developer_export_targets(COMPONENT inference_engine TARGETS ${ARGN})
endfunction()

function(ie_developer_export)
export(TARGETS ${OpenVINODeveloperPackageTargets} NAMESPACE IE::
APPEND FILE "${CMAKE_BINARY_DIR}/inference_engine_targets_developer.cmake")

export(TARGETS ${IEDeveloperPackageTargets} NAMESPACE IE::
APPEND FILE "${CMAKE_BINARY_DIR}/inference_engine_targets_developer.cmake")
set(all_dev_targets gflags inference_engine_ir_reader inference_engine_ir_v7_reader)
foreach(component IN LISTS openvino_export_components)
export(TARGETS ${${component}} NAMESPACE IE::
APPEND FILE "${CMAKE_BINARY_DIR}/${component}_dev_targets.cmake")
list(APPEND all_dev_targets ${${component}})
endforeach()

# Custom target to build only Inference Engine Developer Package targets
add_custom_target(ie_dev_targets ALL DEPENDS ${OpenVINODeveloperPackageTargets} ${IEDeveloperPackageTargets} gflags
inference_engine_ir_reader inference_engine_ir_v7_reader)
add_custom_target(ie_dev_targets ALL DEPENDS ${all_dev_targets})
endfunction()

add_subdirectory(thirdparty)
Expand Down Expand Up @@ -156,12 +138,12 @@ endif()
# Developer package
#

ie_developer_export_targets(format_reader)
ie_developer_export_targets(${NGRAPH_LIBRARIES})
openvino_developer_export_targets(COMPONENT openvino_common TARGETS format_reader)
openvino_developer_export_targets(COMPONENT ngraph TARGETS ${NGRAPH_LIBRARIES})

# for Template plugin
if(NGRAPH_INTERPRETER_ENABLE)
ie_developer_export_targets(ngraph_backend interpreter_backend)
openvino_developer_export_targets(COMPONENT ngraph TARGETS ngraph_backend interpreter_backend)
endif()

ie_developer_export()
Expand Down Expand Up @@ -198,7 +180,7 @@ function(register_extra_modules)
file(WRITE "${iedevconfig_file}" "\# !! AUTOGENERATED: DON'T EDIT !!\n\n")
file(APPEND "${iedevconfig_file}" "ie_deprecated_no_errors()\n")

foreach(target IN LISTS OpenVINODeveloperPackageTargets IEDeveloperPackageTargets)
foreach(target IN LISTS ${openvino_export_components})
if(target)
file(APPEND "${iedevconfig_file}" "add_library(IE::${target} ALIAS ${target})\n")
endif()
Expand Down
4 changes: 0 additions & 4 deletions inference-engine/cmake/features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ ie_dependent_option (ENABLE_SPEECH_DEMO "enable speech demo integration" ON "NOT

ie_option (ENABLE_FUZZING "instrument build for fuzzing" OFF)

ie_option (ENABLE_UNSAFE_LOCATIONS "skip check for MD5 for dependency" OFF)

ie_option (ENABLE_ALTERNATIVE_TEMP "in case of dependency conflict, to avoid modification in master, use local copy of dependency" ON)

ie_option (ENABLE_OPENCV "enables OpenCV" ON)

ie_option (ENABLE_PYTHON "enables ie python bridge build" OFF)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@ endforeach()
message("")

set(gflags_DIR "@gflags_BINARY_DIR@")

# GNA lib dir
set(GNA "@GNA@")

# Targets

include("${CMAKE_CURRENT_LIST_DIR}/inference_engine_targets_developer.cmake")
if(USE_SYSTEM_PUGIXML)
find_package(PugiXML REQUIRED)
set_property(TARGET pugixml PROPERTY IMPORTED_GLOBAL TRUE)
endif()

foreach(component @openvino_export_components@)
include("${CMAKE_CURRENT_LIST_DIR}/${component}_dev_targets.cmake")
endforeach()

get_target_property(InferenceEngine_INCLUDE_DIRS IE::inference_engine INTERFACE_INCLUDE_DIRECTORIES)
set(InferenceEngine_LIBRARIES IE::inference_engine)
Expand All @@ -44,7 +52,7 @@ list(APPEND CMAKE_MODULE_PATH "@OpenVINO_MAIN_SOURCE_DIR@/cmake/developer_packag
"@OpenVINO_MAIN_SOURCE_DIR@/cmake/developer_package/download" # KMB, HDDL
"@IE_MAIN_SOURCE_DIR@/cmake") # HDDL

# generic stuff from developer package
# Inference Engine Developer Scripts package
find_package(IEDevScripts REQUIRED
PATHS "@OpenVINO_MAIN_SOURCE_DIR@/cmake/developer_package"
NO_DEFAULT_PATH)
Expand Down
6 changes: 3 additions & 3 deletions inference-engine/src/inference_engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ if(WIN32)
endif()

target_link_libraries(${TARGET_NAME}_s PRIVATE openvino::itt openvino::conditional_compilation ${CMAKE_DL_LIBS} ${NGRAPH_LIBRARIES}
inference_engine_transformations
PUBLIC pugixml)
inference_engine_transformations pugixml)

target_compile_definitions(${TARGET_NAME}_s PUBLIC USE_STATIC_IE)

Expand Down Expand Up @@ -217,7 +216,8 @@ configure_file("${IE_MAIN_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-vers
add_library(xbyak INTERFACE)
target_include_directories(xbyak INTERFACE ${IE_MAIN_SOURCE_DIR}/thirdparty/mkl-dnn/src/cpu/xbyak)

ie_developer_export_targets(${TARGET_NAME} ${TARGET_NAME}_plugin_api xbyak)
openvino_developer_export_targets(COMPONENT openvino_common TARGETS xbyak)
ie_developer_export_targets(${TARGET_NAME} ${TARGET_NAME}_plugin_api)

# install TBB

Expand Down
2 changes: 1 addition & 1 deletion inference-engine/src/vpu/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function(add_common_target TARGET_NAME STATIC_IE)

set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})

ie_developer_export_targets(${TARGET_NAME})
openvino_developer_export_targets(COMPONENT inference_engine_vpu TARGETS ${TARGET_NAME})

target_link_libraries(${TARGET_NAME} PUBLIC ${NGRAPH_LIBRARIES} inference_engine_transformations
PRIVATE openvino::itt)
Expand Down
2 changes: 1 addition & 1 deletion inference-engine/src/vpu/graph_transformer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function(add_graph_transformer_target TARGET_NAME STATIC_IE)
if(NOT STATIC_IE)
add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME} CUSTOM_FILTERS "+runtime/explicit")

ie_developer_export_targets(${TARGET_NAME})
openvino_developer_export_targets(COMPONENT inference_engine_vpu TARGETS ${TARGET_NAME})
endif()

set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ addIeTarget(
${CMAKE_CURRENT_SOURCE_DIR}/src
ADD_CPPLINT
DEVELOPER_PACKAGE
inference_engine_tests
INCLUDES
PUBLIC
${PUBLIC_HEADERS_DIR}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ addIeTarget(
ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include"
ADD_CPPLINT
DEVELOPER_PACKAGE
inference_engine_tests
INCLUDES
PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/include"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function(add_common_utils ADD_TARGET_NAME)
${CMAKE_CURRENT_SOURCE_DIR}/gtest
ADD_CPPLINT
DEVELOPER_PACKAGE
inference_engine_tests
EXPORT_DEPENDENCIES
${EXPORT_DEPENDENCIES}
)
Expand All @@ -96,21 +97,21 @@ function(add_common_utils ADD_TARGET_NAME)
endif ()

target_include_directories(${ADD_TARGET_NAME}
PUBLIC
PUBLIC
${IE_TESTS_ROOT}/ie_test_utils
$<TARGET_PROPERTY:inference_engine,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:pugixml,INTERFACE_INCLUDE_DIRECTORIES>
PRIVATE
PRIVATE
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>
)
)

target_compile_definitions(${ADD_TARGET_NAME} PUBLIC ${ARGN})

target_link_libraries(${ADD_TARGET_NAME}
PUBLIC
PUBLIC
${EXPORT_DEPENDENCIES}
)
)
endfunction()

add_common_utils(${TARGET_NAME})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ addIeTarget(
ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include"
ADD_CPPLINT
DEVELOPER_PACKAGE
inference_engine_tests
INCLUDES
PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/include"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ addIeTarget(
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
ADD_CPPLINT
DEVELOPER_PACKAGE
inference_engine_tests
EXPORT_DEPENDENCIES
${EXPORT_DEPENDENCIES}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ addIeTarget(
DEPENDENCIES
ngraphFunctions
DEVELOPER_PACKAGE
inference_engine_tests
EXPORT_DEPENDENCIES
${EXPORT_DEPENDENCIES}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ addIeTarget(
${EXPORT_DEPENDENCIES}
ADD_CPPLINT
DEVELOPER_PACKAGE
inference_engine_tests
EXPORT_DEPENDENCIES
${EXPORT_DEPENDENCIES}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ target_include_directories(${TARGET_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/plugin_tests)

# developer package
ie_developer_export_targets(${TARGET_NAME})
openvino_developer_export_targets(COMPONENT inference_engine_tests TARGETS ${TARGET_NAME})
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ target_link_libraries(${TARGET_NAME} PUBLIC

# developer package

ie_developer_export_targets(${TARGET_NAME} ${EXPORT_DEPENDENCIES} ieTestHelpers_s)
openvino_developer_export_targets(COMPONENT inference_engine_tests
TARGETS ${TARGET_NAME} ${EXPORT_DEPENDENCIES} ieTestHelpers_s)
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ add_dependencies(${TARGET_NAME} HeteroPlugin)

# developer package

ie_developer_export_targets(${TARGET_NAME})
openvino_developer_export_targets(COMPONENT inference_engine_tests TARGETS ${TARGET_NAME})
Loading

0 comments on commit 9e5f46e

Please sign in to comment.