nixpkgs/pkgs/development/compilers/halide/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

98 lines
2.5 KiB
Nix
Raw Normal View History

{ stdenv
, llvmPackages
2020-10-11 03:09:01 +00:00
, lib
, fetchFromGitHub
, cmake
, libffi
2020-10-11 03:09:01 +00:00
, libpng
, libjpeg
, mesa
, libGL
2020-10-11 03:09:01 +00:00
, eigen
, openblas
, blas
, lapack
2018-08-01 12:57:51 +00:00
}:
assert blas.implementation == "openblas" && lapack.implementation == "openblas";
stdenv.mkDerivation rec {
2020-10-11 03:09:01 +00:00
pname = "halide";
2023-07-02 06:39:14 +00:00
version = "16.0.0";
2018-08-01 12:57:51 +00:00
src = fetchFromGitHub {
owner = "halide";
repo = "Halide";
2020-10-11 03:09:01 +00:00
rev = "v${version}";
2023-07-02 06:39:14 +00:00
sha256 = "sha256-lJQrXkJgBmGb/QMSxwuPkkHOSgEDowLWzIolp1km2Y8=";
2018-08-01 12:57:51 +00:00
};
postPatch = ''
# See https://github.com/halide/Halide/issues/7785
substituteInPlace 'src/runtime/HalideRuntime.h' \
--replace '#if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)
#define HALIDE_CPP_COMPILER_HAS_FLOAT16' \
'#if defined(__x86_64__) || defined(__i386__)
#define HALIDE_CPP_COMPILER_HAS_FLOAT16'
# AvailabilityVersions.h is part of Apple SDK, and we do not want to depend on it
substituteInPlace 'src/runtime/HalideBuffer.h' \
--replace '#ifdef __APPLE__
#include <AvailabilityVersions.h>
#include <TargetConditionals.h>
#endif' \
' ' \
--replace 'TARGET_OS_OSX && (__MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_15)' \
'0' \
--replace 'TARGET_OS_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_14_0)' \
'0'
'';
cmakeFlags = [
"-DWARNINGS_AS_ERRORS=OFF"
"-DWITH_PYTHON_BINDINGS=OFF"
"-DTARGET_WEBASSEMBLY=OFF"
# Disable performance tests since they may fail on busy machines
"-DWITH_TEST_PERFORMANCE=OFF"
];
doCheck = true;
2018-08-01 12:57:51 +00:00
# Note: disable mullapudi2016_fibonacci because it requires too much
# parallelism for remote builders
ctestArgs = "--output-on-failure -E 'mullapudi2016_fibonacci'";
checkPhase = ''
runHook preCheck
ctest ${ctestArgs}
runHook postCheck
'';
2018-08-01 12:57:51 +00:00
# Note: only openblas and not atlas part of this Nix expression
# see pkgs/development/libraries/science/math/liblapack/3.5.0.nix
# to get a hint howto setup atlas instead of openblas
2021-05-30 12:17:56 +00:00
buildInputs = [
llvmPackages.llvm
llvmPackages.lld
llvmPackages.openmp
llvmPackages.libclang
libffi
2021-05-30 12:17:56 +00:00
libpng
libjpeg
eigen
openblas
] ++ lib.optionals (!stdenv.isDarwin) [
mesa
libGL
2021-05-30 12:17:56 +00:00
];
2018-08-01 12:57:51 +00:00
nativeBuildInputs = [ cmake ];
meta = with lib; {
description = "C++ based language for image processing and computational photography";
homepage = "https://halide-lang.org";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ ck3d atila twesterhout ];
2018-08-01 12:57:51 +00:00
};
}