diff --git a/pkgs/applications/science/misc/colmap/0001-lib-PoissonRecon-fix-build-with-clang-19.patch b/pkgs/applications/science/misc/colmap/0001-lib-PoissonRecon-fix-build-with-clang-19.patch new file mode 100644 index 000000000000..cd12547ab82f --- /dev/null +++ b/pkgs/applications/science/misc/colmap/0001-lib-PoissonRecon-fix-build-with-clang-19.patch @@ -0,0 +1,71 @@ +From f3b1238483cc9bc3869c40e63a4cebf32052c624 Mon Sep 17 00:00:00 2001 +From: Samuel Tam +Date: Sun, 2 Mar 2025 16:35:03 +0000 +Subject: [PATCH] lib/PoissonRecon: fix build with clang 19 + +https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281867 +--- + src/thirdparty/PoissonRecon/Ply.h | 8 ++++---- + src/thirdparty/PoissonRecon/SparseMatrix.inl | 6 ------ + 2 files changed, 4 insertions(+), 10 deletions(-) + +diff --git a/src/thirdparty/PoissonRecon/Ply.h b/src/thirdparty/PoissonRecon/Ply.h +index 699381ff..e5831263 100644 +--- a/src/thirdparty/PoissonRecon/Ply.h ++++ b/src/thirdparty/PoissonRecon/Ply.h +@@ -301,7 +301,7 @@ public: + PlyValueVertex( void ) : value( Real(0) ) { ; } + PlyValueVertex( Point3D< Real > p , Real v ) : point(p) , value(v) { ; } + PlyValueVertex operator + ( PlyValueVertex p ) const { return PlyValueVertex( point+p.point , value+p.value ); } +- PlyValueVertex operator - ( PlyValueVertex p ) const { return PlyValueVertex( point-p.value , value-p.value ); } ++ PlyValueVertex operator - ( PlyValueVertex p ) const { return PlyValueVertex( point-p.point , value-p.value ); } + template< class _Real > PlyValueVertex operator * ( _Real s ) const { return PlyValueVertex( point*s , Real(value*s) ); } + template< class _Real > PlyValueVertex operator / ( _Real s ) const { return PlyValueVertex( point/s , Real(value/s) ); } + PlyValueVertex& operator += ( PlyValueVertex p ) { point += p.point , value += p.value ; return *this; } +@@ -340,7 +340,7 @@ public: + PlyOrientedVertex( void ) { ; } + PlyOrientedVertex( Point3D< Real > p , Point3D< Real > n ) : point(p) , normal(n) { ; } + PlyOrientedVertex operator + ( PlyOrientedVertex p ) const { return PlyOrientedVertex( point+p.point , normal+p.normal ); } +- PlyOrientedVertex operator - ( PlyOrientedVertex p ) const { return PlyOrientedVertex( point-p.value , normal-p.normal ); } ++ PlyOrientedVertex operator - ( PlyOrientedVertex p ) const { return PlyOrientedVertex( point-p.point , normal-p.normal ); } + template< class _Real > PlyOrientedVertex operator * ( _Real s ) const { return PlyOrientedVertex( point*s , normal*s ); } + template< class _Real > PlyOrientedVertex operator / ( _Real s ) const { return PlyOrientedVertex( point/s , normal/s ); } + PlyOrientedVertex& operator += ( PlyOrientedVertex p ) { point += p.point , normal += p.normal ; return *this; } +@@ -386,7 +386,7 @@ public: + } + + _PlyColorVertex operator + ( _PlyColorVertex p ) const { return _PlyColorVertex( point+p.point , color+p.color ); } +- _PlyColorVertex operator - ( _PlyColorVertex p ) const { return _PlyColorVertex( point-p.value , color-p.color ); } ++ _PlyColorVertex operator - ( _PlyColorVertex p ) const { return _PlyColorVertex( point-p.point , color-p.color ); } + template< class _Real > _PlyColorVertex operator * ( _Real s ) const { return _PlyColorVertex( point*s , color*s ); } + template< class _Real > _PlyColorVertex operator / ( _Real s ) const { return _PlyColorVertex( point/s , color/s ); } + _PlyColorVertex& operator += ( _PlyColorVertex p ) { point += p.point , color += p.color ; return *this; } +@@ -455,7 +455,7 @@ public: + } + + _PlyColorAndValueVertex operator + ( _PlyColorAndValueVertex p ) const { return _PlyColorAndValueVertex( point+p.point , color+p.color , value+p.value ); } +- _PlyColorAndValueVertex operator - ( _PlyColorAndValueVertex p ) const { return _PlyColorAndValueVertex( point-p.value , color-p.color , value+p.value ); } ++ _PlyColorAndValueVertex operator - ( _PlyColorAndValueVertex p ) const { return _PlyColorAndValueVertex( point-p.point , color-p.color , value+p.value ); } + template< class _Real > _PlyColorAndValueVertex operator * ( _Real s ) const { return _PlyColorAndValueVertex( point*s , color*s , value*s ); } + template< class _Real > _PlyColorAndValueVertex operator / ( _Real s ) const { return _PlyColorAndValueVertex( point/s , color/s , value/s ); } + _PlyColorAndValueVertex& operator += ( _PlyColorAndValueVertex p ) { point += p.point , color += p.color , value += p.value ; return *this; } +diff --git a/src/thirdparty/PoissonRecon/SparseMatrix.inl b/src/thirdparty/PoissonRecon/SparseMatrix.inl +index c181d827..de310538 100755 +--- a/src/thirdparty/PoissonRecon/SparseMatrix.inl ++++ b/src/thirdparty/PoissonRecon/SparseMatrix.inl +@@ -192,12 +192,6 @@ void SparseMatrix< T >::SetRowSize( int row , int count ) + } + + +-template +-void SparseMatrix::SetZero() +-{ +- Resize(this->m_N, this->m_M); +-} +- + template + SparseMatrix SparseMatrix::operator * (const T& V) const + { +-- +2.47.1 + diff --git a/pkgs/applications/science/misc/colmap/default.nix b/pkgs/applications/science/misc/colmap/default.nix index 70f359b545d7..978bf006e751 100644 --- a/pkgs/applications/science/misc/colmap/default.nix +++ b/pkgs/applications/science/misc/colmap/default.nix @@ -1,6 +1,8 @@ { lib, fetchFromGitHub, + fetchpatch, + gitUpdater, cmake, boost, ceres-solver, @@ -14,6 +16,8 @@ cgal, gmp, mpfr, + poselib, + lz4, autoAddDriverRunpath, config, stdenv, @@ -34,49 +38,66 @@ let inherit (cudaPackages) cudatoolkit; in stdenv'.mkDerivation rec { - version = "3.9.1"; + version = "3.11.1"; pname = "colmap"; src = fetchFromGitHub { owner = "colmap"; repo = "colmap"; rev = version; - hash = "sha256-Xb4JOttCMERwPYs5DyGKHw+f9Wik1/rdJQKbgVuygH8="; + hash = "sha256-xtA0lEAq38/AHI3C9FhvjV5JPfVawrFr1fga4J1pi/0="; }; - cmakeFlags = lib.optionals cudaSupport [ - (lib.cmakeBool "CUDA_ENABLED" true) - (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" ( - lib.strings.concatStringsSep ";" (map cudaPackages.flags.dropDots cudaCapabilities) - )) + patches = [ + ./0001-lib-PoissonRecon-fix-build-with-clang-19.patch ]; - 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 - ]; + cmakeFlags = + [ + (lib.cmakeBool "FETCH_POSELIB" false) + ] + ++ lib.optionals cudaSupport [ + (lib.cmakeBool "CUDA_ENABLED" true) + (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" ( + lib.strings.concatStringsSep ";" (map cudaPackages.cudaFlags.dropDots cudaCapabilities) + )) + ]; - nativeBuildInputs = [ - cmake - qt5.wrapQtAppsHook - ] - ++ lib.optionals cudaSupport [ - autoAddDriverRunpath - ]; + buildInputs = + [ + boost_static + ceres-solver + eigen + freeimage + glog + libGLU + glew + qtbase + flann + lz4 + cgal + gmp + mpfr + xorg.libSM + poselib + ] + ++ lib.optionals cudaSupport [ + cudatoolkit + cudaPackages.cuda_cudart.static + ]; + + nativeBuildInputs = + [ + cmake + qt5.wrapQtAppsHook + ] + ++ lib.optionals cudaSupport [ + autoAddDriverRunpath + ]; + + enableParallelBuilding = true; + enableParallelInstalling = true; + + passthru.updateScript = gitUpdater { }; meta = with lib; { description = "Structure-From-Motion and Multi-View Stereo pipeline"; @@ -84,9 +105,13 @@ stdenv'.mkDerivation rec { COLMAP is a general-purpose Structure-from-Motion (SfM) and Multi-View Stereo (MVS) pipeline with a graphical and command-line interface. ''; + mainProgram = "colmap"; homepage = "https://colmap.github.io/index.html"; license = licenses.bsd3; - platforms = platforms.linux; - maintainers = with maintainers; [ lebastr ]; + platforms = platforms.unix; + maintainers = with maintainers; [ + lebastr + usertam + ]; }; -} +} \ No newline at end of file