Merge pull request #308521 from jcaesar/pr-4

colmap: 3.7 -> 3.9.1 + cuda build fix
This commit is contained in:
Peder Bergebakken Sundt 2024-07-08 21:29:08 +02:00 committed by GitHub
commit b6f9209160
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,43 +1,62 @@
{ mkDerivation, lib, fetchFromGitHub, cmake, boost179, ceres-solver, eigen, { lib, fetchFromGitHub, cmake, boost179, ceres-solver, eigen,
freeimage, glog, libGLU, glew, qtbase, freeimage, glog, libGLU, glew, qtbase,
flann,
cgal,
gmp,
mpfr,
autoAddDriverRunpath, autoAddDriverRunpath,
config, config,
cudaSupport ? config.cudaSupport, cudaPackages stdenv,
qt5,
xorg,
cudaSupport ? config.cudaSupport,
cudaCapabilities ? cudaPackages.cudaFlags.cudaCapabilities,
cudaPackages
}: }:
assert cudaSupport -> cudaPackages != { }; assert cudaSupport -> cudaPackages != { };
let let
boost_static = boost179.override { enableStatic = true; }; boost_static = boost179.override { enableStatic = true; };
stdenv' = if cudaSupport then cudaPackages.backendStdenv else stdenv;
# TODO: migrate to redist packages # TODO: migrate to redist packages
inherit (cudaPackages) cudatoolkit; inherit (cudaPackages) cudatoolkit;
in in
mkDerivation rec { stdenv'.mkDerivation rec {
version = "3.7"; version = "3.9.1";
pname = "colmap"; pname = "colmap";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "colmap"; owner = "colmap";
repo = "colmap"; repo = "colmap";
rev = version; rev = version;
hash = "sha256-uVAw6qwhpgIpHkXgxttKupU9zU+vD0Za0maw2Iv4x+I="; hash = "sha256-Xb4JOttCMERwPYs5DyGKHw+f9Wik1/rdJQKbgVuygH8=";
}; };
# TODO: rm once the gcc11 issue is closed, https://github.com/colmap/colmap/issues/1418#issuecomment-1049305256
cmakeFlags = lib.optionals cudaSupport [ cmakeFlags = lib.optionals cudaSupport [
"-DCUDA_ENABLED=ON" (lib.cmakeBool "CUDA_ENABLED" true)
"-DCUDA_NVCC_FLAGS=--std=c++14" (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES"
(lib.strings.concatStringsSep ";"
(map cudaPackages.cudaFlags.dropDot
cudaCapabilities)))
]; ];
buildInputs = [ buildInputs = [
boost_static ceres-solver eigen boost_static ceres-solver eigen
freeimage glog libGLU glew qtbase freeimage glog libGLU glew qtbase
flann
cgal
gmp
mpfr
xorg.libSM
] ++ lib.optionals cudaSupport [ ] ++ lib.optionals cudaSupport [
cudatoolkit cudatoolkit
cudaPackages.cuda_cudart.static
]; ];
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
qt5.wrapQtAppsHook
] ++ lib.optionals cudaSupport [ ] ++ lib.optionals cudaSupport [
autoAddDriverRunpath autoAddDriverRunpath
]; ];