2021-01-19 06:50:56 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, cmake, pkg-config, ispc, tbb, glfw,
|
2020-10-06 14:00:14 +00:00
|
|
|
openimageio, libjpeg, libpng, libpthreadstubs, libX11, glib }:
|
2020-09-18 12:12:27 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "embree";
|
2021-08-14 05:48:59 +00:00
|
|
|
version = "3.13.1";
|
2020-09-18 12:12:27 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "embree";
|
|
|
|
repo = "embree";
|
|
|
|
rev = "v${version}";
|
2021-08-14 05:48:59 +00:00
|
|
|
sha256 = "sha256-6BL/NnveIMg+xD8Zsc3sidL0iw0YbJITgd8Zf4Mh28I=";
|
2020-09-18 12:12:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# Fix duplicate /nix/store/.../nix/store/.../ paths
|
|
|
|
sed -i "s|SET(EMBREE_ROOT_DIR .*)|set(EMBREE_ROOT_DIR $out)|" \
|
|
|
|
common/cmake/embree-config.cmake
|
|
|
|
sed -i "s|$""{EMBREE_ROOT_DIR}/||" common/cmake/embree-config.cmake
|
2020-10-06 14:00:14 +00:00
|
|
|
substituteInPlace common/math/math.h --replace 'defined(__MACOSX__) && !defined(__INTEL_COMPILER)' 0
|
|
|
|
substituteInPlace common/math/math.h --replace 'defined(__WIN32__) || defined(__FreeBSD__)' 'defined(__WIN32__) || defined(__FreeBSD__) || defined(__MACOSX__)'
|
2020-09-18 12:12:27 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DEMBREE_TUTORIALS=OFF"
|
|
|
|
"-DEMBREE_RAY_MASK=ON"
|
|
|
|
];
|
|
|
|
|
2020-10-06 14:00:14 +00:00
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ ispc pkg-config cmake ];
|
2020-10-06 14:00:14 +00:00
|
|
|
buildInputs = [ tbb glfw openimageio libjpeg libpng libX11 libpthreadstubs ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ glib ];
|
2020-09-18 12:12:27 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2020-09-18 12:12:27 +00:00
|
|
|
description = "High performance ray tracing kernels from Intel";
|
|
|
|
homepage = "https://embree.github.io/";
|
|
|
|
maintainers = with maintainers; [ hodapp gebner ];
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|