Fixed static build from build tree (#19556)

This commit is contained in:
Ilya Lavrenov 2023-09-04 08:08:50 +04:00 committed by GitHub
parent 51df17912b
commit 7173f530cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 6 deletions

View File

@ -284,8 +284,7 @@ macro(ov_add_frontend)
if(OV_FRONTEND_LINKABLE_FRONTEND)
set(export_set EXPORT OpenVINOTargets)
set(archive_dest ARCHIVE DESTINATION ${OV_CPACK_ARCHIVEDIR}
COMPONENT ${lib_component})
set(archive_dest ARCHIVE DESTINATION ${OV_CPACK_ARCHIVEDIR} COMPONENT ${lib_component})
set(namelink NAMELINK_COMPONENT ${dev_component})
else()
set(namelink NAMELINK_SKIP)
@ -295,6 +294,12 @@ macro(ov_add_frontend)
${archive_dest}
LIBRARY DESTINATION ${OV_CPACK_LIBRARYDIR} COMPONENT ${lib_component}
${namelink})
# export to build tree
if(OV_FRONTEND_LINKABLE_FRONTEND)
export(TARGETS ${TARGET_NAME} NAMESPACE openvino::
APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")
endif()
else()
ov_install_static_lib(${TARGET_NAME} ${OV_CPACK_COMP_CORE})
endif()
@ -306,9 +311,8 @@ macro(ov_add_frontend)
COMPONENT ${dev_component}
FILES_MATCHING PATTERN "*.hpp")
# public target name
set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::${OV_FRONTEND_NAME})
export(TARGETS ${TARGET_NAME} NAMESPACE openvino::
APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")
endif()
else()
# skipped frontend has to be installed in static libraries case

View File

@ -24,6 +24,10 @@ macro(ov_install_static_lib target comp)
install(TARGETS ${target} EXPORT OpenVINOTargets
ARCHIVE DESTINATION ${OV_CPACK_ARCHIVEDIR} COMPONENT ${comp} ${ARGN})
# export to local tree to build against static build tree
export(TARGETS ${target} NAMESPACE openvino::
APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")
endif()
endmacro()

View File

@ -20,10 +20,9 @@ if(NOT OpenCV_FOUND OR NOT OpenCV_VERSION VERSION_GREATER_EQUAL 3)
message(WARNING "OpenCV ver. 3.0+ is not found, ${TARGET_NAME} is built without OPENCV support")
else()
target_compile_definitions(${TARGET_NAME} PRIVATE USE_OPENCV)
target_link_libraries(${TARGET_NAME} PRIVATE ${OpenCV_LIBRARIES})
endif()
target_link_libraries(${TARGET_NAME} PRIVATE ${OpenCV_LIBRARIES})
target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src")