nixos-config/pkgs/obs-backgroundremoval/cmake_fix_opencv_link.patch

24 lines
1.1 KiB
Diff
Raw Normal View History

2023-04-03 09:45:35 +02:00
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3bcbad2..cd79570 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,9 +73,6 @@ set(USE_SYSTEM_OPENCV
if(USE_SYSTEM_OPENCV)
if(OS_LINUX)
find_package(OpenCV REQUIRED COMPONENTS core imgproc)
- add_library(OpenCV SHARED IMPORTED)
- set_target_properties(OpenCV PROPERTIES IMPORTED_LOCATION ${OpenCV_LIBRARIES})
- set_target_properties(OpenCV PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OpenCV_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "System OpenCV is only supported on Linux!")
endif()
@@ -86,7 +83,7 @@ endif()
if(OS_WINDOWS)
install(IMPORTED_RUNTIME_ARTIFACTS Onnxruntime::DirectML DESTINATION "${OBS_PLUGIN_DESTINATION}")
endif()
-target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Onnxruntime OpenCV)
+target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Onnxruntime ${OpenCV_LIBRARIES})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin|iOS")
foreach(flags CMAKE_CXX_FLAGS CMAKE_OBJC_FLAGS CMAKE_OBJCXX_FLAGS)
string(APPEND ${flags} " -fvisibility=hidden -fvisibility-inlines-hidden")