1{ lib, stdenv, fetchFromGitHub, cmake, fftw, fftwFloat, boost, opencl-clhpp, ocl-icd, darwin }:
2
3let
4 inherit (darwin.apple_sdk.frameworks) OpenCL;
5in
6stdenv.mkDerivation rec {
7 pname = "clfft";
8 version = "2.12.2";
9
10 src = fetchFromGitHub {
11 owner = "clMathLibraries";
12 repo = "clFFT";
13 rev = "v${version}";
14 hash = "sha256-yp7u6qhpPYQpBw3d+VLg0GgMyZONVII8BsBCEoRZm4w=";
15 };
16
17 sourceRoot = "${src.name}/src";
18
19 postPatch = ''
20 sed -i '/-m64/d;/-m32/d' CMakeLists.txt
21 '';
22
23 nativeBuildInputs = [ cmake ];
24
25 buildInputs = [ fftw fftwFloat boost ]
26 ++ lib.optionals stdenv.isLinux [ opencl-clhpp ocl-icd ]
27 ++ lib.optionals stdenv.isDarwin [ OpenCL ];
28
29 # https://github.com/clMathLibraries/clFFT/issues/237
30 CXXFLAGS = "-std=c++98";
31
32 meta = with lib; {
33 description = "Library containing FFT functions written in OpenCL";
34 longDescription = ''
35 clFFT is a software library containing FFT functions written in OpenCL.
36 In addition to GPU devices, the library also supports running on CPU devices to facilitate debugging and heterogeneous programming.
37 '';
38 license = licenses.asl20;
39 homepage = "http://clmathlibraries.github.io/clFFT/";
40 platforms = platforms.unix;
41 maintainers = with maintainers; [ chessai ];
42 };
43}