about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/openimagedenoise
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-04-10 20:43:08 +0200
committerAlyssa Ross <hi@alyssa.is>2024-04-10 20:43:08 +0200
commit69bfdf2484041b9d242840c4e5017b4703383bb0 (patch)
treed8bdaa69e7990d7d6f09b594b3c425f742acd2d0 /nixpkgs/pkgs/development/libraries/openimagedenoise
parentc8aee4b4363b6bf905a521b05b7476960e8286c8 (diff)
parentd8fe5e6c92d0d190646fb9f1056741a229980089 (diff)
downloadnixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.tar
nixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.tar.gz
nixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.tar.bz2
nixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.tar.lz
nixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.tar.xz
nixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.tar.zst
nixlib-69bfdf2484041b9d242840c4e5017b4703383bb0.zip
Merge commit 'd8fe5e6c'
Conflicts:
	nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/openimagedenoise')
-rw-r--r--nixpkgs/pkgs/development/libraries/openimagedenoise/cuda.patch32
-rw-r--r--nixpkgs/pkgs/development/libraries/openimagedenoise/default.nix38
2 files changed, 63 insertions, 7 deletions
diff --git a/nixpkgs/pkgs/development/libraries/openimagedenoise/cuda.patch b/nixpkgs/pkgs/development/libraries/openimagedenoise/cuda.patch
new file mode 100644
index 000000000000..4bc5172d8830
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openimagedenoise/cuda.patch
@@ -0,0 +1,32 @@
+Remove upstream workarounds for CMake "limitations" that do not appear to exist
+in nixpkgs build environment, but rather break the build, presumably because
+CMAKE_INSTALL_{BIN,LIB}DIR is an absolute path in our build so
+CMAKE_INSTALL_PREFIX has no effect.
+
+diff --git a/devices/CMakeLists.txt b/devices/CMakeLists.txt
+index d5111cd..43986ad 100644
+--- a/devices/CMakeLists.txt
++++ b/devices/CMakeLists.txt
+@@ -53,7 +53,6 @@ if(OIDN_DEVICE_CUDA)
+       -DCMAKE_CXX_COMPILER:FILEPATH=${_host_compiler}
+       -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}
+       -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+-      -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/cuda/preinstall
+       -DCMAKE_INSTALL_BINDIR:PATH=${CMAKE_INSTALL_BINDIR}
+       -DCMAKE_INSTALL_LIBDIR:PATH=${CMAKE_INSTALL_LIBDIR}
+       -DCUDAToolkit_ROOT:PATH=${CUDAToolkit_ROOT}
+@@ -69,14 +68,6 @@ if(OIDN_DEVICE_CUDA)
+     DEPENDS
+       OpenImageDenoise_core
+   )
+-
+-  # Due to limitations of CMake, the module is pre-installed at build time to a temporary location,
+-  # and then copied to the real install location at install time.
+-  install(DIRECTORY
+-    ${CMAKE_CURRENT_BINARY_DIR}/cuda/preinstall/
+-    DESTINATION "."
+-    USE_SOURCE_PERMISSIONS
+-  )
+ endif()
+ 
+ if(OIDN_DEVICE_HIP)
diff --git a/nixpkgs/pkgs/development/libraries/openimagedenoise/default.nix b/nixpkgs/pkgs/development/libraries/openimagedenoise/default.nix
index 532ee7a09571..e2d9b66004ed 100644
--- a/nixpkgs/pkgs/development/libraries/openimagedenoise/default.nix
+++ b/nixpkgs/pkgs/development/libraries/openimagedenoise/default.nix
@@ -1,21 +1,45 @@
-{ lib, stdenv, fetchzip, cmake, tbb, python3, ispc }:
+{
+  cmake,
+  config,
+  cudaPackages,
+  cudaSupport ? config.cudaSupport,
+  fetchzip,
+  ispc,
+  lib,
+  python3,
+  stdenv,
+  tbb,
+}:
 
 stdenv.mkDerivation rec {
   pname = "openimagedenoise";
-  version = "1.4.3";
+  version = "2.2.2";
 
   # The release tarballs include pretrained weights, which would otherwise need to be fetched with git-lfs
   src = fetchzip {
     url = "https://github.com/OpenImageDenoise/oidn/releases/download/v${version}/oidn-${version}.src.tar.gz";
-    sha256 = "sha256-i73w/Vkr5TPLB1ulPbPU4OVGwdNlky1brfarueD7akE=";
+    sha256 = "sha256-ZIrs4oEb+PzdMh2x2BUFXKyu/HBlFb3CJX24ciEHy3Q=";
   };
 
-  nativeBuildInputs = [ cmake python3 ispc ];
-  buildInputs = [ tbb ];
+  patches = lib.optional cudaSupport ./cuda.patch;
+
+  nativeBuildInputs = [
+    cmake
+    python3
+    ispc
+  ] ++ lib.optional cudaSupport cudaPackages.cuda_nvcc;
+
+  buildInputs =
+    [ tbb ]
+    ++ lib.optionals cudaSupport [
+      cudaPackages.cuda_cudart
+      cudaPackages.cuda_cccl
+    ];
 
   cmakeFlags = [
-    "-DTBB_ROOT=${tbb}"
-    "-DTBB_INCLUDE_DIR=${tbb.dev}/include"
+    (lib.cmakeBool "OIDN_DEVICE_CUDA" cudaSupport)
+    (lib.cmakeFeature "TBB_INCLUDE_DIR" "${tbb.dev}/include")
+    (lib.cmakeFeature "TBB_ROOT" "${tbb}")
   ];
 
   meta = with lib; {