From 0b14f8595c7d5dda19975894385feb50aebcfd87 Mon Sep 17 00:00:00 2001 From: Francisco Facioni Date: Thu, 29 Apr 2021 01:31:42 +0100 Subject: [PoissonRecon] new port (#17370) * [PoissonRecon] new port * [poissonrecon] Simplify port and patches Co-authored-by: Stefano Sinigardi Co-authored-by: Robert Schumacher --- ports/poissonrecon/CMakeLists.txt | 89 ++++++++++++++++++++++++++++ ports/poissonrecon/disable-gcc5-checks.patch | 87 +++++++++++++++++++++++++++ ports/poissonrecon/portfile.cmake | 33 +++++++++++ ports/poissonrecon/use-external-libs.patch | 42 +++++++++++++ ports/poissonrecon/vcpkg.json | 11 ++++ versions/baseline.json | 4 ++ versions/p-/poissonrecon.json | 9 +++ 7 files changed, 275 insertions(+) create mode 100644 ports/poissonrecon/CMakeLists.txt create mode 100644 ports/poissonrecon/disable-gcc5-checks.patch create mode 100644 ports/poissonrecon/portfile.cmake create mode 100644 ports/poissonrecon/use-external-libs.patch create mode 100644 ports/poissonrecon/vcpkg.json create mode 100644 versions/p-/poissonrecon.json diff --git a/ports/poissonrecon/CMakeLists.txt b/ports/poissonrecon/CMakeLists.txt new file mode 100644 index 000000000..d0b108e4c --- /dev/null +++ b/ports/poissonrecon/CMakeLists.txt @@ -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(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} +) diff --git a/ports/poissonrecon/disable-gcc5-checks.patch b/ports/poissonrecon/disable-gcc5-checks.patch new file mode 100644 index 000000000..d147df944 --- /dev/null +++ b/ports/poissonrecon/disable-gcc5-checks.patch @@ -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<( nodeAllocator , _leaf< true >( nodeAllocator , p , maxDepth ) , p , out / (Real)pow( width , Dim ) , dataField , oneKey ? *( (DataKey*)&densityKey ) : dataKey ); + #else // !__GNUC__ || __GNUC__ >=5 diff --git a/ports/poissonrecon/portfile.cmake b/ports/poissonrecon/portfile.cmake new file mode 100644 index 000000000..f7c04b406 --- /dev/null +++ b/ports/poissonrecon/portfile.cmake @@ -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) diff --git a/ports/poissonrecon/use-external-libs.patch b/ports/poissonrecon/use-external-libs.patch new file mode 100644 index 000000000..cb2918a67 --- /dev/null +++ b/ports/poissonrecon/use-external-libs.patch @@ -0,0 +1,42 @@ +--- a/Src/JPEG.h ++++ b/Src/JPEG.h +@@ -6,14 +6,10 @@ + + #ifdef _WIN32 + #include +-#include "JPEG/jpeglib.h" +-#include "JPEG/jerror.h" +-#include "JPEG/jmorecfg.h" +-#else // !_WIN32 ++#endif // _WIN32 + #include + #include + #include +-#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 + + struct PNGReader : public ImageReader + { +--- a/Src/PNG.inl ++++ b/Src/PNG.inl +@@ -1,10 +1,6 @@ + #include + #include +-#ifdef _WIN32 +-#include "PNG/png.h" +-#else // !_WIN32 + #include +-#endif // _WIN32 + + inline PNGReader::PNGReader( const char* fileName , unsigned int& width , unsigned int& height , unsigned int& channels ) + { diff --git a/ports/poissonrecon/vcpkg.json b/ports/poissonrecon/vcpkg.json new file mode 100644 index 000000000..513405c12 --- /dev/null +++ b/ports/poissonrecon/vcpkg.json @@ -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" + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 208c954a2..68819c505 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -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 diff --git a/versions/p-/poissonrecon.json b/versions/p-/poissonrecon.json new file mode 100644 index 000000000..7e8d56d53 --- /dev/null +++ b/versions/p-/poissonrecon.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "cd642f0dd6c4e1c92eebd490c70eb2e14a0e8e3d", + "version-string": "2019-09-15", + "port-version": 0 + } + ] +} -- cgit v1.2.3