at 24.11-pre 2.6 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 fetchpatch, 7 cmake, 8 opencv4, 9 ceres-solver, 10 suitesparse, 11 metis, 12 eigen, 13 pkg-config, 14 pybind11, 15 numpy, 16 pyyaml, 17 lapack, 18 gtest, 19 gflags, 20 glog, 21 pytestCheckHook, 22 networkx, 23 pillow, 24 exifread, 25 gpxpy, 26 pyproj, 27 python-dateutil, 28 joblib, 29 repoze-lru, 30 xmltodict, 31 cloudpickle, 32 scipy, 33 sphinx, 34 matplotlib, 35 fpdf, 36}: 37 38let 39 ceresSplit = (builtins.length ceres-solver.outputs) > 1; 40 ceres' = if ceresSplit then ceres-solver.dev else ceres-solver; 41in 42buildPythonPackage rec { 43 pname = "opensfm"; 44 version = "unstable-2023-12-09"; 45 46 src = fetchFromGitHub { 47 owner = "mapillary"; 48 repo = "OpenSfM"; 49 rev = "7f170d0dc352340295ff480378e3ac37d0179f8e"; 50 sha256 = "sha256-l/HTVenC+L+GpMNnDgnSGZ7+Qd2j8b8cuTs3SmORqrg="; 51 }; 52 patches = [ 53 ./0002-cmake-find-system-distributed-gtest.patch 54 ./0003-cmake-use-system-pybind11.patch 55 ./0004-pybind_utils.h-conflicts-with-nixpkgs-pybind.patch 56 ./fix-scripts.patch 57 ]; 58 postPatch = '' 59 rm opensfm/src/cmake/FindGlog.cmake 60 rm opensfm/src/cmake/FindGflags.cmake 61 62 # HAHOG is the default descriptor. 63 # We'll test both HAHOG and SIFT because this is 64 # where segfaults might be introduced in future 65 echo 'feature_type: SIFT' >> data/berlin/config.yaml 66 echo 'feature_type: HAHOG' >> data/lund/config.yaml 67 68 sed -i -e 's/^.*BuildDoc.*$//' setup.py 69 ''; 70 71 nativeBuildInputs = [ 72 cmake 73 pkg-config 74 sphinx 75 ]; 76 buildInputs = [ 77 ceres' 78 suitesparse 79 metis 80 eigen 81 lapack 82 gflags 83 gtest 84 glog 85 pybind11 86 ]; 87 propagatedBuildInputs = [ 88 numpy 89 scipy 90 pyyaml 91 opencv4.cxxdev 92 networkx 93 pillow 94 matplotlib 95 fpdf 96 exifread 97 gpxpy 98 pyproj 99 python-dateutil 100 joblib 101 repoze-lru 102 xmltodict 103 cloudpickle 104 ]; 105 nativeCheckInputs = [ pytestCheckHook ]; 106 107 dontUseCmakeBuildDir = true; 108 cmakeFlags = [ 109 "-Bcmake_build" 110 "-Sopensfm/src" 111 ]; 112 113 disabledTests = 114 [ 115 "test_run_all" # Matplotlib issues. Broken integration is less useless than a broken build 116 ] 117 ++ lib.optionals stdenv.isDarwin [ 118 "test_reconstruction_incremental" 119 "test_reconstruction_triangulation" 120 ]; 121 122 pythonImportsCheck = [ "opensfm" ]; 123 124 meta = { 125 broken = stdenv.isDarwin; 126 maintainers = [ lib.maintainers.SomeoneSerge ]; 127 license = lib.licenses.bsd2; 128 changelog = "https://github.com/mapillary/OpenSfM/blob/${src.rev}/CHANGELOG.md"; 129 description = "Open source Structure-from-Motion pipeline from Mapillary"; 130 homepage = "https://opensfm.org/"; 131 }; 132}