From 51ae2483733a75c8e7fbaa8abe7f7b0a999c1db0 Mon Sep 17 00:00:00 2001 From: clifford Date: Mon, 1 Feb 2010 10:01:05 +0000 Subject: [PATCH] Clifford Wolf: Fixed building without CGAL git-svn-id: http://svn.clifford.at/openscad/trunk@406 b57f626f-c46c-0410-a088-ec61d464b74c --- src/dxfdata.h | 2 ++ src/dxflinextrude.cc | 5 +++++ src/dxfrotextrude.cc | 5 +++++ src/dxftess.cc | 5 ++--- src/mainwin.cc | 2 ++ src/nef2dxf.cc | 3 +++ src/projection.cc | 14 ++++++++++++++ 7 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/dxfdata.h b/src/dxfdata.h index e88fafd955..d59ff5ac7a 100644 --- a/src/dxfdata.h +++ b/src/dxfdata.h @@ -39,7 +39,9 @@ class DxfData DxfData(); DxfData(double fn, double fs, double fa, QString filename, QString layername = QString(), double xorigin = 0.0, double yorigin = 0.0, double scale = 1.0); +#ifdef ENABLE_CGAL DxfData(const struct CGAL_Nef_polyhedron &N); +#endif Point *addPoint(double x, double y); diff --git a/src/dxflinextrude.cc b/src/dxflinextrude.cc index 0542493d37..f1aaf8cc66 100644 --- a/src/dxflinextrude.cc +++ b/src/dxflinextrude.cc @@ -233,6 +233,7 @@ PolySet *DxfLinearExtrudeNode::render_polyset(render_mode_e rm) const if (filename.isEmpty()) { +#ifdef ENABLE_CGAL QTime t; QProgressDialog *pd = NULL; @@ -268,6 +269,10 @@ PolySet *DxfLinearExtrudeNode::render_polyset(render_mode_e rm) const PRINTF_NOCACHE("..rendering time: %d hours, %d minutes, %d seconds", s / (60*60), (s / 60) % 60, s % 60); delete pd; } +#else // ENABLE_CGAL + PRINT("WARNING: Found linear_extrude() statement without dxf file but compiled without CGAL support!"); + dxf = new DxfData(); +#endif // ENABLE_CGAL } else { dxf = new DxfData(fn, fs, fa, filename, layername, origin_x, origin_y, scale); } diff --git a/src/dxfrotextrude.cc b/src/dxfrotextrude.cc index ae43f53398..21718ac28e 100644 --- a/src/dxfrotextrude.cc +++ b/src/dxfrotextrude.cc @@ -136,6 +136,7 @@ PolySet *DxfRotateExtrudeNode::render_polyset(render_mode_e rm) const if (filename.isEmpty()) { +#ifdef ENABLE_CGAL QTime t; QProgressDialog *pd; @@ -169,6 +170,10 @@ PolySet *DxfRotateExtrudeNode::render_polyset(render_mode_e rm) const PRINTF_NOCACHE("..rendering time: %d hours, %d minutes, %d seconds", s / (60*60), (s / 60) % 60, s % 60); delete pd; } +#else // ENABLE_CGAL + PRINT("WARNING: Found rotate_extrude() statement without dxf file but compiled without CGAL support!"); + dxf = new DxfData(); +#endif // ENABLE_CGAL } else { dxf = new DxfData(fn, fs, fa, filename, layername, origin_x, origin_y, scale); } diff --git a/src/dxftess.cc b/src/dxftess.cc index c51fb9cb49..e1453910de 100644 --- a/src/dxftess.cc +++ b/src/dxftess.cc @@ -25,12 +25,11 @@ #include "printutils.h" -#define CGAL_TESSELATE -#ifdef CGAL_TESSELATE +#ifdef ENABLE_CGAL #include "dxftess-cgal.cc" #else #include "dxftess-glu.cc" -#endif // CGAL_TESSELATE +#endif /*! Converts all paths in the given DxfData to PolySet::borders polygons diff --git a/src/mainwin.cc b/src/mainwin.cc index 9ee4d9d34f..a0ce9b0465 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1215,7 +1215,9 @@ void MainWindow::actionExportDXF() void MainWindow::actionFlushCaches() { PolySet::ps_cache.clear(); +#ifdef ENABLE_CGAL AbstractNode::cgal_nef_cache.clear(); +#endif dxf_dim_cache.clear(); dxf_cross_cache.clear(); } diff --git a/src/nef2dxf.cc b/src/nef2dxf.cc index 5df8a45a05..44d7561f65 100644 --- a/src/nef2dxf.cc +++ b/src/nef2dxf.cc @@ -27,6 +27,8 @@ #include "grid.h" #include "cgal.h" +#ifdef ENABLE_CGAL + DxfData::DxfData(const struct CGAL_Nef_polyhedron &N) { Grid2d grid(GRID_COARSE); @@ -70,3 +72,4 @@ DxfData::DxfData(const struct CGAL_Nef_polyhedron &N) fixup_path_direction(); } +#endif // ENABLE_CGAL diff --git a/src/projection.cc b/src/projection.cc index 77b7bf943a..75aaf44c47 100644 --- a/src/projection.cc +++ b/src/projection.cc @@ -93,6 +93,8 @@ void register_builtin_projection() builtin_modules["projection"] = new ProjectionModule(); } +#ifdef ENABLE_CGAL + static void report_func(const class AbstractNode*, void *vp, int mark) { QProgressDialog *pd = (QProgressDialog*)vp; @@ -291,6 +293,18 @@ PolySet *ProjectionNode::render_polyset(render_mode_e rm) const return ps; } +#else // ENABLE_CGAL + +PolySet *ProjectionNode::render_polyset(render_mode_e) const +{ + PRINT("WARNING: Found projection() statement but compiled without CGAL support!"); + PolySet *ps = new PolySet(); + ps->is2d = true; + return ps; +} + +#endif // ENABLE_CGAL + QString ProjectionNode::dump(QString indent) const { if (dump_cache.isEmpty()) {