maa-assistant-arknights: support darwin
This commit is contained in:
parent
4a4ecb0ab4
commit
5305327b00
@ -1,14 +1,15 @@
|
||||
{ stdenv
|
||||
, config
|
||||
, pkgs
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, cmake
|
||||
, eigen
|
||||
, onnxruntime
|
||||
, opencv
|
||||
, cudaSupport ? config.cudaSupport
|
||||
, cudaPackages ? { }
|
||||
{
|
||||
stdenv,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
cmake,
|
||||
eigen,
|
||||
onnxruntime,
|
||||
opencv,
|
||||
cudaSupport ? config.cudaSupport,
|
||||
cudaPackages ? { },
|
||||
}@inputs:
|
||||
|
||||
let
|
||||
@ -30,34 +31,42 @@ effectiveStdenv.mkDerivation (finalAttrs: {
|
||||
hash = "sha256-5TItnPDc5WShpZAgBYeqgI9KKkk3qw/M8HPMlq/H4BM=";
|
||||
};
|
||||
|
||||
outputs = [ "out" "cmake" ];
|
||||
outputs = [
|
||||
"out"
|
||||
"cmake"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
eigen
|
||||
] ++ lib.optionals cudaSupport [
|
||||
cudaPackages.cuda_nvcc
|
||||
];
|
||||
] ++ lib.optionals cudaSupport [ cudaPackages.cuda_nvcc ];
|
||||
|
||||
buildInputs = [
|
||||
onnxruntime
|
||||
opencv
|
||||
] ++ lib.optionals cudaSupport (with cudaPackages; [
|
||||
cuda_cccl # cub/cub.cuh
|
||||
libcublas # cublas_v2.h
|
||||
libcurand # curand.h
|
||||
libcusparse # cusparse.h
|
||||
libcufft # cufft.h
|
||||
cudnn # cudnn.h
|
||||
cuda_cudart
|
||||
]);
|
||||
buildInputs =
|
||||
[
|
||||
onnxruntime
|
||||
opencv
|
||||
]
|
||||
++ lib.optionals cudaSupport (
|
||||
with cudaPackages;
|
||||
[
|
||||
cuda_cccl # cub/cub.cuh
|
||||
libcublas # cublas_v2.h
|
||||
libcurand # curand.h
|
||||
libcusparse # cusparse.h
|
||||
libcufft # cufft.h
|
||||
cudnn # cudnn.h
|
||||
cuda_cudart
|
||||
]
|
||||
);
|
||||
|
||||
cmakeFlags = [
|
||||
(lib.cmakeFeature "CMAKE_BUILD_TYPE" "None")
|
||||
(lib.cmakeBool "BUILD_SHARED_LIBS" true)
|
||||
] ++ lib.optionals cudaSupport [
|
||||
(lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" cudaArchitecturesString)
|
||||
];
|
||||
cmakeFlags =
|
||||
[
|
||||
(lib.cmakeFeature "CMAKE_BUILD_TYPE" "None")
|
||||
(lib.cmakeBool "BUILD_SHARED_LIBS" true)
|
||||
]
|
||||
++ lib.optionals cudaSupport [
|
||||
(lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" cudaArchitecturesString)
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
mkdir $cmake
|
||||
@ -67,7 +76,7 @@ effectiveStdenv.mkDerivation (finalAttrs: {
|
||||
meta = with lib; {
|
||||
description = "MaaAssistantArknights stripped-down version of FastDeploy";
|
||||
homepage = "https://github.com/MaaAssistantArknights/FastDeploy";
|
||||
platforms = platforms.linux;
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
license = licenses.asl20;
|
||||
broken = cudaSupport && stdenv.hostPlatform.system != "x86_64-linux";
|
||||
};
|
||||
|
@ -1,24 +1,26 @@
|
||||
{ lib
|
||||
, config
|
||||
, callPackage
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, asio
|
||||
, cmake
|
||||
, eigen
|
||||
, libcpr
|
||||
, onnxruntime
|
||||
, opencv
|
||||
, isBeta ? false
|
||||
, cudaSupport ? config.cudaSupport
|
||||
, cudaPackages ? { }
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
callPackage,
|
||||
stdenv,
|
||||
overrideSDK,
|
||||
fetchFromGitHub,
|
||||
asio,
|
||||
cmake,
|
||||
libcpr,
|
||||
onnxruntime,
|
||||
opencv,
|
||||
isBeta ? false,
|
||||
cudaSupport ? config.cudaSupport,
|
||||
cudaPackages ? { },
|
||||
}:
|
||||
|
||||
let
|
||||
fastdeploy = callPackage ./fastdeploy-ppocr.nix { };
|
||||
sources = lib.importJSON ./pin.json;
|
||||
in
|
||||
stdenv.mkDerivation (finalAttr: {
|
||||
# https://github.com/NixOS/nixpkgs/issues/314160
|
||||
(if stdenv.isDarwin then overrideSDK stdenv "11.0" else stdenv).mkDerivation (finalAttr: {
|
||||
pname = "maa-assistant-arknights" + lib.optionalString isBeta "-beta";
|
||||
version = if isBeta then sources.beta.version else sources.stable.version;
|
||||
|
||||
@ -33,24 +35,27 @@ stdenv.mkDerivation (finalAttr: {
|
||||
asio
|
||||
cmake
|
||||
fastdeploy.cmake
|
||||
] ++ lib.optionals cudaSupport [
|
||||
cudaPackages.cuda_nvcc
|
||||
];
|
||||
] ++ lib.optionals cudaSupport [ cudaPackages.cuda_nvcc ];
|
||||
|
||||
buildInputs = [
|
||||
fastdeploy
|
||||
libcpr
|
||||
onnxruntime
|
||||
opencv
|
||||
] ++ lib.optionals cudaSupport (with cudaPackages; [
|
||||
cuda_cccl # cub/cub.cuh
|
||||
libcublas # cublas_v2.h
|
||||
libcurand # curand.h
|
||||
libcusparse # cusparse.h
|
||||
libcufft # cufft.h
|
||||
cudnn # cudnn.h
|
||||
cuda_cudart
|
||||
]);
|
||||
buildInputs =
|
||||
[
|
||||
fastdeploy
|
||||
libcpr
|
||||
onnxruntime
|
||||
opencv
|
||||
]
|
||||
++ lib.optionals cudaSupport (
|
||||
with cudaPackages;
|
||||
[
|
||||
cuda_cccl # cub/cub.cuh
|
||||
libcublas # cublas_v2.h
|
||||
libcurand # curand.h
|
||||
libcusparse # cusparse.h
|
||||
libcufft # cufft.h
|
||||
cudnn # cudnn.h
|
||||
cuda_cudart
|
||||
]
|
||||
);
|
||||
|
||||
cmakeFlags = [
|
||||
(lib.cmakeBool "BUILD_SHARED_LIBS" true)
|
||||
@ -64,6 +69,10 @@ stdenv.mkDerivation (finalAttr: {
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
postPatch = ''
|
||||
cp -v ${fastdeploy.cmake}/Findonnxruntime.cmake cmake/
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/share/${finalAttr.pname}
|
||||
mv $out/{Python,resource} $out/share/${finalAttr.pname}
|
||||
@ -74,6 +83,6 @@ stdenv.mkDerivation (finalAttr: {
|
||||
homepage = "https://github.com/MaaAssistantArknights/MaaAssistantArknights";
|
||||
license = licenses.agpl3Only;
|
||||
maintainers = with maintainers; [ Cryolitia ];
|
||||
platforms = platforms.linux;
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
};
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user