Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 blas, 6 cmake, 7 eigen, 8 gflags, 9 glog, 10 suitesparse, 11 metis, 12 runTests ? false, 13 enableStatic ? stdenv.hostPlatform.isStatic, 14 withBlas ? true, 15}: 16 17# gflags is required to run tests 18assert runTests -> gflags != null; 19 20stdenv.mkDerivation rec { 21 pname = "ceres-solver"; 22 version = "2.1.0"; 23 24 src = fetchurl { 25 url = "http://ceres-solver.org/ceres-solver-${version}.tar.gz"; 26 sha256 = "sha256-99dO7N4K7XW/xR7EjJHQH+Fqa/FrzhmHpwcyhnAeL8Y="; 27 }; 28 29 outputs = [ 30 "out" 31 "dev" 32 ]; 33 34 nativeBuildInputs = [ cmake ]; 35 buildInputs = lib.optional runTests gflags; 36 propagatedBuildInputs = [ 37 eigen 38 glog 39 ] 40 ++ lib.optionals withBlas [ 41 blas 42 suitesparse 43 metis 44 ]; 45 46 cmakeFlags = [ 47 "-DBUILD_SHARED_LIBS=${if enableStatic then "OFF" else "ON"}" 48 ]; 49 50 # The Basel BUILD file conflicts with the cmake build directory on 51 # case-insensitive filesystems, eg. darwin. 52 preConfigure = '' 53 rm BUILD 54 ''; 55 56 doCheck = runTests; 57 58 checkTarget = "test"; 59 60 meta = with lib; { 61 description = "C++ library for modeling and solving large, complicated optimization problems"; 62 license = licenses.bsd3; 63 homepage = "http://ceres-solver.org"; 64 maintainers = with maintainers; [ giogadi ]; 65 platforms = platforms.unix; 66 }; 67}