git: fba2b5272b6f - main - graphics/openmvs: New port: Open Multi-View Stereo reconstruction library

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 12 Jul 2022 22:14:22 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fba2b5272b6fd4e65010021747049375f7a8eb4d

commit fba2b5272b6fd4e65010021747049375f7a8eb4d
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-07-12 22:13:38 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-07-12 22:13:38 +0000

    graphics/openmvs: New port: Open Multi-View Stereo reconstruction library
---
 graphics/Makefile                                  |   1 +
 graphics/openmvs/Makefile                          |  33 +++++++
 graphics/openmvs/distinfo                          |   3 +
 graphics/openmvs/files/patch-build_Utils.cmake     |  10 ++
 .../files/patch-libs_Common_CriticalSection.h      |  20 ++++
 graphics/openmvs/files/patch-libs_Common_Types.h   |  21 +++++
 graphics/openmvs/pkg-descr                         |   5 +
 graphics/openmvs/pkg-plist                         | 103 +++++++++++++++++++++
 8 files changed, 196 insertions(+)

diff --git a/graphics/Makefile b/graphics/Makefile
index eb70a6022298..be7c0819418e 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -605,6 +605,7 @@
     SUBDIR += openjpeg15
     SUBDIR += openjph
     SUBDIR += openjump
+    SUBDIR += openmvs
     SUBDIR += opennurbs
     SUBDIR += openorienteering-mapper
     SUBDIR += openrm
