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
#
set(TARGET_NAME ov_cpu_func_tests)
if(SUGGEST_OVERRIDE_SUPPORTED)
# xbyak compilation fails
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-suggest-override")
endif()
# To allow test classes call `mayiuse(gv)`
if(RISCV64)
set(CPU_ISA_TRAITS_RV64 $<TARGET_PROPERTY:openvino_intel_cpu_plugin,SOURCE_DIR>/src/nodes/kernels/riscv64/cpu_isa_traits.hpp
$<TARGET_PROPERTY:openvino_intel_cpu_plugin,SOURCE_DIR>/src/nodes/kernels/riscv64/cpu_isa_traits.cpp)
endif()
add_library(cpuUtils STATIC
$<TARGET_PROPERTY:openvino_intel_cpu_plugin,SOURCE_DIR>/src/utils/rt_info/memory_formats_attribute.hpp
$<TARGET_PROPERTY:openvino_intel_cpu_plugin,SOURCE_DIR>/src/utils/rt_info/memory_formats_attribute.cpp
$<TARGET_PROPERTY:openvino_intel_cpu_plugin,SOURCE_DIR>/src/utils/precision_support.h
$<TARGET_PROPERTY:openvino_intel_cpu_plugin,SOURCE_DIR>/src/utils/precision_support.cpp
$<TARGET_PROPERTY:openvino_intel_cpu_plugin,SOURCE_DIR>/src/utils/arm_isa_support.h
$<TARGET_PROPERTY:openvino_intel_cpu_plugin,SOURCE_DIR>/src/utils/arm_isa_support.cpp
${CPU_ISA_TRAITS_RV64})
set(CPU_UTILS_LINK_LIBRARIES openvino::runtime::dev)
set(CPU_UTILS_INCLUDE_PATHS)
if(OV_CPU_WITH_ACL)
list(APPEND CPU_UTILS_LINK_LIBRARIES arm_compute::arm_compute)
list(APPEND CPU_UTILS_INCLUDE_PATHS $<TARGET_PROPERTY:arm_compute::arm_compute,SOURCE_DIR>)
endif()
if(OV_CPU_WITH_DNNL)
list(APPEND CPU_UTILS_LINK_LIBRARIES dnnl)
list(APPEND CPU_UTILS_INCLUDE_PATHS
$<TARGET_PROPERTY:openvino_intel_cpu_plugin,SOURCE_DIR>/thirdparty/onednn/src
$<TARGET_PROPERTY:openvino_intel_cpu_plugin,SOURCE_DIR>/thirdparty/onednn/third_party)
endif()
if(RISCV64)
list(APPEND CPU_UTILS_LINK_LIBRARIES xbyak_riscv)
endif()
target_link_libraries(cpuUtils PRIVATE ${CPU_UTILS_LINK_LIBRARIES})
target_include_directories(cpuUtils PRIVATE ${CPU_UTILS_INCLUDE_PATHS})
set(INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} $<TARGET_PROPERTY:openvino_intel_cpu_plugin,SOURCE_DIR>/src)
if(X86_64)
# x64 tests compile CPU-specific op sources (e.g. QSAIndexer) which use transformations/itt.hpp
list(APPEND INCLUDES $<TARGET_PROPERTY:openvino::conditional_compilation,INTERFACE_INCLUDE_DIRECTORIES>)
endif()
set(DEPENDENCIES openvino_intel_cpu_plugin openvino_template_extension)
set(LINK_LIBRARIES funcSharedTests cpuUtils openvino::snippets ov_snippets_models openvino::reference)
include(${CMAKE_CURRENT_SOURCE_DIR}/sources.cmake)
ov_add_test_target(
NAME ${TARGET_NAME}
SOURCES ${CPU_FUNC_TESTS_SRCS}
INCLUDES ${INCLUDES}
OBJECT_FILES ${TMP_EXPLICITLY_ENABLED_TESTS}
DEFINES ${DEFINES}
DEPENDENCIES ${DEPENDENCIES}
LINK_LIBRARIES ${LINK_LIBRARIES}
LABELS OV CPU
CHECK_SOURCES_LISTED
CHECK_SOURCES_EXCLUDE_FILES
${CPU_FUNC_TESTS_CHECK_SOURCES_EXCLUDE_FILES}
CHECK_SOURCES_EXCLUDE_DIRECTORIES
${CPU_FUNC_TESTS_CHECK_SOURCES_EXCLUDE_DIRECTORIES}
)
ov_set_threading_interface_for(${TARGET_NAME})
ov_build_target_faster(${TARGET_NAME} PCH)
include(cmake/specific_tests.cmake)
include(cmake/target_per_test.cmake)
# exclude 'ov_cpu_func_tests' from target 'all' if specific tests path was specified
if(DEFINED ENABLE_CPU_SPECIFIC_TESTS_PATH)
set_target_properties(${TARGET_NAME} PROPERTIES EXCLUDE_FROM_ALL ON)
endif()