Merge pull request #135725 from reckenrode/waifu2x-darwin

waifu2x-converter-cpp: Add support for Darwin
This commit is contained in:
Domen Kožar 2021-08-28 09:06:29 +02:00 committed by GitHub
commit a19c858868
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 10 deletions

View File

@ -1,4 +1,4 @@
{ cmake, fetchFromGitHub, makeWrapper, opencv3, lib, stdenv, ocl-icd, opencl-headers
{ cmake, fetchFromGitHub, makeWrapper, opencv3, lib, stdenv, ocl-icd, opencl-headers, OpenCL
, cudaSupport ? false, cudatoolkit ? null
}:
@ -13,18 +13,20 @@ stdenv.mkDerivation rec {
sha256 = "0rv8bnyxz89za6gwk9gmdbaf3j7c1j52mip7h81rir288j35m84x";
};
patchPhase = ''
# https://github.com/DeadSix27/waifu2x-converter-cpp/issues/123
sed -i 's:{"PNG", false},:{"PNG", true},:' src/main.cpp
'';
patches = [
# Remove the hard-coded compiler on Darwin and use the one in stdenv.
./waifu2x_darwin_build.diff
];
buildInputs = [
ocl-icd opencv3 opencl-headers
] ++ lib.optional cudaSupport cudatoolkit;
opencv3
] ++ lib.optional cudaSupport cudatoolkit
++ lib.optional stdenv.isDarwin OpenCL
++ lib.optionals stdenv.isLinux [ ocl-icd opencl-headers ];
nativeBuildInputs = [ cmake makeWrapper ];
preFixup = ''
preFixup = lib.optionalString stdenv.isLinux ''
wrapProgram $out/bin/waifu2x-converter-cpp --prefix LD_LIBRARY_PATH : "${ocl-icd}/lib"
'';
@ -33,6 +35,6 @@ stdenv.mkDerivation rec {
homepage = "https://github.com/DeadSix27/waifu2x-converter-cpp";
license = lib.licenses.mit;
maintainers = [ lib.maintainers.xzfc ];
platforms = lib.platforms.linux;
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}

View File

@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8b728b5..dedf8b6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,10 +71,6 @@ message(STATUS "System is: ${CMAKE_SYSTEM_NAME} (${LOCAL_SYS_TYPE})")
### Get binary paths for APPLE users
if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
- set(CMAKE_C_COMPILER "/usr/local/opt/llvm/bin/clang")
- set(CMAKE_CXX_COMPILER "/usr/local/opt/llvm/bin/clang++")
- set(CMAKE_EXE_LINKER_FLAGS "-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib")
- set(CMAKE_SHARED_LINKER_FLAGS "-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
set(FILE_SYSTEM_LIB "c++fs")
endif()

View File

@ -9937,7 +9937,9 @@ with pkgs;
openssl = openssl_1_0_2;
};
waifu2x-converter-cpp = callPackage ../tools/graphics/waifu2x-converter-cpp { };
waifu2x-converter-cpp = callPackage ../tools/graphics/waifu2x-converter-cpp {
inherit (darwin.apple_sdk.frameworks) OpenCL;
};
wakatime = pythonPackages.callPackage ../tools/misc/wakatime { };