Skip to content
Commits on Source (7)
language: cpp
dist: trusty
sudo: required
# os:
# - linux
......@@ -9,14 +11,14 @@ compiler:
- clang
env:
- CGAL_VERSION=4.3
- CGAL_VERSION=4.7
- CGAL_VERSION=4.10.2
- CGAL_VERSION=4.11.1
before_install:
- ./travis/${TRAVIS_OS_NAME}/before_install.sh $CGAL_VERSION
before_script:
- cmake -DSFCGAL_BUILD_TESTS=ON
- CGAL_DIR=/usr/local/lib/CGAL cmake -DSFCGAL_BUILD_TESTS=ON
script:
- make
......
......@@ -25,7 +25,7 @@ set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules;${CMAKE_MODULE_PATH}"
set( SFCGAL_VERSION_MAJOR 1 )
set( SFCGAL_VERSION_MINOR 3 )
set( SFCGAL_VERSION_PATCH 2 )
set( SFCGAL_VERSION_PATCH 1 )
set( SFCGAL_VERSION "${SFCGAL_VERSION_MAJOR}.${SFCGAL_VERSION_MINOR}.${SFCGAL_VERSION_PATCH}" )
......
1.3.2 (2017-09-13):
* Fix compilation with CGAL 4.10. CGAL 4.10.1 is needed
1.3.1 (2017-05-29):
* Add a SFCGAL-osg library for OSG specific functions
* Fix C API geometry_is_planar
......
find_path(CGAL_INCLUDE_DIRS CGAL/gmp.h
HINTS $ENV{CGAL_DIR}/include ${CGAL_DIR}/include ${CGAL_INCLUDE_DIRS}
PATH_SUFFIXES CGAL
)
if( MSVC10)
set( CGAL_LIBRARY_POSTFIX "-vc100-mt-${CGAL_VERSION}" )
set( CGAL_LIBRARY_POSTFIX_DEBUG "-vc100-mt-gd-${CGAL_VERSION}" )
else()
set( CGAL_LIBRARY_POSTFIX "")
set( CGAL_LIBRARY_POSTFIX_DEBUG "d")
endif()
#-- incidates if debug version are found
set( CGAL_DEBUG_FOUND ON )
#-- find CGAL library
find_library( CGAL_LIBRARY "CGAL${CGAL_LIBRARY_POSTFIX}" ${CGAL_LIBRARY}
HINTS ${CGAL_LIBRARY_DIRS} $ENV{CGAL_DIR}/lib
)
if( CGAL_LIBRARY )
get_filename_component(CGAL_LIBRARY_DIRS ${CGAL_LIBRARY} PATH)
endif()
if(CGAL_FIND_VERSION)
message("CGAL_DIR ${CGAL_DIR}")
find_file(version_file version.h HINTS $ENV{CGAL_DIR}/include ${CGAL_DIR}/include ${CGAL_INCLUDE_DIRS} PATH_SUFFIXES CGAL)
file(STRINGS ${version_file} version_str REGEX "# *define +CGAL_VERSION +")
string( REGEX REPLACE "# *define +CGAL_VERSION +" "" CGAL_VERSION ${version_str})
if("${CGAL_VERSION}" VERSION_LESS "${CGAL_FIND_VERSION}")
message(FATAL_ERROR "CGAL " ${CGAL_FIND_VERSION} " is required (found " ${CGAL_VERSION} " in ${version_file})" )
endif()
endif()
find_library( CGAL_LIBRARY_DEBUG "CGAL${CGAL_LIBRARY_POSTFIX_DEBUG}" ${CGAL_LIBRARY_DEBUG}
HINTS ${CGAL_LIBRARY_DIRS}
)
if( NOT CGAL_LIBRARY_DEBUG )
set( CGAL_DEBUG_FOUND OFF )
endif()
#-- CGAL components (Core, ImageIO)
foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} )
#-- find release
find_library( CGAL_${CGAL_COMPONENT}_LIBRARY "CGAL_${CGAL_COMPONENT}${CGAL_LIBRARY_POSTFIX}" "${CGAL_${CGAL_COMPONENT}_LIBRARY}"
HINTS ${CGAL_LIBRARY_DIRS} $ENV{CGAL_DIR}/lib
)
#-- find debug
find_library( CGAL_${CGAL_COMPONENT}_LIBRARY_DEBUG "CGAL_${CGAL_COMPONENT}${CGAL_LIBRARY_POSTFIX_DEBUG}" "${CGAL_${CGAL_COMPONENT}_LIBRARY_DEBUG}"
HINTS ${CGAL_LIBRARY_DIRS} $ENV{CGAL_DIR}/lib
)
if( NOT CGAL_${CGAL_COMPONENT}_LIBRARY_DEBUG )
set( CGAL_DEBUG_FOUND OFF )
endif()
endforeach()
#-- build variable CGAL_LIBRARIES
set( CGAL_LIBRARIES "" )
if( ${CGAL_DEBUG_FOUND} )
list( APPEND CGAL_LIBRARIES optimized ${CGAL_LIBRARY} debug ${CGAL_LIBRARY_DEBUG} )
foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} )
list( APPEND CGAL_LIBRARIES optimized "${CGAL_${CGAL_COMPONENT}_LIBRARY}" debug "${CGAL_${CGAL_COMPONENT}_LIBRARY_DEBUG}" )
endforeach()
else()
list( APPEND CGAL_LIBRARIES ${CGAL_LIBRARY} )
foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} )
list( APPEND CGAL_LIBRARIES ${CGAL_${CGAL_COMPONENT}_LIBRARY} )
endforeach()
endif()
#-- report/validate
set( CGAL_COMPONENT_LIBRARIES "" )
set( CGAL_COMPONENT_LIBRARIES_DEBUG "" )
foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} )
list( APPEND CGAL_COMPONENT_LIBRARIES CGAL_${CGAL_COMPONENT}_LIBRARY )
list( APPEND CGAL_COMPONENT_LIBRARIES_DEBUG CGAL_${CGAL_COMPONENT}_LIBRARY_DEBUG )
endforeach()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
CGAL DEFAULT_MSG
CGAL_INCLUDE_DIRS CGAL_LIBRARIES ${CGAL_COMPONENT_LIBRARIES}
)
mark_as_advanced( CGAL_LIBRARY_DIRS CGAL_LIBRARY_DEBUG ${CGAL_COMPONENT_LIBRARIES_DEBUG} )
sfcgal (1.3.2-1) UNRELEASED; urgency=medium
sfcgal (1.3.3-1) unstable; urgency=medium
* New upstream release.
(closes: #876521)
* Drop spelling-errors.patch, applied upstream.
* Require at least libcgal-dev 4.10.1.
* Change priority from extra to optional.
* Bump Standards-Version to 4.1.0, changes: priority.
* Add patch by Pierre-Eric Pelloux-Prayer to fix FTBFS with CGAL 4.11.
(closes: #876521)
* Bump Standards-Version to 4.1.3, changes: priority.
* Update copyright-format URL to use HTTPS.
* Add patches by Sebastien Loriot to fix FTBFS with CGAL 4.11.
(closes: #876521)
* Add patch to remove FindCGAL.cmake, breaks Config mode.
* Update symbols for amd64.
* Update Vcs-* URLs for Salsa.
* Bump Standards-Version to 4.1.3, no changes.
* Drop obsolete dbg package.
-- Bas Couwenberg <sebastic@debian.org> Fri, 15 Sep 2017 20:49:16 +0200
-- Bas Couwenberg <sebastic@debian.org> Fri, 06 Apr 2018 14:10:43 +0200
sfcgal (1.3.1-2) unstable; urgency=medium
......
......@@ -4,7 +4,7 @@ Uploaders: Sven Geggus <sven-debian@geggus.net>,
Bas Couwenberg <sebastic@debian.org>
Section: science
Priority: optional
Build-Depends: debhelper (>= 9),
Build-Depends: debhelper (>= 9.20160114),
cmake,
libcgal-dev (>= 4.10.1),
libboost-all-dev,
......@@ -72,21 +72,3 @@ Description: Library for ISO 19107:2013 and OGC SFA 1.2 for 3D operations (devel
manual).
.
This package provides the development files.
Package: sfcgal-dbg
Architecture: any
Section: debug
Depends: libsfcgal1 (= ${binary:Version}),
libsfcgal-osg1 (= ${binary:Version}),
${misc:Depends}
Description: Debug symbols for SFCGAL
SFCGAL is a C++ wrapper library around CGAL with the aim of
supporting ISO 19107:2013 and OGC Simple Features Access 1.2 for 3D
operations.
.
SFCGAL provides standard compliant geometry types and operations,
that can be accessed from its C or C++ APIs. PostGIS uses the C API,
to expose some SFCGAL's functions in spatial databases (cf. PostGIS
manual).
.
This package provides debug symbols for SFCGAL.
Description: compatibility with gmpxx
Author: =?UTF-8?q?S=C3=A9bastien=20Loriot?= <sebastien.loriot@cgal.org>
Origin: https://github.com/Oslandia/SFCGAL/pull/157/commits/644a289a9fa88327334447a42adf225922613324
Bug: https://github.com/Oslandia/SFCGAL/issues/145
Bug-Debian: https://bugs.debian.org/876521
--- a/src/detail/io/Serialization.cpp
+++ b/src/detail/io/Serialization.cpp
@@ -169,5 +169,53 @@ void load( boost::archive::binary_iarchi
}
}
+#ifdef CGAL_USE_GMPXX
+void save( boost::archive::text_oarchive& ar, const mpz_class& z, const unsigned int /*version*/ )
+{
+ std::ostringstream ostr;
+ ostr << z;
+ std::string str = ostr.str();
+ ar << str;
+}
+
+// specialization for binary archives
+void save ( boost::archive::binary_oarchive& ar, const mpz_class& z, const unsigned int/* version*/ )
+{
+ mpz_srcptr mpz = z.get_mpz_t();
+ int32_t size = mpz->_mp_size;
+ ar& size;
+ uint32_t rsize = size >= 0 ? size : -size;
+
+ for ( uint32_t i = 0; i < rsize; ++i ) {
+ ar& mpz->_mp_d[i];
+ }
+}
+
+
+void load( boost::archive::text_iarchive& ar, mpz_class& z, const unsigned int /*version*/ )
+{
+ std::string line;
+ ar >> line;
+ std::istringstream istr( line );
+ istr >> z;
+}
+
+void load( boost::archive::binary_iarchive& ar, mpz_class& z, const unsigned int /*version*/ )
+{
+ int32_t size;
+ uint32_t rsize;
+ mpz_ptr mpz = z.get_mpz_t();
+ ar& size;
+ rsize = size >= 0 ? size : -size;
+ mpz->_mp_size = size;
+ _mpz_realloc( mpz, rsize );
+ uint32_t i;
+
+ for ( i = 0; i < rsize; ++i ) {
+ ar& mpz->_mp_d[i];
+ }
+}
+#endif
+
}
}
--- a/src/detail/io/Serialization.h
+++ b/src/detail/io/Serialization.h
@@ -34,6 +34,10 @@
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
+#ifdef CGAL_USE_GMPXX
+#include <CGAL/mpz_class.h>
+#include <CGAL/mpq_class.h>
+#endif
namespace SFCGAL {
@@ -132,6 +136,63 @@ void serialize( Archive& ar, CGAL::Gmpq&
split_free( ar, q, version );
}
+#ifdef CGAL_USE_GMPXX
+/**
+ * Serialization of mpz_class for text archives
+ */
+SFCGAL_API void save( boost::archive::text_oarchive& ar, const mpz_class& z, const unsigned int version );
+
+/**
+ * Serialization of mpz_class for binary archives
+ */
+SFCGAL_API void save ( boost::archive::binary_oarchive& ar, const mpz_class& z, const unsigned int version );
+
+/**
+ * Unserialization of mpz_class for text archives
+ */
+SFCGAL_API void load( boost::archive::text_iarchive& ar, mpz_class& z, const unsigned int version );
+
+/**
+ * Unserialization of mpz_class for binary archives
+ */
+SFCGAL_API void load( boost::archive::binary_iarchive& ar, mpz_class& z, const unsigned int version );
+
+template<class Archive>
+void serialize( Archive& ar, mpz_class& z, const unsigned int version )
+{
+ split_free( ar, z, version );
+}
+
+/**
+ * Serializer of mpq_class
+ */
+template<class Archive>
+void save( Archive& ar, const mpq_class& q, const unsigned int /*version*/ )
+{
+ mpz_class n = q.get_num();
+ mpz_class d = q.get_den();
+ ar& n;
+ ar& d;
+}
+
+/**
+ * Unserializer of mpq_class
+ */
+template<class Archive>
+void load( Archive& ar, mpq_class& q, const unsigned int /*version*/ )
+{
+ mpz_class n;
+ mpz_class d;
+ ar& n;
+ ar& d;
+ q = mpq_class( n, d );
+}
+template<class Archive>
+void serialize( Archive& ar, mpq_class& q, const unsigned int version )
+{
+ split_free( ar, q, version );
+}
+#endif
/**
* Serializer of Kernel::FT
--- a/src/detail/io/WktReader.cpp
+++ b/src/detail/io/WktReader.cpp
@@ -647,7 +647,7 @@ bool WktReader::readPointCoordinate( Poi
}
p = Point( coordinates[0], coordinates[1], coordinates[2] );
- p.setM( coordinates[3].to_double() );
+ p.setM( CGAL::to_double(coordinates[3]) );
}
else if ( _isMeasured && ! _is3D ) {
// XYM
@@ -656,7 +656,7 @@ bool WktReader::readPointCoordinate( Poi
}
p = Point( coordinates[0], coordinates[1] );
- p.setM( coordinates[2].to_double() );
+ p.setM( CGAL::to_double(coordinates[2]) );
}
else if ( coordinates.size() == 3 ) {
// XYZ
Description: fix I/O input with gmpxx + make it similar to Gmpq
Author: =?UTF-8?q?S=C3=A9bastien=20Loriot?= <sebastien.loriot@cgal.org>
Origin: https://github.com/Oslandia/SFCGAL/pull/157/commits/8de5943b4f392b1a6b7b4d89bfed5d735cb9a277
Bug: https://github.com/Oslandia/SFCGAL/issues/145
Bug-Debian: https://bugs.debian.org/876521
--- a/src/Coordinate.cpp
+++ b/src/Coordinate.cpp
@@ -267,10 +267,10 @@ private:
Kernel::FT _roundFT( const Kernel::FT& v ) const {
#ifdef CGAL_USE_GMPXX
- return Kernel::FT( ::mpq_class(
- SFCGAL::round( v.exact() * _scaleFactor ),
- _scaleFactor
- ) ) ;
+ ::mpq_class q( SFCGAL::round( v.exact() * _scaleFactor ),
+ _scaleFactor) ;
+ q.canonicalize();
+ return Kernel::FT(q);
#else
return Kernel::FT( CGAL::Gmpq(
SFCGAL::round( v.exact() * _scaleFactor ),
--- a/src/detail/io/WktWriter.cpp
+++ b/src/detail/io/WktWriter.cpp
@@ -40,6 +40,22 @@ namespace SFCGAL {
namespace detail {
namespace io {
+namespace impl {
+std::ostream& writeFT(std::ostream& s, const CGAL::Gmpq& ft)
+{
+ s << ft;
+ return s;
+}
+
+#ifdef CGAL_USE_GMPXX
+std::ostream& writeFT(std::ostream& s, const mpq_class& ft)
+{
+ s << ft.get_num() << "/" << ft.get_den();
+ return s;
+}
+#endif
+} //end of impl namespace
+
///
///
///
@@ -135,10 +151,12 @@ void WktWriter::writeCoordinateType( con
void WktWriter::writeCoordinate( const Point& g )
{
if ( _exactWrite ) {
- _s << CGAL::exact( g.x() ) << " " << CGAL::exact( g.y() );
+ impl::writeFT(_s, CGAL::exact( g.x() )) << " ";
+ impl::writeFT(_s, CGAL::exact( g.y() ));
if ( g.is3D() ) {
- _s << " " << CGAL::exact( g.z() );
+ _s << " ";
+ impl::writeFT(_s, CGAL::exact( g.z() ));
}
}
else {
--- a/src/detail/tools/InputStreamReader.h
+++ b/src/detail/tools/InputStreamReader.h
@@ -150,7 +150,7 @@ public:
skipWhiteSpaces();
}
- if ( _s >> value ) {
+ if ( CGAL::Input_rep<T>(value)(_s) ) {
commit();
return true ;
}
Description: fix gmpxx compatibility in tests
Author: =?UTF-8?q?S=C3=A9bastien=20Loriot?= <sebastien.loriot@cgal.org>
Origin: https://github.com/Oslandia/SFCGAL/pull/157/commits/3c840d79b21993a0b7a590eb3a57cd25194a0c4b
Bug: https://github.com/Oslandia/SFCGAL/issues/145
Bug-Debian: https://bugs.debian.org/876521
--- a/src/numeric.cpp
+++ b/src/numeric.cpp
@@ -58,6 +58,48 @@ CGAL::Gmpz round( const CGAL::Gmpq& v )
}
}
+#ifdef CGAL_USE_GMPXX
+///
+///
+///
+mpz_class floor( const mpq_class& v )
+{
+ return v.get_num() / v.get_den() ;
+}
+
+///
+///
+///
+mpz_class ceil( const mpq_class& v )
+{
+ mpz_class result( 0 ) ;
+ mpz_cdiv_q( result.get_mpz_t(), v.get_num().get_mpz_t(), v.get_den().get_mpz_t() ) ;
+ return result ;
+}
+
+///
+///
+///
+mpz_class round( const mpq_class& v )
+{
+ if ( v < 0 ) {
+ //ceil( v - 0.5 ) ;
+ mpq_class tmp = v - mpq_class( 1,2 );
+ return ceil( tmp );
+ }
+ else if ( v == 0 ) {
+ return 0 ;
+ }
+ else {
+ //floor( v + 0.5 ) ;
+ mpq_class tmp = v + mpq_class( 1,2 );
+ return floor( tmp );
+ }
+}
+#endif
+
+
+
}//SFCGAL
--- a/test/unit/SFCGAL/KernelTest.cpp
+++ b/test/unit/SFCGAL/KernelTest.cpp
@@ -22,6 +22,7 @@
#include <boost/test/unit_test.hpp>
#include <SFCGAL/Kernel.h>
+#include <CGAL/mpq_class.h>
#include <SFCGAL/Coordinate.h>
#include <SFCGAL/LineString.h>
@@ -61,10 +62,11 @@ BOOST_AUTO_TEST_CASE( testSerializeDeser
Kernel::FT a = 1 ;
a /= 3 ;
- std::ostringstream oss ;
- oss << CGAL::exact( a ) ;
+ std::stringstream ss ;
+ ss << CGAL::exact( a ) ;
- Kernel::FT b( oss.str() );
+ Kernel::FT b;
+ ss >> b;
BOOST_CHECK_EQUAL( a, b ) ;
}
--- a/test/unit/SFCGAL/io/WktReaderTest.cpp
+++ b/test/unit/SFCGAL/io/WktReaderTest.cpp
@@ -246,10 +246,16 @@ BOOST_AUTO_TEST_CASE( wkt_exactTest )
BOOST_REQUIRE_EQUAL( g->as< LineString >().numPoints(), 2U );
Kernel::Exact_kernel::FT x = CGAL::exact( g->as<LineString>().pointN( 0 ).x() );
Kernel::Exact_kernel::FT y = CGAL::exact( g->as<LineString>().pointN( 0 ).y() );
- BOOST_CHECK_EQUAL( x.numerator(), 2 );
- BOOST_CHECK_EQUAL( x.denominator(), 3 );
- BOOST_CHECK_EQUAL( y.numerator(), 3 );
- BOOST_CHECK_EQUAL( y.denominator(), 2 );
+
+ CGAL::Fraction_traits<Kernel::Exact_kernel::FT>::Numerator_type xn, xd, yn, yd;
+ CGAL::Fraction_traits<Kernel::Exact_kernel::FT>::Decompose decomp;
+ decomp(x, xn, xd);
+ decomp(y, yn, yd);
+
+ BOOST_CHECK_EQUAL( xn, 2 );
+ BOOST_CHECK_EQUAL( xd, 3 );
+ BOOST_CHECK_EQUAL( yn, 3 );
+ BOOST_CHECK_EQUAL( yd, 2 );
}
BOOST_AUTO_TEST_CASE( charArrayRead )
Description: Fix FTBFS with CGAL 4.11.
Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@oslandia.com>
Origin: https://github.com/Oslandia/SFCGAL/commit/5c495ce98c404f891eb0e2c92c2d73b94af3ef23
Bug-Debian: https://bugs.debian.org/876521
Bug: https://github.com/Oslandia/SFCGAL/issues/145
--- a/src/Coordinate.cpp
+++ b/src/Coordinate.cpp
@@ -266,10 +266,17 @@ private:
Kernel::FT _roundFT( const Kernel::FT& v ) const {
+ #ifdef CGAL_USE_GMPXX
+ return Kernel::FT( ::mpq_class(
+ SFCGAL::round( v.exact() * _scaleFactor ),
+ _scaleFactor
+ ) ) ;
+ #else
return Kernel::FT( CGAL::Gmpq(
SFCGAL::round( v.exact() * _scaleFactor ),
_scaleFactor
) ) ;
+ #endif
}
};
--- a/src/numeric.h
+++ b/src/numeric.h
@@ -57,6 +57,20 @@ inline double round( const double& v )
}
}
+#ifdef CGAL_USE_GMPXX
+/**
+ * @brief floor a rational to an integer
+ */
+SFCGAL_API ::mpz_class floor( const ::mpq_class& v ) ;
+/**
+ * @brief ceil a rational to an integer
+ */
+SFCGAL_API ::mpz_class ceil( const ::mpq_class& v ) ;
+/**
+ * @brief round a rational to an integer
+ */
+SFCGAL_API ::mpz_class round( const ::mpq_class& v ) ;
+#endif
/**
* @brief floor a rational to an integer
Description: Remove FindCGAL.cmake, breaks Config mode.
Author: Bas Couwenberg <sebastic@debian.org>
Bug: https://github.com/Oslandia/SFCGAL/issues/145
Bug-Debian: https://bugs.debian.org/876521
--- a/cmake/Modules/FindCGAL.cmake
+++ /dev/null
@@ -1,93 +0,0 @@
-find_path(CGAL_INCLUDE_DIRS CGAL/gmp.h
- HINTS $ENV{CGAL_DIR}/include ${CGAL_DIR}/include ${CGAL_INCLUDE_DIRS}
- PATH_SUFFIXES CGAL
-)
-
-if( MSVC10)
- set( CGAL_LIBRARY_POSTFIX "-vc100-mt-${CGAL_VERSION}" )
- set( CGAL_LIBRARY_POSTFIX_DEBUG "-vc100-mt-gd-${CGAL_VERSION}" )
-else()
- set( CGAL_LIBRARY_POSTFIX "")
- set( CGAL_LIBRARY_POSTFIX_DEBUG "d")
-endif()
-
-#-- incidates if debug version are found
-set( CGAL_DEBUG_FOUND ON )
-
-
-#-- find CGAL library
-find_library( CGAL_LIBRARY "CGAL${CGAL_LIBRARY_POSTFIX}" ${CGAL_LIBRARY}
- HINTS ${CGAL_LIBRARY_DIRS} $ENV{CGAL_DIR}/lib
-)
-if( CGAL_LIBRARY )
- get_filename_component(CGAL_LIBRARY_DIRS ${CGAL_LIBRARY} PATH)
-endif()
-
-if(CGAL_FIND_VERSION)
- message("CGAL_DIR ${CGAL_DIR}")
- find_file(version_file version.h HINTS $ENV{CGAL_DIR}/include ${CGAL_DIR}/include ${CGAL_INCLUDE_DIRS} PATH_SUFFIXES CGAL)
- file(STRINGS ${version_file} version_str REGEX "# *define +CGAL_VERSION +")
- string( REGEX REPLACE "# *define +CGAL_VERSION +" "" CGAL_VERSION ${version_str})
- if("${CGAL_VERSION}" VERSION_LESS "${CGAL_FIND_VERSION}")
- message(FATAL_ERROR "CGAL " ${CGAL_FIND_VERSION} " is required (found " ${CGAL_VERSION} " in ${version_file})" )
- endif()
-
-endif()
-
-find_library( CGAL_LIBRARY_DEBUG "CGAL${CGAL_LIBRARY_POSTFIX_DEBUG}" ${CGAL_LIBRARY_DEBUG}
- HINTS ${CGAL_LIBRARY_DIRS}
-)
-if( NOT CGAL_LIBRARY_DEBUG )
- set( CGAL_DEBUG_FOUND OFF )
-endif()
-
-#-- CGAL components (Core, ImageIO)
-foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} )
- #-- find release
- find_library( CGAL_${CGAL_COMPONENT}_LIBRARY "CGAL_${CGAL_COMPONENT}${CGAL_LIBRARY_POSTFIX}" "${CGAL_${CGAL_COMPONENT}_LIBRARY}"
- HINTS ${CGAL_LIBRARY_DIRS} $ENV{CGAL_DIR}/lib
- )
- #-- find debug
- find_library( CGAL_${CGAL_COMPONENT}_LIBRARY_DEBUG "CGAL_${CGAL_COMPONENT}${CGAL_LIBRARY_POSTFIX_DEBUG}" "${CGAL_${CGAL_COMPONENT}_LIBRARY_DEBUG}"
- HINTS ${CGAL_LIBRARY_DIRS} $ENV{CGAL_DIR}/lib
- )
-
- if( NOT CGAL_${CGAL_COMPONENT}_LIBRARY_DEBUG )
- set( CGAL_DEBUG_FOUND OFF )
- endif()
-endforeach()
-
-
-#-- build variable CGAL_LIBRARIES
-
-set( CGAL_LIBRARIES "" )
-if( ${CGAL_DEBUG_FOUND} )
- list( APPEND CGAL_LIBRARIES optimized ${CGAL_LIBRARY} debug ${CGAL_LIBRARY_DEBUG} )
- foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} )
- list( APPEND CGAL_LIBRARIES optimized "${CGAL_${CGAL_COMPONENT}_LIBRARY}" debug "${CGAL_${CGAL_COMPONENT}_LIBRARY_DEBUG}" )
- endforeach()
-else()
- list( APPEND CGAL_LIBRARIES ${CGAL_LIBRARY} )
- foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} )
- list( APPEND CGAL_LIBRARIES ${CGAL_${CGAL_COMPONENT}_LIBRARY} )
- endforeach()
-endif()
-
-#-- report/validate
-set( CGAL_COMPONENT_LIBRARIES "" )
-set( CGAL_COMPONENT_LIBRARIES_DEBUG "" )
-foreach( CGAL_COMPONENT ${CGAL_FIND_COMPONENTS} )
- list( APPEND CGAL_COMPONENT_LIBRARIES CGAL_${CGAL_COMPONENT}_LIBRARY )
- list( APPEND CGAL_COMPONENT_LIBRARIES_DEBUG CGAL_${CGAL_COMPONENT}_LIBRARY_DEBUG )
-endforeach()
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(
- CGAL DEFAULT_MSG
- CGAL_INCLUDE_DIRS CGAL_LIBRARIES ${CGAL_COMPONENT_LIBRARIES}
-)
-
-mark_as_advanced( CGAL_LIBRARY_DIRS CGAL_LIBRARY_DEBUG ${CGAL_COMPONENT_LIBRARIES_DEBUG} )
-
-
-
no-matching-function-call.patch
Compatibility-with-gmpxx.patch
fix-gmpxx-compatibility-in-tests.patch
update-cmake-scripts.patch
remove-findcgal.patch
fix-IO-input-with-gmpxx.patch
the-polygons-of-the-convex-hull-are-always-triangulated.patch
Description: the polygons of the convex hull are always triangulated
Author: =?UTF-8?q?S=C3=A9bastien=20Loriot?= <sebastien.loriot@cgal.org>
Origin: https://github.com/Oslandia/SFCGAL/pull/157/commits/174dbb78303e6365bcf72ce920cb0a0c918b589b
--- a/test/unit/SFCGAL/algorithm/ConvexHullTest.cpp
+++ b/test/unit/SFCGAL/algorithm/ConvexHullTest.cpp
@@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE( testConvexHull3D_L
LineString lineString( points ) ;
std::auto_ptr< Geometry > hull( algorithm::convexHull3D( lineString ) );
BOOST_CHECK( hull->is< PolyhedralSurface >() );
- BOOST_CHECK_EQUAL( hull->as< PolyhedralSurface >().numPolygons(), 1U );
+ BOOST_CHECK_EQUAL( hull->as< PolyhedralSurface >().numPolygons(), 2U );
}
Description: update cmake scripts
Author: =?UTF-8?q?S=C3=A9bastien=20Loriot?= <sebastien.loriot@cgal.org>
Origin: https://github.com/Oslandia/SFCGAL/pull/157/commits/3bb19aaf2343ce13b6ce2a0a0d9d59db036e1e0e
Bug: https://github.com/Oslandia/SFCGAL/issues/145
Bug-Debian: https://bugs.debian.org/876521
--- a/test/garden/CMakeLists.txt
+++ b/test/garden/CMakeLists.txt
@@ -6,12 +6,10 @@ add_executable( ${REGRESS_NAME} ${SFCGAL
target_link_libraries( ${REGRESS_NAME}
SFCGAL
- ${Boost_LIBRARIES}
- ${CGAL_LIBRARIES}
+ CGAL::CGAL
+ CGAL::CGAL_Core
)
-if( ${SFCGAL_WITH_MPFR} )
- target_link_libraries( ${REGRESS_NAME} ${MPFR_LIBRARIES} )
-endif( ${SFCGAL_WITH_MPFR} )
+target_link_libraries( ${REGRESS_NAME} ${CGAL_3RD_PARTY_LIBRARIES} )
set_target_properties( ${REGRESS_NAME} PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS ${REGRESS_NAME} DESTINATION bin )
--- a/test/regress/convex_hull/CMakeLists.txt
+++ b/test/regress/convex_hull/CMakeLists.txt
@@ -6,12 +6,11 @@ add_executable( ${REGRESS_NAME} ${SFCGAL
target_link_libraries( ${REGRESS_NAME}
SFCGAL
- ${Boost_LIBRARIES}
- ${CGAL_LIBRARIES}
+ CGAL::CGAL
+ CGAL::CGAL_Core
)
-if( ${SFCGAL_WITH_MPFR} )
- target_link_libraries( ${REGRESS_NAME} ${MPFR_LIBRARIES} )
-endif( ${SFCGAL_WITH_MPFR} )
+
+target_link_libraries( ${REGRESS_NAME} ${CGAL_3RD_PARTY_LIBRARIES} )
set_target_properties( ${REGRESS_NAME} PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS ${REGRESS_NAME} DESTINATION bin )
--- a/test/regress/polygon_triangulator/CMakeLists.txt
+++ b/test/regress/polygon_triangulator/CMakeLists.txt
@@ -6,12 +6,11 @@ add_executable( ${REGRESS_NAME} ${SFCGAL
target_link_libraries( ${REGRESS_NAME}
SFCGAL
- ${Boost_LIBRARIES}
- ${CGAL_LIBRARIES}
+ CGAL::CGAL
+ CGAL::CGAL_Core
)
-if( ${SFCGAL_WITH_MPFR} )
- target_link_libraries( ${REGRESS_NAME} ${MPFR_LIBRARIES} )
-endif( ${SFCGAL_WITH_MPFR} )
+target_link_libraries( ${REGRESS_NAME} ${CGAL_3RD_PARTY_LIBRARIES})
+
set_target_properties( ${REGRESS_NAME} PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS ${REGRESS_NAME} DESTINATION bin )
--- a/test/regress/standalone/CMakeLists.txt
+++ b/test/regress/standalone/CMakeLists.txt
@@ -4,12 +4,11 @@ add_executable( standalone-regress-test-
target_link_libraries( standalone-regress-test-SFCGAL
SFCGAL
- ${Boost_LIBRARIES}
- ${CGAL_LIBRARIES}
+ CGAL::CGAL
+ CGAL::CGAL_Core
)
-if( ${SFCGAL_WITH_MPFR} )
- target_link_libraries( standalone-regress-test-SFCGAL ${MPFR_LIBRARIES} )
-endif( ${SFCGAL_WITH_MPFR} )
+target_link_libraries( standalone-regress-test-SFCGAL ${CGAL_3RD_PARTY_LIBRARIES} )
+
set_target_properties( standalone-regress-test-SFCGAL PROPERTIES DEBUG_POSTFIX "d" )
install( TARGETS standalone-regress-test-SFCGAL DESTINATION bin )
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -3,13 +3,10 @@ file( GLOB_RECURSE SFCGAL_UNIT_TEST_SOUR
add_executable( unit-test-SFCGAL ${SFCGAL_UNIT_TEST_SOURCES} )
target_link_libraries( unit-test-SFCGAL
SFCGAL
- ${Boost_LIBRARIES}
- ${CGAL_LIBRARIES}
+ CGAL::CGAL
+ CGAL::CGAL_Core
)
-if( ${SFCGAL_WITH_MPFR} )
- target_link_libraries( unit-test-SFCGAL ${MPFR_LIBRARIES} ${GMP_LIBRARIES} )
-endif( ${SFCGAL_WITH_MPFR} )
-
+target_link_libraries(unit-test-SFCGAL ${CGAL_3RD_PARTY_LIBRARIES})
#include( PrecompiledHeader )
#if(PCHSupport_FOUND)
......@@ -62,5 +62,5 @@ override_dh_makeshlibs:
dh_makeshlibs -- -c0 -v$(UPSTREAM_VERSION)
override_dh_strip:
dh_strip --dbg-package=sfcgal-dbg
dh_strip --dbgsym-migration='sfcgal-dbg (<< 1.3.3)'
......@@ -266,10 +266,17 @@ private:
Kernel::FT _roundFT( const Kernel::FT& v ) const {
#ifdef CGAL_USE_GMPXX
::mpq_class q( SFCGAL::round( v.exact() * _scaleFactor ),
_scaleFactor) ;
q.canonicalize();
return Kernel::FT(q);
#else
return Kernel::FT( CGAL::Gmpq(
SFCGAL::round( v.exact() * _scaleFactor ),
_scaleFactor
) ) ;
#endif
}
};
......
......@@ -169,5 +169,53 @@ void load( boost::archive::binary_iarchive& ar, CGAL::Gmpz& z, const unsigned in
}
}
#ifdef CGAL_USE_GMPXX
void save( boost::archive::text_oarchive& ar, const mpz_class& z, const unsigned int /*version*/ )
{
std::ostringstream ostr;
ostr << z;
std::string str = ostr.str();
ar << str;
}
// specialization for binary archives
void save ( boost::archive::binary_oarchive& ar, const mpz_class& z, const unsigned int/* version*/ )
{
mpz_srcptr mpz = z.get_mpz_t();
int32_t size = mpz->_mp_size;
ar& size;
uint32_t rsize = size >= 0 ? size : -size;
for ( uint32_t i = 0; i < rsize; ++i ) {
ar& mpz->_mp_d[i];
}
}
void load( boost::archive::text_iarchive& ar, mpz_class& z, const unsigned int /*version*/ )
{
std::string line;
ar >> line;
std::istringstream istr( line );
istr >> z;
}
void load( boost::archive::binary_iarchive& ar, mpz_class& z, const unsigned int /*version*/ )
{
int32_t size;
uint32_t rsize;
mpz_ptr mpz = z.get_mpz_t();
ar& size;
rsize = size >= 0 ? size : -size;
mpz->_mp_size = size;
_mpz_realloc( mpz, rsize );
uint32_t i;
for ( i = 0; i < rsize; ++i ) {
ar& mpz->_mp_d[i];
}
}
#endif
}
}
......@@ -34,6 +34,10 @@
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#ifdef CGAL_USE_GMPXX
#include <CGAL/mpz_class.h>
#include <CGAL/mpq_class.h>
#endif
namespace SFCGAL {
......@@ -132,6 +136,63 @@ void serialize( Archive& ar, CGAL::Gmpq& q, const unsigned int version )
split_free( ar, q, version );
}
#ifdef CGAL_USE_GMPXX
/**
* Serialization of mpz_class for text archives
*/
SFCGAL_API void save( boost::archive::text_oarchive& ar, const mpz_class& z, const unsigned int version );
/**
* Serialization of mpz_class for binary archives
*/
SFCGAL_API void save ( boost::archive::binary_oarchive& ar, const mpz_class& z, const unsigned int version );
/**
* Unserialization of mpz_class for text archives
*/
SFCGAL_API void load( boost::archive::text_iarchive& ar, mpz_class& z, const unsigned int version );
/**
* Unserialization of mpz_class for binary archives
*/
SFCGAL_API void load( boost::archive::binary_iarchive& ar, mpz_class& z, const unsigned int version );
template<class Archive>
void serialize( Archive& ar, mpz_class& z, const unsigned int version )
{
split_free( ar, z, version );
}
/**
* Serializer of mpq_class
*/
template<class Archive>
void save( Archive& ar, const mpq_class& q, const unsigned int /*version*/ )
{
mpz_class n = q.get_num();
mpz_class d = q.get_den();
ar& n;
ar& d;
}
/**
* Unserializer of mpq_class
*/
template<class Archive>
void load( Archive& ar, mpq_class& q, const unsigned int /*version*/ )
{
mpz_class n;
mpz_class d;
ar& n;
ar& d;
q = mpq_class( n, d );
}
template<class Archive>
void serialize( Archive& ar, mpq_class& q, const unsigned int version )
{
split_free( ar, q, version );
}
#endif
/**
* Serializer of Kernel::FT
......
......@@ -647,7 +647,7 @@ bool WktReader::readPointCoordinate( Point& p )
}
p = Point( coordinates[0], coordinates[1], coordinates[2] );
p.setM( coordinates[3].to_double() );
p.setM( CGAL::to_double(coordinates[3]) );
}
else if ( _isMeasured && ! _is3D ) {
// XYM
......@@ -656,7 +656,7 @@ bool WktReader::readPointCoordinate( Point& p )
}
p = Point( coordinates[0], coordinates[1] );
p.setM( coordinates[2].to_double() );
p.setM( CGAL::to_double(coordinates[2]) );
}
else if ( coordinates.size() == 3 ) {
// XYZ
......
......@@ -40,6 +40,22 @@ namespace SFCGAL {
namespace detail {
namespace io {
namespace impl {
std::ostream& writeFT(std::ostream& s, const CGAL::Gmpq& ft)
{
s << ft;
return s;
}
#ifdef CGAL_USE_GMPXX
std::ostream& writeFT(std::ostream& s, const mpq_class& ft)
{
s << ft.get_num() << "/" << ft.get_den();
return s;
}
#endif
} //end of impl namespace
///
///
///
......@@ -135,10 +151,12 @@ void WktWriter::writeCoordinateType( const Geometry& g )
void WktWriter::writeCoordinate( const Point& g )
{
if ( _exactWrite ) {
_s << CGAL::exact( g.x() ) << " " << CGAL::exact( g.y() );
impl::writeFT(_s, CGAL::exact( g.x() )) << " ";
impl::writeFT(_s, CGAL::exact( g.y() ));
if ( g.is3D() ) {
_s << " " << CGAL::exact( g.z() );
_s << " ";
impl::writeFT(_s, CGAL::exact( g.z() ));
}
}
else {
......