summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-12-06 00:43:44 (GMT)
committerMarius Kintel <marius@kintel.net>2011-12-06 00:43:44 (GMT)
commitbb0ec94290733835df0716531c30460fc5b5210a (patch)
tree97e0c552ac7d7a19d9819a89c9277e461ff7c074
parent65a5aa23bfd78718972082f82eb7366d01a968a6 (diff)
#undef NDEBUG before including any CGAL headers
-rw-r--r--src/CGALEvaluator.cc10
-rw-r--r--src/CGAL_Nef_polyhedron.cc1
-rw-r--r--src/cgal.h19
-rw-r--r--src/cgaladv_minkowski2.cc3
-rw-r--r--src/cgalutils.cc2
-rw-r--r--src/dxftess-cgal.cc13
-rw-r--r--src/openscad.cc1
-rw-r--r--tests/cgalpngtest.cc4
8 files changed, 36 insertions, 17 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc
index 78b9c78..1772354 100644
--- a/src/CGALEvaluator.cc
+++ b/src/CGALEvaluator.cc
@@ -16,9 +16,15 @@
#include "CGALCache.h"
#include "cgal.h"
#include "cgalutils.h"
-#include <CGAL/assertions_behaviour.h>
-#include <CGAL/exceptions.h>
+
+#ifdef NDEBUG
+#define PREV_NDEBUG NDEBUG
+#undef NDEBUG
+#endif
#include <CGAL/convex_hull_3.h>
+#ifdef PREV_NDEBUG
+#define NDEBUG PREV_NDEBUG
+#endif
#include <string>
#include <map>
diff --git a/src/CGAL_Nef_polyhedron.cc b/src/CGAL_Nef_polyhedron.cc
index 61ca2f8..8c65777 100644
--- a/src/CGAL_Nef_polyhedron.cc
+++ b/src/CGAL_Nef_polyhedron.cc
@@ -5,7 +5,6 @@
#include "polyset.h"
#include "dxfdata.h"
#include "dxftess.h"
-#include <CGAL/minkowski_sum_3.h>
CGAL_Nef_polyhedron::CGAL_Nef_polyhedron(CGAL_Nef_polyhedron2 *p)
{
diff --git a/src/cgal.h b/src/cgal.h
index 669e5b1..9810340 100644
--- a/src/cgal.h
+++ b/src/cgal.h
@@ -16,6 +16,16 @@ using boost::uintmax_t;
#error CGAL >= 3.6 is required!
#endif
+// NDEBUG must be disabled when including CGAL headers, otherwise CGAL assertions
+// will not be thrown, causing OpenSCAD's CGAL error checking to fail.
+// To be on the safe side, this has to be done when including any CGAL header file.
+// FIXME: It might be possible to rewrite the error checking to get rid of this
+// requirement. kintel 20111206.
+#ifdef NDEBUG
+#define PREV_NDEBUG NDEBUG
+#undef NDEBUG
+#endif
+
#include <CGAL/Gmpq.h>
#include <CGAL/Extended_cartesian.h>
#include <CGAL/Nef_polyhedron_2.h>
@@ -26,6 +36,11 @@ using boost::uintmax_t;
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/Polygon_with_holes_2.h>
+#include <CGAL/minkowski_sum_2.h>
+#include <CGAL/minkowski_sum_3.h>
+
+#include <CGAL/assertions_behaviour.h>
+#include <CGAL/exceptions.h>
typedef CGAL::Gmpq NT;
typedef CGAL::Extended_cartesian<NT> CGAL_Kernel2;
@@ -44,6 +59,10 @@ typedef CGAL::Polyhedron_3<CGAL_Kernel3> CGAL_Polyhedron;
typedef CGAL_Polyhedron::HalfedgeDS CGAL_HDS;
typedef CGAL::Polyhedron_incremental_builder_3<CGAL_HDS> CGAL_Polybuilder;
+#ifdef PREV_NDEBUG
+#define NDEBUG PREV_NDEBUG
+#endif
+
#endif /* ENABLE_CGAL */
#endif
diff --git a/src/cgaladv_minkowski2.cc b/src/cgaladv_minkowski2.cc
index 4ce684f..583217b 100644
--- a/src/cgaladv_minkowski2.cc
+++ b/src/cgaladv_minkowski2.cc
@@ -30,9 +30,6 @@
#include "grid.h"
#include "cgal.h"
-
-#include <CGAL/minkowski_sum_2.h>
-
extern CGAL_Poly2 nef2p2(CGAL_Nef_polyhedron2 p);
//-----------------------------------------------------------------------------
diff --git a/src/cgalutils.cc b/src/cgalutils.cc
index 1de7ab4..64782fb 100644
--- a/src/cgalutils.cc
+++ b/src/cgalutils.cc
@@ -5,8 +5,6 @@
#include "printutils.h"
#include "cgal.h"
-#include <CGAL/assertions_behaviour.h>
-#include <CGAL/exceptions.h>
#include <map>
diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc
index cf5b75d..5b4e953 100644
--- a/src/dxftess-cgal.cc
+++ b/src/dxftess-cgal.cc
@@ -3,15 +3,22 @@
#include "dxfdata.h"
#include "polyset.h"
#include "grid.h"
+#include "cgal.h"
+#ifdef NDEBUG
+#define PREV_NDEBUG NDEBUG
+#undef NDEBUG
+#endif
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Delaunay_mesher_2.h>
#include <CGAL/Delaunay_mesher_no_edge_refinement_2.h>
#include <CGAL/Delaunay_mesh_face_base_2.h>
#include <CGAL/Delaunay_mesh_criteria_2.h>
-#include <CGAL/assertions_behaviour.h>
-#include <CGAL/exceptions.h>
+#include <CGAL/Mesh_2/Face_badness.h>
+#ifdef PREV_NDEBUG
+#define NDEBUG PREV_NDEBUG
+#endif
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
@@ -23,8 +30,6 @@ typedef CGAL::Constrained_Delaunay_triangulation_2<K, Tds> CDT;
typedef CDT::Vertex_handle Vertex_handle;
typedef CDT::Point CDTPoint;
-#include <CGAL/Mesh_2/Face_badness.h>
-
#include <boost/unordered_map.hpp>
template <class T> class DummyCriteria {
diff --git a/src/openscad.cc b/src/openscad.cc
index 67112d8..0d5b25e 100644
--- a/src/openscad.cc
+++ b/src/openscad.cc
@@ -42,7 +42,6 @@
#ifdef ENABLE_CGAL
#include "CGAL_Nef_polyhedron.h"
-#include <CGAL/assertions_behaviour.h>
#include "CGALEvaluator.h"
#include "PolySetCGALEvaluator.h"
#endif
diff --git a/tests/cgalpngtest.cc b/tests/cgalpngtest.cc
index fcc5977..800a829 100644
--- a/tests/cgalpngtest.cc
+++ b/tests/cgalpngtest.cc
@@ -54,10 +54,6 @@
#include <assert.h>
#include <sstream>
-#ifdef ENABLE_CGAL
-#include <CGAL/assertions_behaviour.h>
-#endif
-
std::string commandline_commands;
QString currentdir;
QString examplesdir;
contact: Jan Huwald // Impressum