summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/cl/clfft/package.nix
blob: df0b9f0fd36db215d1bee1f288110b59148f75b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
  lib,
  gccStdenv,
  fetchFromGitHub,
  cmake,
  fftw,
  fftwFloat,
  boost,
  opencl-clhpp,
  ocl-icd,
}:

let
  stdenv = gccStdenv;
in
stdenv.mkDerivation (finalAttrs: {
  pname = "clfft";
  version = "2.12.2";

  strictDeps = true;
  __structuredAttrs = true;

  src = fetchFromGitHub {
    owner = "clMathLibraries";
    repo = "clFFT";
    tag = "v${finalAttrs.version}";
    hash = "sha256-yp7u6qhpPYQpBw3d+VLg0GgMyZONVII8BsBCEoRZm4w=";
  };

  sourceRoot = "${finalAttrs.src.name}/src";

  postPatch = ''
    sed -i '/-m64/d;/-m32/d' CMakeLists.txt
    substituteInPlace CMakeLists.txt --replace-fail \
      'cmake_minimum_required( VERSION 2.6 )' \
      'cmake_minimum_required( VERSION 3.5 ) '
  '';

  nativeBuildInputs = [ cmake ];

  buildInputs = [
    fftw
    fftwFloat
    boost
  ]
  ++ lib.optionals stdenv.hostPlatform.isLinux [
    opencl-clhpp
    ocl-icd
  ];

  # https://github.com/clMathLibraries/clFFT/issues/237
  env.CXXFLAGS = "-std=c++98";

  meta = {
    description = "Library containing FFT functions written in OpenCL";
    longDescription = ''
      clFFT is a software library containing FFT functions written in OpenCL.
      In addition to GPU devices, the library also supports running on CPU devices to facilitate debugging and heterogeneous programming.
    '';
    license = lib.licenses.asl20;
    homepage = "http://clmathlibraries.github.io/clFFT/";
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [ chessai ];
  };
})