2023-11-16 04:20:00 +00:00
|
|
|
{ cmake, fetchFromGitHub, makeWrapper, opencv4, lib, stdenv, ocl-icd, opencl-headers, OpenCL
|
2023-08-04 22:07:22 +00:00
|
|
|
, config
|
|
|
|
, cudaSupport ? config.cudaSupport, cudatoolkit ? null
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "waifu2x-converter-cpp";
|
2021-02-05 17:12:51 +00:00
|
|
|
version = "5.3.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "DeadSix27";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-02-05 17:12:51 +00:00
|
|
|
sha256 = "0rv8bnyxz89za6gwk9gmdbaf3j7c1j52mip7h81rir288j35m84x";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
patches = [
|
|
|
|
# Remove the hard-coded compiler on Darwin and use the one in stdenv.
|
|
|
|
./waifu2x_darwin_build.diff
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2023-11-16 04:20:00 +00:00
|
|
|
opencv4
|
2021-09-18 10:52:07 +00:00
|
|
|
] ++ lib.optional cudaSupport cudatoolkit
|
|
|
|
++ lib.optional stdenv.isDarwin OpenCL
|
|
|
|
++ lib.optionals stdenv.isLinux [ ocl-icd opencl-headers ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-30 08:33:03 +00:00
|
|
|
nativeBuildInputs = [ cmake makeWrapper ];
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
preFixup = lib.optionalString stdenv.isLinux ''
|
2020-11-30 08:33:03 +00:00
|
|
|
wrapProgram $out/bin/waifu2x-converter-cpp --prefix LD_LIBRARY_PATH : "${ocl-icd}/lib"
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
# file RPATH_CHANGE could not write new RPATH
|
|
|
|
"-DCMAKE_SKIP_BUILD_RPATH=ON"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "Improved fork of Waifu2X C++ using OpenCL and OpenCV";
|
|
|
|
homepage = "https://github.com/DeadSix27/waifu2x-converter-cpp";
|
2021-01-15 22:18:51 +00:00
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = [ lib.maintainers.xzfc ];
|
2021-09-18 10:52:07 +00:00
|
|
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "waifu2x-converter-cpp";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|