aboutsummaryrefslogtreecommitdiffstats
path: root/math/ceres-solver/Makefile
blob: 067d1fc3847fd7a9bb7168e6c7550a6055f2dd53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# $FreeBSD$

PORTNAME=   ceres-solver
DISTVERSION=    1.14.0
PORTREVISION=   7
CATEGORIES= math

MAINTAINER= jbeich@FreeBSD.org
COMMENT=    Nonlinear least squares minimizer

LICENSE=    BSD3CLAUSE
LICENSE_FILE=   ${WRKSRC}/LICENSE

LIB_DEPENDS=    libglog.so:devel/glog
RUN_DEPENDS:=   ${BUILD_DEPENDS:Meigen*}

USES=       cmake:outsource compiler:${OPENMP}c++11-lib eigen:3 localbase shebangfix
USE_GITHUB= yes
USE_LDCONFIG=   yes
SHEBANG_FILES=  examples/slam/pose_graph_*/plot_results.py \
        scripts/make_docs.py
CMAKE_ON=   CXX11 BUILD_SHARED_LIBS
CMAKE_OFF=  BUILD_BENCHMARKS
LDFLAGS+=   -Wl,--as-needed # -lccolamd -lcholmod -lrt from suitesparse
PLIST_SUB=  VERSION=${DISTVERSION:C/rc.*//}
EXAMPLESDIR=    ${PREFIX}/share/examples/${PORTNAME:S/-solver//}
DOCSDIR=    ${PREFIX}/share/doc/${PORTNAME:S/-solver//}
PORTDOCS=   *
PORTEXAMPLES=   *

OPTIONS_DEFINE= CUSTOM_BLAS EXAMPLES DOCS GFLAGS LAPACK SCHUR TEST
OPTIONS_DEFAULT=CUSTOM_BLAS CXSPARSE OPENBLAS OPENMP SCHUR SUITESPARSE
OPTIONS_RADIO=  LAPACK THREADS
OPTIONS_RADIO_LAPACK=   ATLAS GOTOBLAS NETLIB OPENBLAS
OPTIONS_RADIO_THREADS=  OPENMP TBB
OPTIONS_GROUP=  SPARSE
OPTIONS_GROUP_SPARSE=   CXSPARSE EIGENSPARSE SUITESPARSE

CUSTOM_BLAS_DESC=   Handcoded BLAS routines instead of Eigen
CUSTOM_BLAS_CMAKE_BOOL= CUSTOM_BLAS

DOCS_BUILD_DEPENDS= sphinx-build:textproc/py-sphinx
DOCS_USES=      python:2.7,build
DOCS_CMAKE_BOOL=    BUILD_DOCUMENTATION

EXAMPLES_CMAKE_BOOL=    BUILD_EXAMPLES
EXAMPLES_IMPLIES=   GFLAGS

GFLAGS_DESC=        Google Flags support
GFLAGS_LIB_DEPENDS= libgflags.so:devel/gflags
GFLAGS_CMAKE_BOOL=  GFLAGS

OPENMP_USES=        compiler:openmp
OPENMP_CMAKE_BOOL=  OPENMP
# XXX ports/199603 + ports/210337
OPENMP_VARS=        OPENMP=gcc-

SCHUR_DESC=     Fixed-size schur specializations
SCHUR_CMAKE_BOOL=   SCHUR_SPECIALIZATIONS

TBB_DESC=       Intel threading building blocks
TBB_LIB_DEPENDS=    libtbb.so:devel/tbb
TBB_CMAKE_BOOL=     TBB

# XXX Unbundle googletest/googlemock
TEST_CMAKE_BOOL=    BUILD_TESTING
TEST_TEST_TARGET=   test ARGS="-V"
TEST_IMPLIES=       GFLAGS

LAPACK_DESC=        Linear Algebra PACKage
LAPACK_USES=        fortran # LDFLAGS
LAPACK_CMAKE_BOOL=  LAPACK
LAPACK_CMAKE_ON=    -DCMAKE_POLICY_DEFAULT_CMP0056:STRING=NEW # USES=fortran
# Avoid conflict with Ceres threading by using single-threaded BLAS library.
# BLASLIB from USES=blaslapack cannot be used as it's multi-threaded.
# https://github.com/xianyi/OpenBLAS/wiki/faq#multi-threaded
ATLAS_USES=     blaslapack:atlas
ATLAS_CMAKE_ON=     -DBLA_VENDOR:STRING="ATLAS" \
            -DBLAS_LIBRARIES:FILEPATH="${LOCALBASE}/lib/libcblas.so" \
            -DLAPACK_LIBRARIES:FILEPATH="${LOCALBASE}/lib/libalapack.so"
ATLAS_IMPLIES=      LAPACK
GOTOBLAS_DESC=      Goto blas implementation
GOTOBLAS_USES=      blaslapack:gotoblas
GOTOBLAS_CMAKE_ON=  -DBLA_VENDOR:STRING="Goto"
GOTOBLAS_IMPLIES=   LAPACK
NETLIB_USES=        blaslapack:netlib
NETLIB_CMAKE_ON=    -DBLA_VENDOR:STRING="Generic"
NETLIB_IMPLIES=     LAPACK
OPENBLAS_USES=      blaslapack:openblas
OPENBLAS_CMAKE_ON=  -DBLA_VENDOR:STRING="OpenBLAS"
OPENBLAS_IMPLIES=   LAPACK

SPARSE_DESC=        Sparse linear algebra library
CXSPARSE_DESC=      CXSparse support
CXSPARSE_LIB_DEPENDS=   libcxsparse.so:math/suitesparse
CXSPARSE_CMAKE_ON=  -DCXSPARSE_INCLUDE_DIR:PATH="${LOCALBASE}/include/suitesparse"
CXSPARSE_CMAKE_BOOL=    CXSPARSE
EIGENSPARSE_DESC=   Simplicial Cholesky factorization in Eigen
EIGENSPARSE_CMAKE_BOOL= EIGENSPARSE
EIGENSPARSE_VARS=   LICENSE+=LGPL21+ LICENSE_COMB=multi \
            LICENSE_FILE_BSD3CLAUSE="${LICENSE_FILE}"
SUITESPARSE_DESC=   SuiteSparse support
SUITESPARSE_LIB_DEPENDS=libspqr.so:math/suitesparse
SUITESPARSE_CMAKE_BOOL= SUITESPARSE

post-patch-DOCS-on:
    @${REINPLACE_CMD} -e 's,python,${PYTHON_CMD:T},' \
        ${WRKSRC}/docs/source/CMakeLists.txt

pre-install-TEST-on: do-test

post-install-EXAMPLES-on:
# Copy examples (stripped), their source and sample data but not tests programs
    (cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR})
    (cd ${WRKSRC} && ${COPYTREE_SHARE} data ${STAGEDIR}${EXAMPLESDIR})
    (cd ${BUILD_WRKSRC} && ${COPYTREE_SHARE} bin ${STAGEDIR}${EXAMPLESDIR})
    @${RM} -r ${STAGEDIR}${EXAMPLESDIR}/bin/*_test
    -@${STRIP_CMD} ${STAGEDIR}${EXAMPLESDIR}/bin/* # may fail for non-root

.include <bsd.port.mk>