colmap: 3.7 -> 3.9.1 + cuda build fix

This commit is contained in:
Julius Michaelis 2024-05-02 21:41:09 +09:00
parent 8f1e8d56da
commit 62c2c640da

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,
flann,
cgal,
gmp,
mpfr,
autoAddDriverRunpath,
config,
cudaSupport ? config.cudaSupport, cudaPackages
stdenv,
qt5,
xorg,
cudaSupport ? config.cudaSupport,
cudaCapabilities ? cudaPackages.cudaFlags.cudaCapabilities,
cudaPackages
}:
assert cudaSupport -> cudaPackages != { };
let
boost_static = boost179.override { enableStatic = true; };
stdenv' = if cudaSupport then cudaPackages.backendStdenv else stdenv;
# TODO: migrate to redist packages
inherit (cudaPackages) cudatoolkit;
in
mkDerivation rec {
version = "3.7";
stdenv'.mkDerivation rec {
version = "3.9.1";
pname = "colmap";
src = fetchFromGitHub {
owner = "colmap";
repo = "colmap";
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 [
"-DCUDA_ENABLED=ON"
"-DCUDA_NVCC_FLAGS=--std=c++14"
(lib.cmakeBool "CUDA_ENABLED" true)
(lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES"
(lib.strings.concatStringsSep ";"
(map cudaPackages.cudaFlags.dropDot
cudaCapabilities)))
];
buildInputs = [
boost_static ceres-solver eigen
freeimage glog libGLU glew qtbase
flann
cgal
gmp
mpfr
xorg.libSM
] ++ lib.optionals cudaSupport [
cudatoolkit
cudaPackages.cuda_cudart.static
];
nativeBuildInputs = [
cmake
qt5.wrapQtAppsHook
] ++ lib.optionals cudaSupport [
autoAddDriverRunpath
];