2021-01-05 15:31:35 +00:00
|
|
|
{ stdenv, config, lib, fetchFromGitHub, cmake, libusb1, ninja, pkg-config, gcc
|
2020-07-12 20:55:11 +00:00
|
|
|
, cudaSupport ? config.cudaSupport or false, cudatoolkit
|
|
|
|
, enablePython ? false, pythonPackages ? null }:
|
|
|
|
|
|
|
|
assert cudaSupport -> cudatoolkit != null;
|
|
|
|
assert enablePython -> pythonPackages != null;
|
2018-05-08 18:53:23 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "librealsense";
|
2021-01-05 15:31:35 +00:00
|
|
|
version = "2.41.0";
|
2019-11-29 20:35:06 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
2018-05-08 18:53:23 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "IntelRealSense";
|
2019-11-29 20:35:06 +00:00
|
|
|
repo = pname;
|
2018-05-08 18:53:23 +00:00
|
|
|
rev = "v${version}";
|
2021-01-05 15:31:35 +00:00
|
|
|
sha256 = "0ngv9fgja72vg7hq1aiwpa7x4dhniawhpd8mqm85pqkjxiph8s1k";
|
2018-05-08 18:53:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
2019-11-29 20:35:06 +00:00
|
|
|
libusb1
|
2020-07-12 20:55:11 +00:00
|
|
|
gcc.cc.lib
|
|
|
|
] ++ lib.optional cudaSupport cudatoolkit
|
|
|
|
++ lib.optional enablePython pythonPackages.python;
|
|
|
|
|
|
|
|
patches = lib.optionals enablePython [
|
|
|
|
./py_sitepackage_dir.patch
|
2018-05-08 18:53:23 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
ninja
|
2021-01-05 15:31:35 +00:00
|
|
|
pkg-config
|
2018-05-08 18:53:23 +00:00
|
|
|
];
|
|
|
|
|
2020-07-12 20:55:11 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_EXAMPLES=ON"
|
|
|
|
"-DBUILD_GRAPHICAL_EXAMPLES=OFF"
|
|
|
|
"-DBUILD_GLSL_EXTENSIONS=OFF"
|
|
|
|
] ++ lib.optionals enablePython [
|
|
|
|
"-DBUILD_PYTHON_BINDINGS:bool=true"
|
|
|
|
"-DXXNIX_PYTHON_SITEPACKAGES=${placeholder "out"}/${pythonPackages.python.sitePackages}"
|
|
|
|
] ++ lib.optional cudaSupport "-DBUILD_WITH_CUDA:bool=true";
|
|
|
|
|
|
|
|
# ensure python package contains its __init__.py. for some reason the install
|
|
|
|
# script does not do this, and it's questionable if intel knows it should be
|
|
|
|
# done
|
|
|
|
# ( https://github.com/IntelRealSense/meta-intel-realsense/issues/20 )
|
|
|
|
postInstall = lib.optionalString enablePython ''
|
|
|
|
cp ../wrappers/python/pyrealsense2/__init__.py $out/${pythonPackages.python.sitePackages}/pyrealsense2
|
|
|
|
'';
|
2018-05-08 18:53:23 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2018-05-08 18:53:23 +00:00
|
|
|
description = "A cross-platform library for Intel® RealSense™ depth cameras (D400 series and the SR300)";
|
2019-11-29 20:35:06 +00:00
|
|
|
homepage = "https://github.com/IntelRealSense/librealsense";
|
2018-05-08 18:53:23 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ brian-dawn ];
|
2019-11-29 20:35:06 +00:00
|
|
|
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
|
2018-05-08 18:53:23 +00:00
|
|
|
};
|
|
|
|
}
|