Skip to content

Commit 204c325

Browse files
committed
make older cgal versions work, too
1 parent c1c59c6 commit 204c325

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/generate_from_off.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
1717
#include <CGAL/Polygon_mesh_processing/orientation.h>
1818

19+
#include <CGAL/version_macros.h>
20+
21+
#if CGAL_VERSION_MAJOR >= 5 && CGAL_VERSION_MINOR < 3
22+
#include <CGAL/IO/OFF_reader.h>
23+
#endif
24+
1925
// for sharp features
2026
//#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
2127

@@ -68,8 +74,15 @@ void generate_from_off(
6874
std::vector<K::Point_3> points;
6975
std::vector<std::vector<std::size_t> > polygons;
7076

71-
// CGAL::IO::read_OFF used to be CGAL::read_OFF in CGAL 5.2 and earlier
72-
if(!input || !CGAL::IO::read_OFF(input, points, polygons) || points.empty())
77+
if(
78+
!input ||
79+
#if CGAL_VERSION_MAJOR >= 5 && CGAL_VERSION_MINOR >= 3
80+
!CGAL::IO::read_OFF(input, points, polygons) ||
81+
#else
82+
!CGAL::read_OFF(input, points, polygons) ||
83+
#endif
84+
points.empty()
85+
)
7386
{
7487
std::stringstream msg;
7588
msg << "Cannot read .off file \"" << infile <<"\""<< std::endl;

0 commit comments

Comments
 (0)