On 2019/12/25 00:02, Kristaps Dzonsons wrote:
> ceres-solver is a lightweight C++ template library for linear algebra.
> 
> It can use either openmp (which I don't think is supported?), tbb, or
> c++11 threads.  I go with c++11 because it seems best supported across
> all architectures, though tbb works as tested.  Only tested on amd64.
> `make test` sometimes fails as noted.  Also installs docs.
> 
> This is a requirement for alicevision (upcoming).

Here's a diff that enables the shared library (port Makefile already had
SHARED_LIBS but it was only building the static one), and fixes some
problems - build changing depending on whether tbb was installed which
will cause problems in bulk builds, BUILD+RUN vs LIB_DEPENDS+WANTLIB,
dep on the wrong sphinx (see the comment at the top of textproc/sphinx
Makefile), don't add a runtime dep on Python if it's only needed for
the build.


diff c9e7b0bbef531a18643f6446519edc195c72deb7 /usr/ports/mystuff
blob - 0b7b23d3f22038b0519320f1d3f7d1abb8e21af7
file + math/ceres-solver/Makefile
--- math/ceres-solver/Makefile
+++ math/ceres-solver/Makefile
@@ -1,51 +1,49 @@
 # $OpenBSD: Makefile,v 1.10 2019/07/17 14:46:33 danj Exp $
 
 COMMENT =              lightweight C++ template library for linear algebra
-VERSION =              1.14.0
-DISTNAME =             ceres-solver-${VERSION}
+DISTNAME =             ceres-solver-1.14.0
 
 CATEGORIES =           math
 
-HOMEPAGE =             http://ceres-solver.org
+HOMEPAGE =             http://ceres-solver.org/
 
 SHARED_LIBS +=         ceres                   0.0 # 1.14
 
-# New BSD license
+# BSD
 PERMIT_PACKAGE =       Yes
 
 MASTER_SITES =         http://ceres-solver.org/
 
-# c++11
+WANTLIB += ${COMPILER_LIBCXX} amd blas camd ccolamd cholmod colamd
+WANTLIB += cxsparse gflags glog lapack m spqr suitesparseconfig
+
+# C++11
 COMPILER =             base-clang ports-gcc ports-clang
 
 # We can also pull in TBB, but C++ threads are better supported.
-
-BUILD_DEPENDS =                devel/gflags \
+LIB_DEPENDS =          devel/gflags \
                        devel/glog \
                        math/blas \
                        math/eigen3 \
                        math/lapack \
-                       math/suitesparse \
-                       textproc/sphinx
+                       math/suitesparse
 
-# Python is for generating the documentation.
+BUILD_DEPENDS =                textproc/py-sphinx
 
 MODULES =              devel/cmake \
                        lang/python
+MODPY_RUNDEP =         No
 
-# If this reports "assuming suitesparse is compiled with TBB" (when it's
-# not), it's harmless.
-
 CONFIGURE_ARGS =       -DOPENMP=OFF \
                        -DCXX11=ON \
                        -DCXX11_THREADS=ON \
                        -DBUILD_EXAMPLES=OFF \
                        -DBUILD_DOCUMENTATION=ON \
+                       -DBUILD_SHARED_LIBS=ON \
                        -DPYTHON_EXECUTABLE="${MODPY_BIN}"
 
 # Sometimes tests fail because tolerances doesn't pass muster.
 # I can only guess that this is due to aberrations in FP?
-
 TEST_TARGET =          test
 
 .include <bsd.port.mk>
blob - /dev/null
file + math/ceres-solver/patches/patch-cmake_FindSuiteSparse_cmake
--- math/ceres-solver/patches/patch-cmake_FindSuiteSparse_cmake
+++ math/ceres-solver/patches/patch-cmake_FindSuiteSparse_cmake
@@ -0,0 +1,18 @@
+$OpenBSD$
+
+If tbb is present while running ceres' configure stage, ceres assumes that
+suitesparse was linked with tbb and therefore the ceres library should also
+be linked with tbb. Prevent picking up tbb to disable this.
+
+Index: cmake/FindSuiteSparse.cmake
+--- cmake/FindSuiteSparse.cmake.orig
++++ cmake/FindSuiteSparse.cmake
+@@ -287,7 +287,7 @@ suitesparse_find_component(CCOLAMD REQUIRED FILES ccol
+ suitesparse_find_component(CHOLMOD REQUIRED FILES cholmod.h LIBRARIES cholmod)
+ suitesparse_find_component(
+   SUITESPARSEQR REQUIRED FILES SuiteSparseQR.hpp LIBRARIES spqr)
+-if (SUITESPARSEQR_FOUND)
++if (0 AND SUITESPARSEQR_FOUND)
+   # SuiteSparseQR may be compiled with Intel Threading Building Blocks,
+   # we assume that if TBB is installed, SuiteSparseQR was compiled with
+   # support for it, this will do no harm if it wasn't.
blob - 654c9431a19ac1e53373a71629aaf63e6cb29918
file + math/ceres-solver/pkg/PLIST
--- math/ceres-solver/pkg/PLIST
+++ math/ceres-solver/pkg/PLIST
@@ -50,7 +50,6 @@ include/ceres/tiny_solver_autodiff_function.h
 include/ceres/tiny_solver_cost_function_adapter.h
 include/ceres/types.h
 include/ceres/version.h
-lib/cmake/
 lib/cmake/Ceres/
 lib/cmake/Ceres/CeresConfig.cmake
 lib/cmake/Ceres/CeresConfigVersion.cmake
@@ -59,7 +58,7 @@ lib/cmake/Ceres/CeresTargets.cmake
 lib/cmake/Ceres/FindEigen.cmake
 lib/cmake/Ceres/FindGflags.cmake
 lib/cmake/Ceres/FindGlog.cmake
-lib/libceres.a
+@lib lib/libceres.so.${LIBceres_VERSION}
 share/doc/ceres/
 share/doc/ceres/html/
 share/doc/ceres/html/.buildinfo

Reply via email to