Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 96 lines 2.3 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 pkg-config, 6 cmake, 7 cereal, 8 ceres-solver, 9 clp, 10 coin-utils, 11 eigen, 12 lemon-graph, 13 libjpeg, 14 libpng, 15 libtiff, 16 nix-update-script, 17 openmp, 18 osi, 19 zlib, 20 enableShared ? !stdenv.hostPlatform.isStatic, 21 enableExamples ? false, 22 enableDocs ? false, 23}: 24 25stdenv.mkDerivation rec { 26 version = "2.1"; 27 pname = "openmvg"; 28 29 src = fetchFromGitHub { 30 owner = "openmvg"; 31 repo = "openmvg"; 32 rev = "v${version}"; 33 hash = "sha256-vG+tW9Gl/DAUL8DeY+rJVDJH/oMPH3XyZMUgzjtwFv0="; 34 }; 35 36 # Pretend we checked out the dependency submodules 37 postPatch = '' 38 mkdir src/dependencies/cereal/include 39 ''; 40 41 buildInputs = [ 42 cereal 43 ceres-solver 44 clp 45 coin-utils 46 eigen 47 lemon-graph 48 libjpeg 49 libpng 50 libtiff 51 openmp 52 osi 53 zlib 54 ]; 55 56 nativeBuildInputs = [ 57 cmake 58 pkg-config 59 ]; 60 61 # flann is missing because the lz4 dependency isn't propagated: https://github.com/openMVG/openMVG/issues/1265 62 cmakeFlags = [ 63 "-DOpenMVG_BUILD_EXAMPLES=${if enableExamples then "ON" else "OFF"}" 64 "-DOpenMVG_BUILD_DOC=${if enableDocs then "ON" else "OFF"}" 65 "-DTARGET_ARCHITECTURE=generic" 66 "-DCLP_INCLUDE_DIR_HINTS=${lib.getDev clp}/include" 67 "-DCOINUTILS_INCLUDE_DIR_HINTS=${lib.getDev coin-utils}/include" 68 "-DLEMON_INCLUDE_DIR_HINTS=${lib.getDev lemon-graph}/include" 69 "-DOSI_INCLUDE_DIR_HINTS=${lib.getDev osi}/include" 70 ] 71 ++ lib.optional enableShared "-DOpenMVG_BUILD_SHARED=ON"; 72 73 cmakeDir = "./src"; 74 75 dontUseCmakeBuildDir = true; 76 77 # This can be enabled, but it will exhause virtual memory on most machines. 78 enableParallelBuilding = false; 79 80 # Without hardeningDisable, certain flags are passed to the compile that break the build (primarily string format errors) 81 hardeningDisable = [ "all" ]; 82 83 passthru.updateScript = nix-update-script { }; 84 85 meta = { 86 broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64; 87 description = "Library for computer-vision scientists and targeted for the Multiple View Geometry community"; 88 homepage = "https://openmvg.readthedocs.io/en/latest/"; 89 license = lib.licenses.mpl20; 90 platforms = lib.platforms.unix; 91 maintainers = with lib.maintainers; [ 92 mdaiter 93 bouk 94 ]; 95 }; 96}