3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/libraries/librealsense/default.nix

62 lines
1.9 KiB
Nix
Raw Normal View History

{ stdenv, config, lib, fetchFromGitHub, cmake, libusb1, ninja, pkgconfig, gcc
, cudaSupport ? config.cudaSupport or false, cudatoolkit
, enablePython ? false, pythonPackages ? null }:
assert cudaSupport -> cudatoolkit != null;
assert enablePython -> pythonPackages != null;
2018-05-08 19:53:23 +01:00
stdenv.mkDerivation rec {
pname = "librealsense";
2020-07-12 09:17:52 +01:00
version = "2.36.0";
outputs = [ "out" "dev" ];
2018-05-08 19:53:23 +01:00
src = fetchFromGitHub {
owner = "IntelRealSense";
repo = pname;
2018-05-08 19:53:23 +01:00
rev = "v${version}";
2020-07-12 09:17:52 +01:00
sha256 = "1dfkhnybnd8qnljf3y3hjyamaqzw733hb3swy4hjcsdm9dh0wpay";
2018-05-08 19:53:23 +01:00
};
buildInputs = [
libusb1
gcc.cc.lib
] ++ lib.optional cudaSupport cudatoolkit
++ lib.optional enablePython pythonPackages.python;
patches = lib.optionals enablePython [
./py_sitepackage_dir.patch
2018-05-08 19:53:23 +01:00
];
nativeBuildInputs = [
cmake
ninja
pkgconfig
];
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 19:53:23 +01:00
meta = with stdenv.lib; {
description = "A cross-platform library for Intel® RealSense depth cameras (D400 series and the SR300)";
homepage = "https://github.com/IntelRealSense/librealsense";
2018-05-08 19:53:23 +01:00
license = licenses.asl20;
maintainers = with maintainers; [ brian-dawn ];
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
2018-05-08 19:53:23 +01:00
};
}