Closed feixuedudiao closed 5 months ago
Hi @feixuedudiao
Any reason why do you explicitly mention all these libraries?
if(WIN32)
if(CMAKE_BUILD_TYPE MATCHES "release")
set(OPENVINO_AUTO_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_auto_plugin.lib")
set(OPENVINO_INTEL_CPU_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_intel_cpu_plugin.lib")
set(OPENVINO_INTEL_GPU_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_intel_gpu_plugin.lib")
set(OPENVINO_INTEL_GPU_RUNTIME_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_intel_gpu_runtime.lib")
set(OPENVINO_ONEDNN_CPU_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_onednn_cpu.lib")
set(OPENVINO_IR_FRONT_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_ir_frontend.lib")
set(OPENVINO_REFER_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_reference.lib")
set(OPENVINO_SHAPE_INFER_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_shape_inference.lib")
set(OPENVINO_UTIL_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_util.lib")
set(OPENVINO_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino.lib")
set(OPENVINO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/")
OpenVINO documentation recommends to rely on cmake interface, where you need to link with openvino::runtime
as usual. It transitively adds all required internal libraries to link process
See https://github.com/openvinotoolkit/openvino/blob/master/docs/dev/static_libaries.md#cmake-interface
thanks.
OpenVINO Version
2024.01/2024.1.0
Operating System
Windows System
Device used for inference
CPU
Framework
None
Model used
No response
Issue description
When linking static libraries, error LNK2019: ????????? "declspec(dllimport) public: cdecl ov::CompiledModel:
Step-by-step reproduction
I linked it in cmakelist according to the document](https://github.com/openvinotoolkit/openvino/blob/master/docs/dev/static_libaries.md#link-static-openvino-runtime), but found that an error occurred when linking the library. The static library was compiled by vcpkg.
if(WIN32) if(CMAKE_BUILD_TYPE MATCHES "release") set(OPENVINO_AUTO_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_auto_plugin.lib") set(OPENVINO_INTEL_CPU_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_intel_cpu_plugin.lib") set(OPENVINO_INTEL_GPU_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_intel_gpu_plugin.lib") set(OPENVINO_INTEL_GPU_RUNTIME_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_intel_gpu_runtime.lib")
set(OPENVINO_ONEDNN_CPU_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_onednn_cpu.lib") set(OPENVINO_IR_FRONT_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_ir_frontend.lib") set(OPENVINO_REFER_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_reference.lib") set(OPENVINO_SHAPE_INFER_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_shape_inference.lib") set(OPENVINO_UTIL_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino_util.lib")
set(OPENVINO_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/openvino.lib") set(OPENVINO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../third_pary/openvino/lib/intel64/Release/")
endif()
find_package(OpenVINO REQUIRED)
message("OPENVINO_LIBRARIES =" ${OpenVINO}) target_link_libraries(img_seg_Openvino PRIVATE ${OPENVINO_AUTO_LIBRARIES} ${OPENVINO_IR_FRONT_LIBRARIES} ${OPENVINO_SHAPE_INFER_LIBRARIES} ${OPENVINO_REFER_LIBRARIES} ${OPENVINO_INTEL_CPU_LIBRARIES} ${OPENVINO_INTEL_GPU_LIBRARIES} ${OPENVINO_INTEL_GPU_RUNTIME_LIBRARIES} ${OPENVINO_ONEDNN_CPU_LIBRARIES} ${OPENVINO_LIBRARIES} ${opencv_libs} ${TBB_LIBRARY} ) set_target_properties(img_seg_Openvino PROPERTIES LINK_FLAGS "/WHOLEARCHIVE:openvino_auto_plugin" ) set_target_properties(img_seg_Openvino PROPERTIES LINK_FLAGS "/WHOLEARCHIVE:openvino_ir_frontend" ) set_target_properties(img_seg_Openvino PROPERTIES LINK_FLAGS "/WHOLEARCHIVE:openvino" ) set_target_properties(img_seg_Openvino PROPERTIES LINK_FLAGS "/WHOLEARCHIVE:openvino_intel_cpu_plugin" ) set_target_properties(img_seg_Openvino PROPERTIES LINK_FLAGS "/WHOLEARCHIVE:openvino_intel_gpu_plugin" )
Relevant log output
Issue submission checklist