Skip to content

Commit

Permalink
Renamed / removed legacy cmake targets (#22307)
Browse files Browse the repository at this point in the history
* Removed legacy cmake targets

* Renamed ngraph_obj

* Rename onference_engine targets
  • Loading branch information
ilya-lavrenov authored Jan 22, 2024
1 parent f4ecee2 commit ef1632d
Show file tree
Hide file tree
Showing 24 changed files with 88 additions and 142 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,10 @@ if(NOT OV_GLIBC_VERSION VERSION_EQUAL 0.0)
endif()

# remove file with exported targets to force its regeneration
file(REMOVE "${CMAKE_BINARY_DIR}/ngraphTargets.cmake")
file(REMOVE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake")
file(REMOVE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")

# remove exported developer targets files to force its regeneration
macro(ov_clean_developer_package_targets)
file(REMOVE "${CMAKE_BINARY_DIR}/inference_engine_developer_package_targets.cmake")
file(REMOVE "${CMAKE_BINARY_DIR}/openvino_developer_package_targets.cmake")
unset(_OPENVINO_DEVELOPER_PACKAGE_TARGETS CACHE)
unset(openvino_installed_targets CACHE)
Expand Down
2 changes: 1 addition & 1 deletion cmake/developer_package/frontends/frontends.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function(ov_generate_frontends_hpp)
endif()
endforeach()

# add dependency on header file generation for all inference_engine source files
# add dependency on header file generation for all openvino_frontend_common_obj source files
set_source_files_properties(${all_sources} PROPERTIES OBJECT_DEPENDS ${ov_frontends_hpp})
endfunction()

Expand Down
8 changes: 4 additions & 4 deletions cmake/developer_package/plugins/plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ function(ov_generate_plugins_hpp)

# add plugins to libraries including ov_plugins.hpp
ov_target_link_plugins(openvino)
if(TARGET inference_engine_s)
ov_target_link_plugins(inference_engine_s)
if(TARGET openvino_runtime_s)
ov_target_link_plugins(openvino_runtime_s)
endif()

if(OV_GENERATOR_MULTI_CONFIG AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
Expand Down Expand Up @@ -352,7 +352,7 @@ function(ov_generate_plugins_hpp)
VERBATIM)

# for some reason dependency on source files does not work
# so, we have to use explicit target and make it dependency for inference_engine_obj
# so, we have to use explicit target and make it dependency for openvino_runtime_obj
add_custom_target(_ov_plugins_hpp DEPENDS ${ov_plugins_hpp})
add_dependencies(inference_engine_obj _ov_plugins_hpp)
add_dependencies(openvino_runtime_obj _ov_plugins_hpp)
endfunction()
4 changes: 2 additions & 2 deletions cmake/extra_modules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ endfunction()
# since it's generated after modules are configured
ov_generate_dev_package_config()

# extra modules must be registered after inference_engine library
# extra modules must be registered after openvino_runtime library
# and all other OpenVINO Core libraries are creared
# because '_ov_register_extra_modules' creates fake InferenceEngineDeveloperPackageConfig.cmake
# because '_ov_register_extra_modules' creates fake OpenVINODeveloperPackageConfig.cmake
# with all imported developer targets
_ov_register_extra_modules()

Expand Down
2 changes: 0 additions & 2 deletions cmake/packaging/debian.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,6 @@ macro(ov_cpack_settings)
ov_debian_add_lintian_suppression(${python_component}
# usr/lib/python3/dist-packages/requirements.txt
"unknown-file-in-python-module-directory"
# usr/lib/python3/dist-packages/openvino/inference_engine/__init__.py
"executable-not-elf-or-script"
# all directories
"non-standard-dir-perm"
# usr/bin/benchmark_app
Expand Down
24 changes: 15 additions & 9 deletions src/cmake/openvino.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
endif()

add_library(${TARGET_NAME}
$<TARGET_OBJECTS:ngraph_obj>
$<TARGET_OBJECTS:ngraph_obj_version>
$<TARGET_OBJECTS:openvino_core_obj>
$<TARGET_OBJECTS:openvino_core_obj_version>
$<TARGET_OBJECTS:openvino_frontend_common_obj>
$<TARGET_OBJECTS:inference_engine_obj>
$<TARGET_OBJECTS:inference_engine_obj_version>
$<TARGET_OBJECTS:inference_engine_transformations_obj>
$<TARGET_OBJECTS:inference_engine_lp_transformations_obj>
$<TARGET_OBJECTS:openvino_runtime_obj>
$<TARGET_OBJECTS:openvino_runtime_obj_version>
$<TARGET_OBJECTS:openvino_transformations_obj>
$<TARGET_OBJECTS:openvino_lp_transformations_obj>
$<$<TARGET_EXISTS:openvino_proxy_plugin_obj>:$<TARGET_OBJECTS:openvino_proxy_plugin_obj>>)

add_library(openvino::runtime ALIAS ${TARGET_NAME})
Expand Down Expand Up @@ -106,17 +106,23 @@ add_library(openvino_runtime_dev INTERFACE)
add_library(openvino::runtime::dev ALIAS openvino_runtime_dev)

target_include_directories(openvino_runtime_dev INTERFACE
$<BUILD_INTERFACE:${OpenVINO_SOURCE_DIR}/src/inference/dev_api>
$<BUILD_INTERFACE:${OpenVINO_SOURCE_DIR}/src/common/low_precision_transformations/include>)
$<BUILD_INTERFACE:${OpenVINO_SOURCE_DIR}/src/inference/dev_api>)

target_link_libraries(openvino_runtime_dev INTERFACE ${TARGET_NAME} openvino::core::dev)

ov_set_threading_interface_for(openvino_runtime_dev)
set_target_properties(openvino_runtime_dev PROPERTIES EXPORT_NAME runtime::dev)

ov_developer_package_export_targets(TARGET openvino::runtime::dev
ov_developer_package_export_targets(TARGET openvino_runtime_dev
INSTALL_INCLUDE_DIRECTORIES "${OpenVINO_SOURCE_DIR}/src/inference/dev_api/")

file(GLOB_RECURSE dev_api_src "${CMAKE_CURRENT_SOURCE_DIR}/OpenVINO_SOURCE_DIR}/src/inference/dev_api/openvino/*.hpp")
ov_add_clang_format_target(openvino_runtime_dev_clang FOR_SOURCES ${plugin_api_src})

ov_ncc_naming_style(FOR_TARGET openvino_runtime_dev
SOURCE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/src/inference/dev_api/openvino"
ADDITIONAL_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:openvino::runtime,INTERFACE_INCLUDE_DIRECTORIES>)

# Install static libraries for case BUILD_SHARED_LIBS=OFF
ov_install_static_lib(openvino_runtime_dev ${OV_CPACK_COMP_CORE})

Expand Down
2 changes: 1 addition & 1 deletion src/cmake/ov_parallel.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function(ov_set_threading_interface_for TARGET_NAME)
set(LINK_TYPE "PRIVATE")
set(COMPILE_DEF_TYPE "PRIVATE")
elseif(target_type STREQUAL "STATIC_LIBRARY")
# Affected libraries: inference_engine_s
# Affected libraries: openvino_runtime_s
# they don't have TBB in public headers => PRIVATE
set(LINK_TYPE "PRIVATE")
set(COMPILE_DEF_TYPE "PUBLIC")
Expand Down
14 changes: 2 additions & 12 deletions src/common/low_precision_transformations/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
#

set (TARGET_NAME "inference_engine_lp_transformations")
set (TARGET_NAME "openvino_lp_transformations")

set(PUBLIC_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")

Expand All @@ -27,8 +27,7 @@ ov_build_target_faster(${TARGET_NAME}_obj UNITY)

target_link_libraries(${TARGET_NAME}_obj PRIVATE openvino::itt openvino::core::dev)

target_include_directories(${TARGET_NAME}_obj PRIVATE $<BUILD_INTERFACE:${PUBLIC_HEADERS_DIR}>
$<BUILD_INTERFACE:$<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>>)
target_include_directories(${TARGET_NAME}_obj PRIVATE $<BUILD_INTERFACE:${PUBLIC_HEADERS_DIR}>)

add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME}_obj)

Expand All @@ -38,15 +37,6 @@ if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(${TARGET_NAME}_obj PUBLIC OPENVINO_STATIC_LIBRARY)
endif()

# INTERFACE library for BW compatibility

add_library(${TARGET_NAME} INTERFACE)
target_link_libraries(${TARGET_NAME} INTERFACE openvino::runtime)

target_include_directories(${TARGET_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:$<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>>)

# LTO

set_target_properties(${TARGET_NAME}_obj PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
Expand Down
2 changes: 1 addition & 1 deletion src/common/transformations/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
#

set(TARGET_NAME "inference_engine_transformations")
set(TARGET_NAME "openvino_transformations")

set(PUBLIC_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")

Expand Down
2 changes: 0 additions & 2 deletions src/common/transformations/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ ov_add_test_target(
sharedTestClasses
ov_lpt_models
ADD_CLANG_FORMAT
INCLUDES
$<TARGET_PROPERTY:inference_engine_obj,SOURCE_DIR>/src
LABELS
OV UNIT TRANSFORMATIONS
)
Expand Down
74 changes: 37 additions & 37 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@ file(GLOB_RECURSE DEV_HEADERS ${OV_CORE_DEV_API_PATH}/*.hpp)
add_subdirectory(reference)
add_subdirectory(shape_inference)

set(MIXED_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/src/runtime/allocator.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/runtime/itensor.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/runtime/ov_tensor.cpp")

set_property(SOURCE ${MIXED_SRC}
APPEND PROPERTY INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:inference_engine_obj,SOURCE_DIR>/src
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>)
# TODO: remove with InferenceEngine::Blob removal
if(ON)
set(MIXED_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/src/runtime/allocator.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/runtime/itensor.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/runtime/ov_tensor.cpp")

set_property(SOURCE ${MIXED_SRC}
APPEND PROPERTY INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:openvino_runtime_obj,SOURCE_DIR>/src
$<TARGET_PROPERTY:openvino_runtime_obj,SOURCE_DIR>/dev_api
$<TARGET_PROPERTY:openvino_runtime_obj,SOURCE_DIR>/include
$<TARGET_PROPERTY:openvino_runtime_obj,SOURCE_DIR>/include/ie)
endif()

# Create named folders for the sources within the .vcproj
# Empty name lists them directly under the .vcproj
Expand All @@ -45,7 +50,8 @@ target_include_directories(openvino_core_dev INTERFACE
$<BUILD_INTERFACE:${OV_CORE_INCLUDE_PATH}>
$<BUILD_INTERFACE:${OpenVINO_SOURCE_DIR}/src/core/dev_api>
$<BUILD_INTERFACE:${OpenVINO_SOURCE_DIR}/src/frontends/common/include>
$<BUILD_INTERFACE:${OpenVINO_SOURCE_DIR}/src/common/transformations/include>)
$<BUILD_INTERFACE:${OpenVINO_SOURCE_DIR}/src/common/transformations/include>
$<BUILD_INTERFACE:${OpenVINO_SOURCE_DIR}/src/common/low_precision_transformations/include>)

target_link_libraries(openvino_core_dev INTERFACE openvino::itt openvino::util)

Expand All @@ -71,44 +77,44 @@ endif()
# Create static or shared library depending on BUILD_SHARED_LIBS
#

add_library(ngraph_obj OBJECT ${LIBRARY_SRC} ${PUBLIC_HEADERS})
add_library(openvino_core_obj OBJECT ${LIBRARY_SRC} ${PUBLIC_HEADERS})

if(ENABLE_SYSTEM_PUGIXML)
# system pugixml has /usr/include as include directories
# we cannot use them as system ones, leads to compilation errors
set_target_properties(ngraph_obj PROPERTIES NO_SYSTEM_FROM_IMPORTED ON)
set_target_properties(openvino_core_obj PROPERTIES NO_SYSTEM_FROM_IMPORTED ON)
endif()

target_compile_definitions(ngraph_obj PRIVATE IMPLEMENT_OPENVINO_API)
target_compile_definitions(openvino_core_obj PRIVATE IMPLEMENT_OPENVINO_API)

ov_build_target_faster(ngraph_obj
ov_build_target_faster(openvino_core_obj
UNITY
PCH PRIVATE "src/precomp.hpp")

ov_add_version_defines(src/version.cpp ngraph_obj)
ov_add_version_defines(src/version.cpp openvino_core_obj)

target_link_libraries(ngraph_obj PRIVATE openvino::reference openvino::util
target_link_libraries(openvino_core_obj PRIVATE openvino::reference openvino::util
openvino::pugixml openvino::shape_inference openvino::core::dev)

ov_mark_target_as_cc(ngraph_obj)
ov_mark_target_as_cc(openvino_core_obj)

# ngraph is public API => need to mark this library as important for ABI free
ov_abi_free_target(ngraph_obj)
# openvino_core is public API => need to mark this library as important for ABI free
ov_abi_free_target(openvino_core_obj)

ov_ncc_naming_style(FOR_TARGET ngraph_obj
ov_ncc_naming_style(FOR_TARGET openvino_core_obj
SOURCE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include")

ov_add_clang_format_target(ngraph_clang FOR_SOURCES ${LIBRARY_SRC} ${PUBLIC_HEADERS} ${DEV_HEADERS})
ov_add_clang_format_target(openvino_core_clang FOR_SOURCES ${LIBRARY_SRC} ${PUBLIC_HEADERS} ${DEV_HEADERS})

if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(ngraph_obj PUBLIC OPENVINO_STATIC_LIBRARY)
target_compile_definitions(openvino_core_obj PUBLIC OPENVINO_STATIC_LIBRARY)
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# ngraph is linked against openvino::reference, openvino::shape_inference static libraries
# which include ngraph headers with dllimport attribute. Linker complains about it
# openvino_core is linked against openvino::reference, openvino::shape_inference static libraries
# which include openvino_core headers with dllimport attribute. Linker complains about it
# but no way to fix this: linking with no attribute defaults to dllexport and we have
# multiple defitions for ngraph symbols.
# multiple defitions for openvino_core symbols.
#
# The possible way is to use object libraries for openvino::reference
# but it's not convinient since these libraries are exported from build tree
Expand All @@ -119,10 +125,11 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(link_type PUBLIC)
endif()

target_link_options(ngraph_obj ${link_type} "/IGNORE:4217,4286")
target_link_options(openvino_core_obj ${link_type} "/IGNORE:4217,4286")
endif()

# some sources are located in ngraph, while headers are in inference_engine_transformations
# TODO: try to remove this and move smart reshape to transformations
# some sources are located in openvino_core, while headers are in openvino_transformations
file(GLOB_RECURSE smart_reshape_srcs ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/smart_reshape/*.cpp)
file(GLOB_RECURSE rt_info_srcs ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/rt_info/*.cpp)
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/src/pass/convert_precision.cpp"
Expand All @@ -133,18 +140,11 @@ set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/src/pass/convert_precis
"${CMAKE_CURRENT_SOURCE_DIR}/src/preprocess/preprocess_steps_impl.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/model.cpp" # for SmartReshape
${smart_reshape_srcs} ${rt_info_srcs}
PROPERTIES INCLUDE_DIRECTORIES $<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>)
PROPERTIES INCLUDE_DIRECTORIES $<TARGET_PROPERTY:openvino::core::dev,INTERFACE_INCLUDE_DIRECTORIES>)

# Defines macro in C++ to load backend plugin
target_include_directories(ngraph_obj PUBLIC $<BUILD_INTERFACE:${OV_CORE_INCLUDE_PATH}>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)

add_library(ngraph INTERFACE)
target_link_libraries(ngraph INTERFACE openvino::runtime)
# Add an alias so that library can be used inside the build tree, e.g. when testing
add_library(openvino::core ALIAS ngraph)

target_include_directories(ngraph INTERFACE $<BUILD_INTERFACE:${OV_CORE_INCLUDE_PATH}>)
target_include_directories(openvino_core_obj PUBLIC $<BUILD_INTERFACE:${OV_CORE_INCLUDE_PATH}>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)

#-----------------------------------------------------------------------------------------------
# Installation logic...
Expand Down
5 changes: 2 additions & 3 deletions src/core/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ add_definitions(-DSERIALIZED_ZOO=\"${TEST_MODEL_ZOO}/core/models\")

# For type relaxed types
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/threading.cpp
PROPERTIES INCLUDE_DIRECTORIES $<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>)
PROPERTIES INCLUDE_DIRECTORIES $<TARGET_PROPERTY:openvino::core::dev,INTERFACE_INCLUDE_DIRECTORIES>)

if(SUGGEST_OVERRIDE_SUPPORTED)
set_source_files_properties(ov_tensor_test.cpp
Expand Down Expand Up @@ -49,8 +49,7 @@ ov_add_test_target(
OV UNIT CORE
)

get_target_property(OV_CORE_SRC_DIR ngraph_obj SOURCE_DIR)
target_include_directories(${TARGET_NAME} PRIVATE ${OV_CORE_SRC_DIR}/src
target_include_directories(${TARGET_NAME} PRIVATE $<TARGET_PROPERTY:openvino_core_obj,SOURCE_DIR>/src
${CMAKE_CURRENT_SOURCE_DIR})

target_compile_definitions(${TARGET_NAME}
Expand Down
2 changes: 1 addition & 1 deletion src/frontends/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ov_abi_free_target(${TARGET_NAME}_obj)
ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME}_obj
SOURCE_DIRECTORIES "${FRONTEND_INCLUDE_DIR}"
ADDITIONAL_INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:ngraph,INTERFACE_INCLUDE_DIRECTORIES>)
$<TARGET_PROPERTY:openvino::core::dev,INTERFACE_INCLUDE_DIRECTORIES>)

# Installation rules header files

Expand Down
Loading

0 comments on commit ef1632d

Please sign in to comment.