Skip to content

Commit

Permalink
Merge branch 'fix_gmpxx' into 'master'
Browse files Browse the repository at this point in the history
Allow to disable GMPXX

Closes #252 and #249

See merge request Oslandia/SFCGAL!286
  • Loading branch information
lbartoletti committed Sep 26, 2023
2 parents fc4dc56 + b1d7176 commit 35f72d2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,25 @@ endif ()
#-----------------------------------------------------------

#-- find CGAL ---------------------------------------------
if( CGAL_USE_GMPXX )
add_definitions( "-DCGAL_USE_GMPXX" )
endif()
option( CGAL_USE_AUTOLINK "disable CGAL autolink" OFF )

if( ${CGAL_USE_AUTOLINK} )
add_definitions( "-DCGAL_NO_AUTOLINK" )
endif()

find_package( CGAL 5.3 COMPONENTS Core REQUIRED )
message( STATUS "CGAL ${CGAL_VERSION} found" )

# For CGAL >= 5
add_definitions( "-DCGAL_USE_GMPXX=1" )

include_directories( ${CMAKE_BINARY_DIR}/include )

#-- BOOST --------------------------------------------------
if( NOT CGAL_USE_GMPXX )
add_definitions( "-DCGAL_DO_NOT_USE_BOOST_MP" )
endif()

option( Boost_USE_AUTO_LINK "boost use autolink" OFF )
if( NOT ${Boost_USE_AUTO_LINK} )
add_definitions( "-DBOOST_ALL_NO_LIB" )
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ set_target_properties( SFCGAL PROPERTIES VERSION ${SFCGAL_VERSION}

target_link_libraries( SFCGAL CGAL::CGAL CGAL::CGAL_Core)

if( "${CGAL_VERSION}" VERSION_GREATER_EQUAL "5.0.0")
if( CGAL_USE_GMPXX )
target_link_libraries( SFCGAL gmpxx )
endif()

Expand Down
13 changes: 13 additions & 0 deletions src/algorithm/translate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,18 @@ translate(Geometry &g, const Kernel::FT dx, const Kernel::FT dy,
translate(g, Kernel::Vector_3(dx, dy, dz));
}

///
///
///
void
translate(Geometry &g, const double &dx, const double &dy, const double &dz)
{
if (!std::isfinite(dx) || !std::isfinite(dy) || !std::isfinite(dz)) {
BOOST_THROW_EXCEPTION(NonFiniteValueException(
"trying to translate with non finite value in direction"));
}

return translate(g, Kernel::FT(dx), Kernel::FT(dy), Kernel::FT(dz));
}
} // namespace algorithm
} // namespace SFCGAL
7 changes: 7 additions & 0 deletions src/algorithm/translate.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ SFCGAL_API void
translate(Geometry &g, const Kernel::FT dx, const Kernel::FT dy,
const Kernel::FT dz);

/**
* @brief translate a geometry from double-coordinates
* @todo unittest
*/
SFCGAL_API void
translate(Geometry &g, const double &dx, const double &dy, const double &dz);

} // namespace algorithm
} // namespace SFCGAL

Expand Down
1 change: 0 additions & 1 deletion test/unit/SFCGAL/KernelTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <boost/test/unit_test.hpp>

#include <SFCGAL/Kernel.h>
#include <CGAL/mpq_class.h>
#include <SFCGAL/Coordinate.h>
#include <SFCGAL/LineString.h>

Expand Down

0 comments on commit 35f72d2

Please sign in to comment.