diff --git a/graphics/openmvs/Makefile b/graphics/openmvs/Makefile
new file mode 100644
index 000000000000..5d385b8ecdc0
--- /dev/null
+++ b/graphics/openmvs/Makefile
@@ -0,0 +1,33 @@
+PORTNAME=	openmvs
+DISTVERSIONPREFIX=	v
+DISTVERSION=	2.0.1
+CATEGORIES=	graphics
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Open Multi-View Stereo reconstruction library
+
+LICENSE=	AGPLv3
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	cgal>0:math/cgal \
+		${LOCALBASE}/include/sys/sysinfo.h:devel/libsysinfo \
+		vcglib>0:devel/vcglib
+LIB_DEPENDS=	libboost_system.so:devel/boost-libs \
+		libceres.so:math/ceres-solver \
+		libgmp.so:math/gmp \
+		libmpfr.so:math/mpfr \
+		libopencv_core.so:graphics/opencv \
+		libpng16.so:graphics/png \
+		libtiff.so:graphics/tiff
+
+USES=		cmake compiler:c++17-lang eigen:3 jpeg
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	cdcseacave
+GH_PROJECT=	openMVS
+
+CMAKE_ON=	BUILD_SHARED_LIBS OpenMVS_USE_CERES
+CMAKE_OFF=	OpenMVS_BUILD_TOOLS # tools can't be built because of https://github.com/cdcseacave/openMVS/issues/846
+CMAKE_ARGS=	-DVCG_ROOT=${LOCALBASE}/include/vcglib
+
+.include <bsd.port.mk>
diff --git a/graphics/openmvs/distinfo b/graphics/openmvs/distinfo
new file mode 100644
index 000000000000..f1cd535257a8
--- /dev/null
+++ b/graphics/openmvs/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1657645144
+SHA256 (cdcseacave-openMVS-v2.0.1_GH0.tar.gz) = 0dcbf4e0c2f797cf74e72ca4f853d27e86dc3cce64b6764b6daf93025caceaea
+SIZE (cdcseacave-openMVS-v2.0.1_GH0.tar.gz) = 813850
diff --git a/graphics/openmvs/files/patch-build_Utils.cmake b/graphics/openmvs/files/patch-build_Utils.cmake
new file mode 100644
index 000000000000..436115176d97
--- /dev/null
+++ b/graphics/openmvs/files/patch-build_Utils.cmake
@@ -0,0 +1,10 @@
+--- build/Utils.cmake.orig	2022-04-17 08:46:34 UTC
++++ build/Utils.cmake
+@@ -433,6 +433,7 @@ macro(optimize_default_compiler_settings)
+ 			endif()
+ 		endif()
+ 	endif()
++	set(CMAKE_CXX_STANDARD 14)
+ 	if(CLANG AND (CMAKE_CXX_STANDARD EQUAL 11 OR CMAKE_CXX_STANDARD EQUAL 14 OR CMAKE_CXX_STANDARD EQUAL 17))
+ 		set(CMAKE_EXE_LINKER_FLAGS "-stdlib=libc++")
+ 		add_extra_compiler_option(-stdlib=libc++)
diff --git a/graphics/openmvs/files/patch-libs_Common_CriticalSection.h b/graphics/openmvs/files/patch-libs_Common_CriticalSection.h
new file mode 100644
index 000000000000..7229dbff5014
--- /dev/null
+++ b/graphics/openmvs/files/patch-libs_Common_CriticalSection.h
@@ -0,0 +1,20 @@
+--- libs/Common/CriticalSection.h.orig	2022-07-12 17:18:30 UTC
++++ libs/Common/CriticalSection.h
+@@ -53,7 +53,7 @@ class CriticalSection   (protected)
+ 
+ public:
+ 	CriticalSection() {
+-		#ifdef __APPLE__
++		#if defined(__APPLE__) || defined(__FreeBSD__)
+ 		pthread_mutex_init(&mtx, NULL);
+ 		#else
+ 		mtx = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+@@ -62,7 +62,7 @@ class CriticalSection   (protected)
+ 	~CriticalSection() { pthread_mutex_destroy(&mtx); }
+ 	void Clear() {
+ 		pthread_mutex_destroy(&mtx);
+-		#ifdef __APPLE__
++		#if defined(__APPLE__) || defined(__FreeBSD__)
+ 		pthread_mutex_init(&mtx, NULL);
+ 		#else
+ 		mtx = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
diff --git a/graphics/openmvs/files/patch-libs_Common_Types.h b/graphics/openmvs/files/patch-libs_Common_Types.h
new file mode 100644
index 000000000000..067cd91b812f
--- /dev/null
+++ b/graphics/openmvs/files/patch-libs_Common_Types.h
@@ -0,0 +1,21 @@
+--- libs/Common/Types.h.orig	2022-04-17 08:46:34 UTC
++++ libs/Common/Types.h
+@@ -201,6 +201,9 @@ namespace cv { namespace gpu = cuda; }
+ # elif defined(__APPLE__)
+ #  include <pthread.h>
+ inline pid_t GetCurrentThreadId() { uint64_t tid64; pthread_threadid_np(NULL, &tid64); return (pid_t)tid64; }
++# elif defined(__FreeBSD__)
++#  include <pthread.h>
++inline pid_t GetCurrentThreadId() { uint64_t tid64 = (uint64_t)pthread_self(); return (pid_t)tid64; }
+ #  define __THREAD__ ((unsigned)GetCurrentThreadId())
+ # else
+ #  include <sys/syscall.h>
+@@ -373,6 +376,8 @@ typedef TAliasCast<double,int32_t> CastD2I;
+ # define __BYTE_ORDER __LITTLE_ENDIAN
+ #elif defined(__APPLE__)
+ # include <machine/endian.h>
++#elif defined(__FreeBSD__)
++# include <sys/endian.h>
+ #elif defined(__GNUC__)
+ # include <endian.h>
+ #endif
diff --git a/graphics/openmvs/pkg-descr b/graphics/openmvs/pkg-descr
new file mode 100644
index 000000000000..597e020f1ffe
--- /dev/null
+++ b/graphics/openmvs/pkg-descr
@@ -0,0 +1,5 @@
+OpenMVS (Multi-View Stereo) is a library for computer-vision
+scientists and especially targeted to the Multi-View Stereo
+reconstruction community.
+
+WWW: https://github.com/cdcseacave/openMVS
diff --git a/graphics/openmvs/pkg-plist b/graphics/openmvs/pkg-plist
new file mode 100644
index 000000000000..90e4d9df28e8
--- /dev/null
+++ b/graphics/openmvs/pkg-plist
@@ -0,0 +1,103 @@
+include/OpenMVS/Common/AABB.h
+include/OpenMVS/Common/AABB.inl
+include/OpenMVS/Common/AutoEstimator.h
+include/OpenMVS/Common/AutoPtr.h
+include/OpenMVS/Common/Common.h
+include/OpenMVS/Common/Config.h
+include/OpenMVS/Common/ConfigTable.h
+include/OpenMVS/Common/CriticalSection.h
+include/OpenMVS/Common/EventQueue.h
+include/OpenMVS/Common/FastDelegate.h
+include/OpenMVS/Common/FastDelegateBind.h
+include/OpenMVS/Common/FastDelegateCPP11.h
+include/OpenMVS/Common/File.h
+include/OpenMVS/Common/Filters.h
+include/OpenMVS/Common/HTMLDoc.h
+include/OpenMVS/Common/HalfFloat.h
+include/OpenMVS/Common/Hash.h
+include/OpenMVS/Common/LinkLib.h
+include/OpenMVS/Common/List.h
+include/OpenMVS/Common/Log.h
+include/OpenMVS/Common/MemFile.h
+include/OpenMVS/Common/OBB.h
+include/OpenMVS/Common/OBB.inl
+include/OpenMVS/Common/Octree.h
+include/OpenMVS/Common/Octree.inl
+include/OpenMVS/Common/Plane.h
+include/OpenMVS/Common/Plane.inl
+include/OpenMVS/Common/Queue.h
+include/OpenMVS/Common/Random.h
+include/OpenMVS/Common/Ray.h
+include/OpenMVS/Common/Ray.inl
+include/OpenMVS/Common/Rotation.h
+include/OpenMVS/Common/Rotation.inl
+include/OpenMVS/Common/SML.h
+include/OpenMVS/Common/Sampler.inl
+include/OpenMVS/Common/Semaphore.h
+include/OpenMVS/Common/SharedPtr.h
+include/OpenMVS/Common/Sphere.h
+include/OpenMVS/Common/Sphere.inl
+include/OpenMVS/Common/Streams.h
+include/OpenMVS/Common/Strings.h
+include/OpenMVS/Common/Thread.h
+include/OpenMVS/Common/Timer.h
+include/OpenMVS/Common/Types.h
+include/OpenMVS/Common/Types.inl
+include/OpenMVS/Common/Util.h
+include/OpenMVS/Common/Util.inl
+include/OpenMVS/Common/UtilCUDA.h
+include/OpenMVS/ConfigLocal.h
+include/OpenMVS/IO/Common.h
+include/OpenMVS/IO/Image.h
+include/OpenMVS/IO/ImageBMP.h
+include/OpenMVS/IO/ImageDDS.h
+include/OpenMVS/IO/ImageJPG.h
+include/OpenMVS/IO/ImagePNG.h
+include/OpenMVS/IO/ImageSCI.h
+include/OpenMVS/IO/ImageTGA.h
+include/OpenMVS/IO/ImageTIFF.h
+include/OpenMVS/IO/OBJ.h
+include/OpenMVS/IO/PLY.h
+include/OpenMVS/IO/TinyXML2.h
+include/OpenMVS/IO/tiny_gltf.h
+include/OpenMVS/MVS.h
+include/OpenMVS/MVS/Camera.h
+include/OpenMVS/MVS/Common.h
+include/OpenMVS/MVS/DepthMap.h
+include/OpenMVS/MVS/Image.h
+include/OpenMVS/MVS/Interface.h
+include/OpenMVS/MVS/Mesh.h
+include/OpenMVS/MVS/PatchMatchCUDA.h
+include/OpenMVS/MVS/PatchMatchCUDA.inl
+include/OpenMVS/MVS/Platform.h
+include/OpenMVS/MVS/PointCloud.h
+include/OpenMVS/MVS/RectsBinPack.h
+include/OpenMVS/MVS/Scene.h
+include/OpenMVS/MVS/SceneDensify.h
+include/OpenMVS/MVS/SemiGlobalMatcher.h
+include/OpenMVS/Math/Common.h
+include/OpenMVS/Math/IBFS/IBFS.h
+include/OpenMVS/Math/LBP.h
+include/OpenMVS/Math/LMFit/lmmin.h
+include/OpenMVS/Math/TRWS/MRFEnergy.h
+include/OpenMVS/Math/TRWS/MRFEnergy.inl
+include/OpenMVS/Math/TRWS/instances.h
+include/OpenMVS/Math/TRWS/minimize.inl
+include/OpenMVS/Math/TRWS/ordering.inl
+include/OpenMVS/Math/TRWS/treeProbabilities.inl
+include/OpenMVS/Math/TRWS/typeBinary.h
+include/OpenMVS/Math/TRWS/typeBinaryFast.h
+include/OpenMVS/Math/TRWS/typeGeneral.h
+include/OpenMVS/Math/TRWS/typePotts.h
+include/OpenMVS/Math/TRWS/typeTruncatedLinear.h
+include/OpenMVS/Math/TRWS/typeTruncatedLinear2D.h
+include/OpenMVS/Math/TRWS/typeTruncatedQuadratic.h
+include/OpenMVS/Math/TRWS/typeTruncatedQuadratic2D.h
+lib/OpenMVS/libCommon.so
+lib/OpenMVS/libIO.so
+lib/OpenMVS/libMVS.so
+lib/OpenMVS/libMath.so
+lib/cmake/OpenMVS/OpenMVSConfig.cmake
+lib/cmake/OpenMVS/OpenMVSConfigVersion.cmake
+lib/cmake/OpenMVS/OpenMVSTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/OpenMVS/OpenMVSTargets.cmake