Skip to content

Commit 36eebc2

Browse files
Md/fix sit standalone master (#25773)
### Details: - clone of #25752 - Fix sing-image-test and compile_tool standalone build when OpenVINO project and ov_add_target is not reachable - Fix TBB search for single-image-test - Adding new INTEL_NPU_INTERNAL cmake option to avoid issues with building the tools in Conda build ### Tickets: - E-132977
1 parent edea66c commit 36eebc2

File tree

7 files changed

+28
-33
lines changed

7 files changed

+28
-33
lines changed

cmake/features.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ else()
5151
endif()
5252

5353
ov_dependent_option (ENABLE_INTEL_NPU "NPU plugin for OpenVINO runtime" ${ENABLE_INTEL_NPU_DEFAULT} "X86 OR X86_64;NOT APPLE" OFF)
54+
ov_dependent_option (ENABLE_INTEL_NPU_INTERNAL "NPU plugin internal components for OpenVINO runtime" ON "ENABLE_INTEL_NPU" OFF)
5455

5556
ov_option (ENABLE_DEBUG_CAPS "enable OpenVINO debug capabilities at runtime" OFF)
5657
ov_dependent_option (ENABLE_NPU_DEBUG_CAPS "enable NPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS;ENABLE_INTEL_NPU" OFF)

src/plugins/intel_npu/CMakeLists.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ add_subdirectory(src)
3030

3131
if(ENABLE_TESTS)
3232
add_subdirectory(tests)
33-
add_subdirectory(tools)
3433
endif()
3534

35+
if(ENABLE_INTEL_NPU_INTERNAL)
36+
add_subdirectory(tools)
3637

37-
ov_cpack_add_component(${NPU_INTERNAL_COMPONENT} HIDDEN)
38+
ov_cpack_add_component(${NPU_INTERNAL_COMPONENT} HIDDEN)
39+
endif()

src/plugins/intel_npu/tools/common/CMakeLists.txt

+6-14
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,17 @@
55

66
set(TARGET_NAME "npu_tools_utils")
77

8-
#
9-
# Define the target
10-
#
11-
12-
ov_add_target(ADD_CPPLINT
13-
TYPE STATIC
14-
NAME ${TARGET_NAME}
15-
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
16-
INCLUDES
17-
PUBLIC
18-
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
19-
LINK_LIBRARIES
20-
PRIVATE
21-
openvino::runtime)
8+
file(GLOB_RECURSE SOURCES "*.cpp" "*.hpp")
9+
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
2210

11+
add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES})
2312
set_target_properties(${TARGET_NAME} PROPERTIES
2413
FOLDER ${CMAKE_CURRENT_SOURCE_DIR}
2514
CXX_STANDARD 17)
2615

16+
target_include_directories(${TARGET_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>")
17+
target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime)
18+
2719
if (CMAKE_COMPILER_IS_GNUCXX)
2820
target_compile_options(${TARGET_NAME} PRIVATE -Wall)
2921
endif()

src/plugins/intel_npu/tools/compile_tool/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ set_target_properties(${TARGET_NAME} PROPERTIES
3030
FOLDER ${CMAKE_CURRENT_SOURCE_DIR}
3131
CXX_STANDARD 17)
3232

33-
if (CMAKE_COMPILER_IS_GNUCXX)
34-
target_compile_options(${TARGET_NAME} PRIVATE -Wall)
35-
endif()
36-
3733
# TODO: fix warnings and remove this exception
3834
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
3935
ov_add_compiler_flags(-Wno-missing-declarations)

src/plugins/intel_npu/tools/compile_tool/cmake/standalone.cmake

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ set(DEPENDENCIES
3333
openvino::runtime
3434
)
3535

36-
if (CMAKE_COMPILER_IS_GNUCXX)
37-
target_compile_options(${TARGET_NAME} PRIVATE -Wall)
38-
endif()
39-
4036
file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
4137

4238
add_executable(${TARGET_NAME} ${SOURCES})
4339
target_link_libraries(${TARGET_NAME} ${DEPENDENCIES})
4440

41+
if (CMAKE_COMPILER_IS_GNUCXX)
42+
target_compile_options(${TARGET_NAME} PRIVATE -Wall)
43+
endif()
44+
4545
install(TARGETS ${TARGET_NAME}
4646
DESTINATION "tools/${TARGET_NAME}"
4747
COMPONENT npu_tools)

src/plugins/intel_npu/tools/single-image-test/CMakeLists.txt

+2-5
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,18 @@ ov_add_target(ADD_CPPLINT
4141
LINK_LIBRARIES
4242
PRIVATE
4343
openvino::runtime
44-
TBB::tbb
4544
opencv_core
4645
opencv_imgproc
4746
opencv_imgcodecs
4847
npu_tools_utils
4948
gflags)
5049

50+
ov_set_threading_interface_for(${TARGET_NAME})
51+
5152
set_target_properties(${TARGET_NAME} PROPERTIES
5253
FOLDER ${CMAKE_CURRENT_SOURCE_DIR}
5354
CXX_STANDARD 17)
5455

55-
if (CMAKE_COMPILER_IS_GNUCXX)
56-
target_compile_options(${TARGET_NAME} PRIVATE -Wall)
57-
endif()
58-
5956
# TODO: fix warnings and remove this exception
6057
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
6158
ov_add_compiler_flags(-Wno-missing-declarations)

src/plugins/intel_npu/tools/single-image-test/cmake/standalone.cmake

+11-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ endif()
1818

1919
find_package(Threads REQUIRED)
2020
find_package(OpenVINO REQUIRED COMPONENTS Runtime)
21-
find_package(TBB REQUIRED)
21+
find_package(TBB QUIET)
2222
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs)
2323

2424
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../common" common EXCLUDE_FROM_ALL)
@@ -37,21 +37,28 @@ set(DEPENDENCIES
3737
Threads::Threads
3838
gflags
3939
openvino::runtime
40-
TBB::tbb
4140
opencv_core
4241
opencv_imgproc
4342
opencv_imgcodecs
4443
npu_tools_utils
4544
)
4645

47-
if (CMAKE_COMPILER_IS_GNUCXX)
48-
target_compile_options(${TARGET_NAME} PRIVATE -Wall)
46+
if (TBB_FOUND)
47+
list(APPEND DEPENDENCIES TBB::tbb)
48+
else()
49+
message(WARNING
50+
"TBB not found. We will try to build SIT without TBB. "
51+
"If OpenVINO was built with TBB, you'll likely get a linking error. "
52+
"Make sure you have called setupvars or have specified TBB_DIR.")
4953
endif()
5054

5155
file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
5256

5357
add_executable(${TARGET_NAME} ${SOURCES})
5458
target_link_libraries(${TARGET_NAME} PRIVATE ${DEPENDENCIES})
59+
if (CMAKE_COMPILER_IS_GNUCXX)
60+
target_compile_options(${TARGET_NAME} PRIVATE -Wall)
61+
endif()
5562

5663
install(TARGETS ${TARGET_NAME}
5764
DESTINATION "tools/${TARGET_NAME}"

0 commit comments

Comments
 (0)