diff --git a/pkgs/applications/science/misc/colmap/default.nix b/pkgs/applications/science/misc/colmap/default.nix deleted file mode 100644 index 10d59e15d2f16..0000000000000 --- a/pkgs/applications/science/misc/colmap/default.nix +++ /dev/null @@ -1,75 +0,0 @@ -{ lib, fetchFromGitHub, cmake, boost, ceres-solver, eigen, - freeimage, glog, libGLU, glew, qtbase, - flann, - cgal, - gmp, - mpfr, - autoAddDriverRunpath, - config, - stdenv, - qt5, - xorg, - cudaSupport ? config.cudaSupport, - cudaCapabilities ? cudaPackages.cudaFlags.cudaCapabilities, - cudaPackages -}: - -assert cudaSupport -> cudaPackages != { }; - -let - boost_static = boost.override { enableStatic = true; }; - stdenv' = if cudaSupport then cudaPackages.backendStdenv else stdenv; - - # TODO: migrate to redist packages - inherit (cudaPackages) cudatoolkit; -in -stdenv'.mkDerivation rec { - version = "3.9.1"; - pname = "colmap"; - src = fetchFromGitHub { - owner = "colmap"; - repo = "colmap"; - rev = version; - hash = "sha256-Xb4JOttCMERwPYs5DyGKHw+f9Wik1/rdJQKbgVuygH8="; - }; - - cmakeFlags = lib.optionals cudaSupport [ - (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 - ]; - - meta = with lib; { - description = "COLMAP - Structure-From-Motion and Multi-View Stereo pipeline"; - longDescription = '' - COLMAP is a general-purpose Structure-from-Motion (SfM) and Multi-View Stereo (MVS) pipeline - with a graphical and command-line interface. - ''; - homepage = "https://colmap.github.io/index.html"; - license = licenses.bsd3; - platforms = platforms.linux; - maintainers = with maintainers; [ lebastr ]; - }; -} diff --git a/pkgs/by-name/co/colmap/0001-lib-PoissonRecon-fix-build-with-clang-19.patch b/pkgs/by-name/co/colmap/0001-lib-PoissonRecon-fix-build-with-clang-19.patch new file mode 100644 index 0000000000000..cd12547ab82fa --- /dev/null +++ b/pkgs/by-name/co/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/by-name/co/colmap/package.nix b/pkgs/by-name/co/colmap/package.nix new file mode 100644 index 0000000000000..ba975fb6dc000 --- /dev/null +++ b/pkgs/by-name/co/colmap/package.nix @@ -0,0 +1,116 @@ +{ + lib, + fetchFromGitHub, + fetchpatch, + gitUpdater, + cmake, + boost, + ceres-solver, + eigen, + freeimage, + glog, + libGLU, + glew, + flann, + cgal, + gmp, + mpfr, + poselib, + lz4, + autoAddDriverRunpath, + config, + stdenv, + qt5, + xorg, + cudaSupport ? config.cudaSupport, + cudaCapabilities ? cudaPackages.cudaFlags.cudaCapabilities, + cudaPackages, +}: + +assert cudaSupport -> cudaPackages != { }; + +let + boost_static = boost.override { enableStatic = true; }; + stdenv' = if cudaSupport then cudaPackages.backendStdenv else stdenv; + + # TODO: migrate to redist packages + inherit (cudaPackages) cudatoolkit; +in +stdenv'.mkDerivation rec { + version = "3.11.1"; + pname = "colmap"; + src = fetchFromGitHub { + owner = "colmap"; + repo = "colmap"; + rev = version; + hash = "sha256-xtA0lEAq38/AHI3C9FhvjV5JPfVawrFr1fga4J1pi/0="; + }; + + patches = [ + ./0001-lib-PoissonRecon-fix-build-with-clang-19.patch + ]; + + 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.dropDot cudaCapabilities) + )) + ]; + + buildInputs = + [ + boost_static + ceres-solver + eigen + freeimage + glog + libGLU + glew + qt5.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 = "COLMAP - Structure-From-Motion and Multi-View Stereo pipeline"; + longDescription = '' + 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.unix; + maintainers = with maintainers; [ + lebastr + usertam + ]; + }; +} diff --git a/pkgs/by-name/po/poselib/package.nix b/pkgs/by-name/po/poselib/package.nix new file mode 100644 index 0000000000000..8d1a578ebd7b9 --- /dev/null +++ b/pkgs/by-name/po/poselib/package.nix @@ -0,0 +1,42 @@ +{ + lib, + stdenv, + fetchFromGitHub, + gitUpdater, + cmake, + eigen, + pkg-config, +}: + +stdenv.mkDerivation (final: { + pname = "poselib"; + version = "2.0.4"; + + src = fetchFromGitHub { + owner = "PoseLib"; + repo = "PoseLib"; + rev = "v${final.version}"; + hash = "sha256-5cd0k53kqggJCzz3ajPcUeBIi5KuvBUG7SQKsHBWIdU="; + }; + + buildInputs = [ eigen ]; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + enableParallelBuilding = true; + enableParallelInstalling = true; + + passthru.updateScript = gitUpdater { rev-prefix = "v"; }; + + meta = with lib; { + description = "A collection of minimal solvers for camera pose estimation"; + homepage = "https://github.com/PoseLib/PoseLib"; + changelog = "https://github.com/PoseLib/PoseLib/releases/tag/v${final.version}"; + license = licenses.bsd3; + platforms = platforms.unix; + maintainers = with maintainers; [ usertam ]; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6eb5d80b1b0cb..f77d7a718a658 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5577,7 +5577,6 @@ with pkgs; inherit (llvmPackages) lld stdenv; }; - colmap = libsForQt5.callPackage ../applications/science/misc/colmap { inherit (config) cudaSupport; }; colmapWithCuda = colmap.override { cudaSupport = true; }; opensplatWithCuda = opensplat.override { cudaSupport = true; };