1{ stdenv
2, eigen
3, fetchurl
4, cmake
5, google-gflags ? null
6, glog
7, runTests ? false
8}:
9
10# google-gflags is required to run tests
11assert runTests -> google-gflags != null;
12
13stdenv.mkDerivation rec {
14 name = "ceres-solver-${version}";
15 version = "1.12.0";
16
17 src = fetchurl {
18 url = "http://ceres-solver.org/ceres-solver-${version}.tar.gz";
19 sha256 = "15f8mwhcy9f5qggcc9dqwl5y687ykvmlidr686aqdq0ia7azwnvl";
20 };
21
22 nativeBuildInputs = [ cmake ];
23 buildInputs = [ glog ]
24 ++ stdenv.lib.optional (google-gflags != null) google-gflags;
25
26 inherit eigen;
27
28 doCheck = runTests;
29
30 checkTarget = "test";
31
32 cmakeFlags = "
33 -DEIGEN_INCLUDE_DIR=${eigen}/include/eigen3
34 ";
35
36 meta = with stdenv.lib; {
37 description = "C++ library for modeling and solving large, complicated optimization problems";
38 license = licenses.bsd3;
39 homepage = http://ceres-solver.org;
40 maintainers = with maintainers; [ giogadi ];
41 platforms = platforms.unix;
42 };
43}