Update obs-backgroundremoval
This commit is contained in:
parent
13c40ecb58
commit
761dddc926
3 changed files with 51 additions and 14 deletions
23
pkgs/obs-backgroundremoval/cmake_fix_opencv_link.patch
Normal file
23
pkgs/obs-backgroundremoval/cmake_fix_opencv_link.patch
Normal file
|
@ -0,0 +1,23 @@
|
|||
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")
|
|
@ -4,23 +4,33 @@
|
|||
, obs-studio
|
||||
, opencv
|
||||
, onnx-runtime
|
||||
, git
|
||||
,
|
||||
}:
|
||||
stdenv.mkDerivation rec {
|
||||
stdenv.mkDerivation {
|
||||
pname = "obs-backgroundremoval";
|
||||
version = "0.4.0";
|
||||
version = "0.5.14";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "royshil";
|
||||
repo = "obs-backgroundremoval";
|
||||
rev = "4f0348a15103cd4e516d94b629851208280cd4d4";
|
||||
sha256 = "TI1FlhE0+JL50gAZCSsI+g8savX8GRQkH3jYli/66hQ=";
|
||||
rev = "a42c888ed578e026b31813fc5103ebfe48befebb";
|
||||
sha256 = "wCuvWn8BCzi/OrQnfXeUO2oJbw/wH1SUz1d2E/m8u9c=";
|
||||
};
|
||||
|
||||
cmakeFlags = [ "-DGIT_TAG=v${version}" ];
|
||||
patches = [ ./cmake_set_version.patch ];
|
||||
# cmakeFlags = [ "-DGIT_TAG=v${version}" ];
|
||||
cmakeFlags = [
|
||||
"-DUSE_SYSTEM_ONNXRUNTIME=ON"
|
||||
"-DUSE_SYSTEM_OPENCV=ON"
|
||||
];
|
||||
patches = [ ./cmake_fix_opencv_link.patch ];
|
||||
|
||||
nativeBuildInputs = [ cmake git ];
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib/obs-plugins
|
||||
cp rundir/Release/obs-plugins/64bit/obs-backgroundremoval.so $out/lib/obs-plugins/
|
||||
|
||||
mkdir -p $out/share/obs/obs-plugins/obs-backgroundremoval
|
||||
cp -r rundir/Release/data/obs-plugins/obs-backgroundremoval/data/* $out/share/obs/obs-plugins/obs-backgroundremoval/
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = [ opencv onnx-runtime obs-studio ];
|
||||
}
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
{ stdenv }:
|
||||
stdenv.mkDerivation {
|
||||
pname = "onnx-runtime";
|
||||
version = "1.7.0";
|
||||
version = "1.14.1";
|
||||
# phases = [ "unpackPhase" "installPhase" ];
|
||||
|
||||
src = builtins.fetchTarball {
|
||||
url = "https://github.com/microsoft/onnxruntime/releases/download/v1.7.0/onnxruntime-linux-x64-1.7.0.tgz";
|
||||
sha256 = "1zzgxn6867g4l9814dgpkc3jsz1qq32j6pjfhn3zv0qyw9cdnvn4";
|
||||
url = "https://github.com/microsoft/onnxruntime/releases/download/v1.14.1/onnxruntime-linux-x64-gpu-1.14.1.tgz";
|
||||
sha256 = "1hcxyhldxy5q0x50f96ni3p9v1n5qljarx7fvs63r6sk6j4yr2kv";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp -r include lib $out/
|
||||
mkdir -p $out/include/onnxruntime/core/session
|
||||
mkdir -p $out/include/onnxruntime/core/providers/cpu
|
||||
mkdir -p $out/include/onnxruntime/core/providers/gpu
|
||||
|
||||
cp -r lib $out/
|
||||
cp -r include/ $out/
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue