[PoissonRecon] new port (#17370)

* [PoissonRecon] new port

* [poissonrecon] Simplify port and patches

Co-authored-by: Stefano Sinigardi <stesinigardi@hotmail.com>
Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
This commit is contained in:
Francisco Facioni 2021-04-29 01:31:42 +01:00 committed by GitHub
parent 81bcfa90bc
commit 0b14f8595c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 275 additions and 0 deletions

View File

@ -0,0 +1,89 @@
cmake_minimum_required(VERSION 3.12)
project(PoissonRecon LANGUAGES NONE)
set(INSTALL_BIN_DIR "bin" CACHE PATH "Path where exe and dll will be installed")
set(INSTALL_LIB_DIR "lib" CACHE PATH "Path where lib will be installed")
set(INSTALL_INCLUDE_DIR "include/${PROJECT_NAME}" CACHE PATH "Path where headers will be installed")
set(INSTALL_CMAKE_DIR "share/poissonrecon" CACHE PATH "Path where cmake configs will be installed")
find_package(PNG REQUIRED)
find_package(JPEG REQUIRED)
set(PoissonRecon_HEADERS
"Src/Allocator.h"
"Src/Array.h"
"Src/BinaryNode.h"
"Src/BlockedVector.h"
"Src/BSplineData.h"
"Src/CmdLineParser.h"
"Src/Factor.h"
"Src/FEMTree.h"
"Src/FunctionData.h"
"Src/Geometry.h"
"Src/Image.h"
"Src/JPEG.h"
"Src/LinearSolvers.h"
"Src/MarchingCubes.h"
"Src/MAT.h"
"Src/MyMiscellany.h"
"Src/Ply.h"
"Src/PlyFile.h"
"Src/PNG.h"
"Src/PointStream.h"
"Src/PointStreamData.h"
"Src/Polynomial.h"
"Src/PPolynomial.h"
"Src/PreProcessor.h"
#"Src/Rasterizer.h"
#"Src/RegularGrid.h"
"Src/RegularTree.h"
"Src/SparseMatrix.h"
"Src/SparseMatrixInterface.h"
"Src/Window.h"
)
set(PoissonRecon_INLINES
"Src/Array.inl"
"Src/BMPStream.inl"
"Src/BSplineData.inl"
"Src/CmdLineParser.inl"
"Src/FEMTree.Evaluation.inl"
"Src/FEMTree.Initialize.inl"
"Src/FEMTree.inl"
"Src/FEMTree.IsoSurface.specialized.inl"
"Src/FEMTree.SortedTreeNodes.inl"
"Src/FEMTree.System.inl"
"Src/FEMTree.WeightedSamples.inl"
"Src/FunctionData.inl"
"Src/Geometry.inl"
"Src/JPEG.inl"
"Src/MAT.inl"
"Src/PlyFile.inl"
"Src/PNG.inl"
"Src/PointStream.inl"
"Src/Polynomial.inl"
"Src/PPolynomial.inl"
#"Src/Rasterizer.inl"
#"Src/RegularGrid.inl"
"Src/RegularTree.inl"
"Src/SparseMatrix.inl"
"Src/SparseMatrixInterface.inl"
"Src/Window.inl"
)
add_library(PoissonRecon INTERFACE)
target_link_libraries(PoissonRecon INTERFACE PNG::PNG JPEG::JPEG)
set_target_properties(PoissonRecon PROPERTIES PUBLIC_HEADER "${PoissonRecon_HEADERS};${PoissonRecon_INLINES}")
target_include_directories(PoissonRecon INTERFACE $<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}>)
install(TARGETS PoissonRecon EXPORT PoissonReconTargets
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}"
)
install(EXPORT PoissonReconTargets
NAMESPACE PoissonRecon::
DESTINATION ${INSTALL_CMAKE_DIR}
)

View File

