evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / by-name / ma / maa-assistant-arknights / fastdeploy-ppocr.nix
blob22a6e30a4151b5307f154b2cdbce1d832c56950a
2   stdenv,
3   config,
4   lib,
5   fetchFromGitHub,
6   cmake,
7   eigen,
8   onnxruntime,
9   opencv,
10   cudaSupport ? config.cudaSupport,
11   cudaPackages ? { },
12 }@inputs:
14 let
15   effectiveStdenv = if cudaSupport then cudaPackages.backendStdenv else inputs.stdenv;
17 effectiveStdenv.mkDerivation (finalAttrs: {
18   pname = "fastdeploy-ppocr";
19   version = "0-unstable-2023-10-09";
21   src = fetchFromGitHub {
22     owner = "MaaAssistantArknights";
23     repo = "FastDeploy";
24     # follows but not fully follows https://github.com/MaaAssistantArknights/MaaDeps/blob/master/vcpkg-overlay/ports/maa-fastdeploy/portfile.cmake#L4
25     rev = "0db6000aaac250824266ac37451f43ce272d80a3";
26     hash = "sha256-5TItnPDc5WShpZAgBYeqgI9KKkk3qw/M8HPMlq/H4BM=";
27   };
29   outputs = [
30     "out"
31     "cmake"
32   ];
34   nativeBuildInputs = [
35     cmake
36     eigen
37   ] ++ lib.optionals cudaSupport [ cudaPackages.cuda_nvcc ];
39   buildInputs =
40     [
41       onnxruntime
42       opencv
43     ]
44     ++ lib.optionals cudaSupport (
45       with cudaPackages;
46       [
47         cuda_cccl # cub/cub.cuh
48         libcublas # cublas_v2.h
49         libcurand # curand.h
50         libcusparse # cusparse.h
51         libcufft # cufft.h
52         cudnn # cudnn.h
53         cuda_cudart
54       ]
55     );
57   cmakeBuildType = "None";
59   cmakeFlags =
60     [
61       (lib.cmakeBool "BUILD_SHARED_LIBS" true)
62     ]
63     ++ lib.optionals cudaSupport [
64       (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" cudaPackages.flags.cmakeCudaArchitecturesString)
65     ];
67   postInstall = ''
68     mkdir $cmake
69     install -Dm644 ${finalAttrs.src}/cmake/Findonnxruntime.cmake $cmake/
70   '';
72   meta = with lib; {
73     description = "MaaAssistantArknights stripped-down version of FastDeploy";
74     homepage = "https://github.com/MaaAssistantArknights/FastDeploy";
75     platforms = platforms.linux ++ platforms.darwin;
76     license = licenses.asl20;
77     broken = cudaSupport && stdenv.hostPlatform.system != "x86_64-linux";
78   };