mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-12-24 13:28:13 +08:00
Add remove_duplicate_libraries function
This commit is contained in:
@@ -26,3 +26,36 @@ function(download_and_decompress url filename decompress_dir)
|
||||
message("Decompress file ${filename} ...")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xf ${filename} WORKING_DIRECTORY ${decompress_dir})
|
||||
endfunction()
|
||||
|
||||
function(get_openvino_libs OPENVINO_RUNTIME_DIR)
|
||||
set(LIB_LIST "")
|
||||
find_library(OPENVINO_LIB openvino ${OPENVINO_RUNTIME_DIR}/lib/ NO_DEFAULT_PATH)
|
||||
list(APPEND LIB_LIST ${OPENVINO_LIB})
|
||||
|
||||
find_package(TBB PATHS "${OPENVINO_RUNTIME_DIR}/3rdparty/tbb")
|
||||
if (TBB_FOUND)
|
||||
list(APPEND LIB_LIST ${TBB_IMPORTED_TARGETS})
|
||||
else()
|
||||
# TODO(zhoushunjie): Use openvino with tbb on linux in future.
|
||||
set(OMP_LIB "${OPENVINO_RUNTIME_DIR}/3rdparty/omp/lib/libiomp5.so")
|
||||
list(APPEND LIB_LIST ${OMP_LIB})
|
||||
endif()
|
||||
set(OPENVINO_LIBS ${LIB_LIST} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(remove_duplicate_libraries libraries)
|
||||
list(LENGTH ${libraries} lib_length)
|
||||
set(libraries_temp "")
|
||||
set(full_libraries "")
|
||||
foreach(lib_path ${${libraries}})
|
||||
get_filename_component(lib_name ${lib_path} NAME)
|
||||
list(FIND libraries_temp ${lib_name} lib_idx)
|
||||
if (${lib_idx} EQUAL -1)
|
||||
list(APPEND libraries_temp ${lib_name})
|
||||
list(APPEND full_libraries ${lib_path})
|
||||
endif()
|
||||
endforeach()
|
||||
set(${libraries} ${full_libraries} PARENT_SCOPE)
|
||||
list(LENGTH full_libraries lib_length)
|
||||
endfunction()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user