OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
if(NOT ENABLE_AUTO AND NOT ENABLE_MULTI)
return()
endif()
set (TARGET_NAME "openvino_auto_plugin")
set(SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/async_infer_request.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/auto_compiled_model.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/auto_schedule.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cache_warmup.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/compiled_model.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cumulative_compiled_model.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cumulative_schedule.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/infer_request.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin_config.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/schedule.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/utils/device_telemetry.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/utils/log.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/utils/time_utils.cpp)
# Build the optional IPF telemetry client used by the device utilization monitor.
add_subdirectory(thirdparty)
# WA for issue 141313
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11)
ov_add_compiler_flags(-Wno-stringop-overflow)
endif()
if(ENABLE_AUTO AND ENABLE_MULTI)
ov_add_plugin(NAME ${TARGET_NAME}
DEVICE_NAME "MULTI"
PSEUDO_DEVICE
SOURCES ${SOURCES}
VERSION_DEFINES_FOR src/plugin.cpp)
ov_add_plugin(NAME ${TARGET_NAME}
DEVICE_NAME "AUTO"
PSEUDO_DEVICE
PSEUDO_PLUGIN_FOR "MULTI")
elseif(ENABLE_AUTO)
ov_add_plugin(NAME ${TARGET_NAME}
DEVICE_NAME "AUTO"
PSEUDO_DEVICE
SOURCES ${SOURCES}
VERSION_DEFINES_FOR src/plugin.cpp)
elseif(ENABLE_MULTI)
ov_add_plugin(NAME ${TARGET_NAME}
DEVICE_NAME "MULTI"
PSEUDO_DEVICE
SOURCES ${SOURCES}
VERSION_DEFINES_FOR src/plugin.cpp)
endif()
find_package(Threads REQUIRED)
target_link_libraries(${TARGET_NAME} PRIVATE Threads::Threads)
# Enable IPF support with the statically linked C API.
# ClientApi_IMPORTS must remain undefined for static linking.
if(TARGET openvino::ipf_client_api)
target_compile_definitions(${TARGET_NAME} PRIVATE OV_AUTO_ENABLE_IPF)
target_link_libraries(${TARGET_NAME} PRIVATE openvino::ipf_client_api)
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE
$<TARGET_PROPERTY:nlohmann_json::nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES>)
message(STATUS "[AUTO] IPF support successfully enabled for ${TARGET_NAME}")
else()
message(STATUS "[AUTO] IPF support disabled")
endif()
ov_set_threading_interface_for(${TARGET_NAME})
# must be called after all target_link_libraries
ov_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
if(ENABLE_TESTS)
add_subdirectory(tests)
endif()