about summary refs log tree commit diff
path: root/pkgs/applications/science/misc/colmap/default.nix
diff options
context:
space:
mode:
authorSerge K <sergei.kozlukov@aalto.fi>2022-04-27 23:09:30 +0000
committerGitHub <noreply@github.com>2022-04-27 16:09:30 -0700
commit1248ea16e1a2009dec2f7a88fba7a77fd77d3a07 (patch)
tree8bb267fd1fc49855fbf06353abfa22ddea733980 /pkgs/applications/science/misc/colmap/default.nix
parent7e254c053485e573c7c26e212a425b95036a4639 (diff)
colmap: fix for cuda11.6/gcc11 (#169623)
* colmap: force nvcc std=c++14 after gcc11 bump

* colmap: optional -> optionals

* colmap: sha256 -> hash

* colmapWithCuda: force CUDA_ENABLED=ON safeguard

* colmapWithCuda: add opengl runpath
Diffstat (limited to 'pkgs/applications/science/misc/colmap/default.nix')
-rw-r--r--pkgs/applications/science/misc/colmap/default.nix28
1 files changed, 22 insertions, 6 deletions
diff --git a/pkgs/applications/science/misc/colmap/default.nix b/pkgs/applications/science/misc/colmap/default.nix
index c41c8593a5c49..8dc8f749897ee 100644
--- a/pkgs/applications/science/misc/colmap/default.nix
+++ b/pkgs/applications/science/misc/colmap/default.nix
@@ -1,10 +1,14 @@
 { mkDerivation, lib, fetchFromGitHub, cmake, boost17x, ceres-solver, eigen,
   freeimage, glog, libGLU, glew, qtbase,
-  cudaSupport ? false, cudatoolkit ? null }:
+  cudaSupport ? false, cudaPackages }:
 
-assert !cudaSupport || cudatoolkit != null;
+assert cudaSupport -> cudaPackages != { };
 
-let boost_static = boost17x.override { enableStatic = true; };
+let
+  boost_static = boost17x.override { enableStatic = true; };
+
+  # TODO: migrate to redist packages
+  inherit (cudaPackages) cudatoolkit;
 in
 mkDerivation rec {
   version = "3.7";
@@ -13,15 +17,27 @@ mkDerivation rec {
      owner = "colmap";
      repo = "colmap";
      rev = version;
-     sha256 = "sha256-uVAw6qwhpgIpHkXgxttKupU9zU+vD0Za0maw2Iv4x+I=";
+     hash = "sha256-uVAw6qwhpgIpHkXgxttKupU9zU+vD0Za0maw2Iv4x+I=";
   };
 
+  # TODO: rm once the gcc11 issue is closed, https://github.com/colmap/colmap/issues/1418#issuecomment-1049305256
+  cmakeFlags = lib.optionals cudaSupport [
+    "-DCUDA_ENABLED=ON"
+    "-DCUDA_NVCC_FLAGS=--std=c++14"
+  ];
+
   buildInputs = [
     boost_static ceres-solver eigen
     freeimage glog libGLU glew qtbase
-  ] ++ lib.optional cudaSupport cudatoolkit;
+  ] ++ lib.optionals cudaSupport [
+    cudatoolkit
+  ];
 
-  nativeBuildInputs = [ cmake ];
+  nativeBuildInputs = [
+    cmake
+  ] ++ lib.optionals cudaSupport [
+    cudaPackages.autoAddOpenGLRunpathHook
+  ];
 
   meta = with lib; {
     description = "COLMAP - Structure-From-Motion and Multi-View Stereo pipeline";