diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-01-10 07:13:44 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-01-12 14:07:16 +0000 |
commit | e2698550456abba83c6dcd5d5e5a9990a0b96f8a (patch) | |
tree | 79a56f0df3fa55e470d84b4dff6059fbf487ec18 /nixpkgs/pkgs/development/libraries/librealsense | |
parent | 1cdc42df888dc98c347e03bd942ed9825a55bcb3 (diff) | |
parent | 84d74ae9c9cbed73274b8e4e00be14688ffc93fe (diff) | |
download | nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.gz nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.bz2 nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.lz nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.xz nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.zst nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.zip |
Merge commit '84d74ae9c9cbed73274b8e4e00be14688ffc93fe'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/librealsense')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/librealsense/default.nix | 34 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/librealsense/py_sitepackage_dir.patch | 15 |
2 files changed, 45 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/development/libraries/librealsense/default.nix b/nixpkgs/pkgs/development/libraries/librealsense/default.nix index 21f80f80efa0..55171cd3de4e 100644 --- a/nixpkgs/pkgs/development/libraries/librealsense/default.nix +++ b/nixpkgs/pkgs/development/libraries/librealsense/default.nix @@ -1,8 +1,13 @@ -{ stdenv, fetchFromGitHub, cmake, libusb1, ninja, pkgconfig }: +{ 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; stdenv.mkDerivation rec { pname = "librealsense"; - version = "2.35.2"; + version = "2.38.0"; outputs = [ "out" "dev" ]; @@ -10,11 +15,17 @@ stdenv.mkDerivation rec { owner = "IntelRealSense"; repo = pname; rev = "v${version}"; - sha256 = "14vf76vlyhh7b4yjzsnqpg1x3wdhwxrf1syvgf8wyxbjwb9plw82"; + sha256 = "12rs0gklgzn8bplqjmaxixk04pr870i333mmcp9i5bhkn8x86zbx"; }; buildInputs = [ libusb1 + gcc.cc.lib + ] ++ lib.optional cudaSupport cudatoolkit + ++ lib.optional enablePython pythonPackages.python; + + patches = lib.optionals enablePython [ + ./py_sitepackage_dir.patch ]; nativeBuildInputs = [ @@ -23,7 +34,22 @@ stdenv.mkDerivation rec { pkgconfig ]; - cmakeFlags = [ "-DBUILD_EXAMPLES=false" ]; + 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 + ''; meta = with stdenv.lib; { description = "A cross-platform library for IntelĀ® RealSenseā¢ depth cameras (D400 series and the SR300)"; diff --git a/nixpkgs/pkgs/development/libraries/librealsense/py_sitepackage_dir.patch b/nixpkgs/pkgs/development/libraries/librealsense/py_sitepackage_dir.patch new file mode 100644 index 000000000000..99b567a429ed --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/librealsense/py_sitepackage_dir.patch @@ -0,0 +1,15 @@ +--- a/wrappers/python/CMakeLists.txt ++++ b/wrappers/python/CMakeLists.txt +@@ -10,11 +10,11 @@ + if (CMAKE_VERSION VERSION_LESS 3.12) + find_package(PythonInterp REQUIRED) + find_package(PythonLibs REQUIRED) +- set(PYTHON_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/pyrealsense2" CACHE PATH "Installation directory for Python bindings") ++ set(PYTHON_INSTALL_DIR "${XXNIX_PYTHON_SITEPACKAGES}/pyrealsense2" CACHE PATH "Installation directory for Python bindings") + set(CMAKECONFIG_PY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/pyrealsense2") + else() + find_package(Python REQUIRED COMPONENTS Interpreter Development) +- set(PYTHON_INSTALL_DIR "${Python_SITEARCH}/pyrealsense2" CACHE PATH "Installation directory for Python bindings") ++ set(PYTHON_INSTALL_DIR "${XXNIX_PYTHON_SITEPACKAGES}/pyrealsense2" CACHE PATH "Installation directory for Python bindings") + set(CMAKECONFIG_PY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/pyrealsense2") + endif() |