@ -0,0 +1,87 @@
diff --git a/Src/FEMTree.System.inl b/Src/FEMTree.System.inl
index ae554d4..87f0423 100644
--- a/Src/FEMTree.System.inl
+++ b/Src/FEMTree.System.inl
@@ -792,7 +792,7 @@ void FEMTree< Dim , Real >::_solveRegularMG( UIntPack< FEMSigs ... > , typename
}
}
-#if defined( __GNUC__ ) && __GNUC__ < 5
+#if defined( __GNUC__ ) && __GNUC__ < 5 && 0
#warning "you've got me gcc version<5"
template< unsigned int Dim , class Real >
template< unsigned int ... FEMSigs >
@@ -1679,7 +1679,7 @@ SparseMatrix< Real , matrix_index_type > FEMTree< Dim , Real >::systemMatrix( UI
typename FEMTreeNode::template ConstNeighbors< OverlapSizes > neighbors;
neighborKey.getNeighbors( OverlapRadii() , OverlapRadii() , _sNodes.treeNodes[i] , neighbors );
-#if defined( __GNUC__ ) && __GNUC__ < 5
+#if defined( __GNUC__ ) && __GNUC__ < 5 && 0
#warning "you've got me gcc version<5"
matrix.setRowSize( ii , _getMatrixRowSize( UIntPack< FEMSigs ... >() , neighbors ) );
#else // !__GNUC__ || __GNUC__ >=5
diff --git a/Src/FEMTree.WeightedSamples.inl b/Src/FEMTree.WeightedSamples.inl
index b263dda..282387e 100644
--- a/Src/FEMTree.WeightedSamples.inl
+++ b/Src/FEMTree.WeightedSamples.inl
@@ -225,7 +225,7 @@ Real FEMTree< Dim , Real >::_splatPointData( Allocator< FEMTreeNode > *nodeAlloc
width = 1.0 / ( 1<<_localDepth( temp ) );
_v = v * weight / Real( pow( width , dim ) ) * Real( dx );
-#if defined( __GNUC__ ) && __GNUC__ < 5
+#if defined( __GNUC__ ) && __GNUC__ < 5 && 0
#warning "you've got me gcc version<5"
_splatPointData< CreateNodes , ThreadSafe , V >( nodeAllocator , temp , position , _v , dataInfo , dataKey );
#else // !__GNUC__ || __GNUC__ >=5
@@ -238,7 +238,7 @@ Real FEMTree< Dim , Real >::_splatPointData( Allocator< FEMTreeNode > *nodeAlloc
width = 1.0 / ( 1<<_localDepth( temp ) );
_v = v * weight / Real( pow( width , dim ) ) * Real( dx );
-#if defined( __GNUC__ ) && __GNUC__ < 5
+#if defined( __GNUC__ ) && __GNUC__ < 5 && 0
#warning "you've got me gcc version<5"
_splatPointData< CreateNodes , ThreadSafe , V >( nodeAllocator , temp , position , _v , dataInfo , dataKey );
#else // !__GNUC__ || __GNUC__ >=5
diff --git a/Src/FEMTree.h b/Src/FEMTree.h
index 8aa3b41..0be77a1 100644
--- a/Src/FEMTree.h
+++ b/Src/FEMTree.h
@@ -219,6 +219,7 @@ template< class Data , typename Pack > struct _SparseOrDenseNodeData{};
template< class Data , unsigned int ... FEMSigs >
struct _SparseOrDenseNodeData< Data , UIntPack< FEMSigs ... > >
{
+ virtual ~_SparseOrDenseNodeData() {}
static const unsigned int Dim = sizeof ... ( FEMSigs );
typedef UIntPack< FEMSigs ... > FEMSignatures;
typedef Data data_type;
@@ -1841,7 +1842,7 @@ protected:
template< unsigned int ... FEMSigs >
int _getProlongedMatrixRowSize( const FEMTreeNode* node , const typename FEMTreeNode::template ConstNeighbors< UIntPack< BSplineOverlapSizes< FEMSignature< FEMSigs >::Degree >::OverlapSize ... > >& pNeighbors ) const;
-#if defined( __GNUC__ ) && __GNUC__ < 5
+#if defined( __GNUC__ ) && __GNUC__ < 5 && 0
#warning "you've got me gcc version<5"
template< unsigned int ... FEMSigs >
int _getMatrixRowSize( UIntPack< FEMSigs ... > , const typename FEMTreeNode::template ConstNeighbors< UIntPack< BSplineOverlapSizes< FEMSignature< FEMSigs >::Degree >::OverlapSize ... > >& neighbors ) const;
diff --git a/Src/FEMTree.inl b/Src/FEMTree.inl
index e4c2310..f88316b 100644
--- a/Src/FEMTree.inl
+++ b/Src/FEMTree.inl
@@ -374,7 +374,7 @@ SparseNodeData< OutData , UIntPack< DataSigs ... > > FEMTree< Dim , Real >::setD
AddAtomic( weightSum , sample.weight );
out *= sample.weight;
Allocator< FEMTreeNode > *nodeAllocator = nodeAllocators.size() ? nodeAllocators[ thread ] : NULL;
-#if defined( __GNUC__ ) && __GNUC__ < 5
+#if defined( __GNUC__ ) && __GNUC__ < 5 && 0
#warning "you've got me gcc version<5"
if( density ) AddAtomic( _pointWeightSum , _splatPointData< true , true , DensityDegree , OutData >( nodeAllocator , *density , p , out , dataField , densityKey , oneKey ? *( (DataKey*)&densityKey ) : dataKey , 0 , maxDepth , Dim , depthBias ) * sample.weight );
#else // !__GNUC__ || __GNUC__ >=5
@@ -383,7 +383,7 @@
else
{
Real width = (Real)( 1.0 / ( 1<<maxDepth ) );
-#if defined( __GNUC__ ) && __GNUC__ < 5
+#if defined( __GNUC__ ) && __GNUC__ < 5 && 0
#warning "you've got me gcc version<5"
_splatPointData< true , true , OutData >( nodeAllocator , _leaf< true >( nodeAllocator , p , maxDepth ) , p , out / (Real)pow( width , Dim ) , dataField , oneKey ? *( (DataKey*)&densityKey ) : dataKey );
#else // !__GNUC__ || __GNUC__ >=5

View File

@ -0,0 +1,33 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mkazhdan/PoissonRecon
REF 03f73754e994eb388de63285d3a2772493168e8a
SHA512 be1d6842952d2b27860b5a82d9cc536da213fd2e44d946c512e04881af66a4c7c039930347fe9db5b168cc356e55167c9bdbdb39eab9cea68882dc01a9482867
HEAD_REF master
PATCHES
use-external-libs.patch
disable-gcc5-checks.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBUILD_TOOLS=OFF
)
file(WRITE "${CURRENT_PACKAGES_DIR}/share/poissonrecon/PoissonRecon-config.cmake" [=[
include(CMakeFindDependencyMacro)
find_dependency(PNG)
find_dependency(JPEG)
include("${CMAKE_CURRENT_LIST_DIR}/PoissonReconTargets.cmake")
]=])
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug")
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

View File

@ -0,0 +1,42 @@
--- a/Src/JPEG.h
+++ b/Src/JPEG.h
@@ -6,14 +6,10 @@
#ifdef _WIN32
#include <windows.h>
-#include "JPEG/jpeglib.h"
-#include "JPEG/jerror.h"
-#include "JPEG/jmorecfg.h"
-#else // !_WIN32
+#endif // _WIN32
#include <jpeglib.h>
#include <jerror.h>
#include <jmorecfg.h>
-#endif // _WIN32
struct my_error_mgr
{
--- a/Src/PNG.h
+++ b/Src/PNG.h
@@ -1,7 +1,7 @@
#ifndef PNG_INCLUDED
#define PNG_INCLUDED
-#include "PNG/png.h"
+#include <png.h>
struct PNGReader : public ImageReader
{
--- a/Src/PNG.inl
+++ b/Src/PNG.inl
@@ -1,10 +1,6 @@
#include <stdio.h>
#include <vector>
-#ifdef _WIN32
-#include "PNG/png.h"
-#else // !_WIN32
#include <png.h>
-#endif // _WIN32
inline PNGReader::PNGReader( const char* fileName , unsigned int& width , unsigned int& height , unsigned int& channels )
{

View File

@ -0,0 +1,11 @@
{
"name": "poissonrecon",
"version-string": "2019-09-15",
"description": "Adaptive Multigrid Solvers",
"homepage": "https://github.com/mkazhdan/PoissonRecon",
"dependencies": [
"libjpeg-turbo",
"libpng",
"zlib"
]
}

View File

@ -4828,6 +4828,10 @@
"baseline": "0.9.7",
"port-version": 0
},
"poissonrecon": {
"baseline": "2019-09-15",
"port-version": 0
},
"poly2tri": {
"baseline": "2020-07-21",
"port-version": 0

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "cd642f0dd6c4e1c92eebd490c70eb2e14a0e8e3d",
"version-string": "2019-09-15",
"port-version": 0
}
]
}