waifu2x-converter-cpp: Enable build on Darwin

This commit is contained in:
Randy Eckenrode 2021-08-25 09:22:48 -04:00
parent 4f5bc22ad7
commit bf27bf0909
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9
3 changed files with 30 additions and 6 deletions

@ -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,13 +13,20 @@ stdenv.mkDerivation rec {
sha256 = "0rv8bnyxz89za6gwk9gmdbaf3j7c1j52mip7h81rir288j35m84x";
};
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"
'';
@ -28,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;
};
}

@ -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()

@ -9923,7 +9923,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 { };