summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2012-07-13 01:40:07 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2012-07-13 01:40:07 (GMT)
commit018211a863ec8e1098a887641dd1c7e5ffd2d2f7 (patch)
tree6e9626c58abd2a9f2f0c35ad7c08b57ae2fb118b /src
parentb960247d284ed7b8fea386c303895673bdc12fb6 (diff)
check versions of libraries at compile time - warn users. fix FIXME in openscad.pro
Diffstat (limited to 'src')
-rw-r--r--src/cgal.h5
-rw-r--r--src/version_check.cc2
-rw-r--r--src/version_check.h107
3 files changed, 109 insertions, 5 deletions
diff --git a/src/cgal.h b/src/cgal.h
index 9810340..e5e39dd 100644
--- a/src/cgal.h
+++ b/src/cgal.h
@@ -11,11 +11,6 @@ using boost::intmax_t;
using boost::uintmax_t;
#endif
-#include <CGAL/version.h>
-#if CGAL_VERSION_NR < 1030601000
- #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.
diff --git a/src/version_check.cc b/src/version_check.cc
new file mode 100644
index 0000000..87dfeeb
--- /dev/null
+++ b/src/version_check.cc
@@ -0,0 +1,2 @@
+#include "version_check.h"
+
diff --git a/src/version_check.h b/src/version_check.h
new file mode 100644
index 0000000..45e00ec
--- /dev/null
+++ b/src/version_check.h
@@ -0,0 +1,107 @@
+// version_check.h copyright 2012 don bright. released under the GPL 2, or
+// later, as described in the file named 'COPYING' in OpenSCAD's project root.
+
+/* This file will check versions of libraries at compile time. If they
+are too old, the user will be warned. If the user wishes to force
+compilation, they can run
+
+ qmake CONFIG=skip-version-check
+
+Otherwise they will be guided to README.md and an -build-dependencies script.
+
+The extensive #else #endif is to ensure only a single error is printed at
+a time, to avoid confusion.
+*/
+
+#ifndef OPENSCAD_SKIP_VERSION_CHECK
+
+
+#include <gmp.h>
+// set minimum numbers here.
+#define GMPMAJOR 5
+#define GMPMINOR 0
+#define GMPPATCH 0
+#define SYS_GMP_VER (__GNU_MP_VERSION * 10000 + __GNU_MP_VERSION_MINOR * 100 + __GNU_MP_VERSION_PATCHLEVEL * 1)
+#if SYS_GMP_VER < GMPMAJOR * 10000 + GMPMINOR * 100 + GMPPATCH * 1
+#error GNU GMP library missing or version too old. See README.md. To force compile, run qmake CONFIG=skip-version-check
+#else
+
+
+#include <mpfr.h>
+#if MPFR_VERSION < MPFR_VERSION_NUM( 3,0,0 )
+#error GNU MPFR library missing or version too old. See README.md. To force compile, run qmake CONFIG=skip-version-check
+#else
+
+
+#include <Eigen/Core>
+#if not EIGEN_VERSION_AT_LEAST( 2,0,13 )
+#error eigen2 library missing or version too old. See README.md. To force compile, run qmake CONFIG=skip-version-check
+#else
+
+
+#include <boost/version.hpp>
+// boost 1.3.5 = 103500
+#if BOOST_VERSION < 103500
+#error boost library missing or version too old. See README.md. To force compile, run qmake CONFIG=skip-version-check
+#else
+
+
+#ifdef ENABLE_CGAL
+#include <CGAL/version.h>
+
+#if CGAL_VERSION_NR < 1030601000
+#error CGAL library missing or version too old. See README.md. To force compile, run qmake CONFIG=skip-version-check
+#else
+
+#if CGAL_VERSION_NR < 1040001000
+#warning "======================="
+#warning "."
+#warning "."
+#warning "."
+#warning "."
+#warning CGAL library version is old, risking buggy behavior. Please see README.md. Compiling anyway.
+#warning "."
+#warning "."
+#warning "."
+#warning "."
+#warning "======================="
+#endif // CGAL_VERSION_NR < 10400010000
+#endif //ENABLE_CGAL
+
+#ifdef ENABLE_OPENCSG
+#include <GL/glew.h>
+// kludge - GLEW doesnt have compiler-accessible version numbering
+#ifndef GLEW_ARB_occlusion_query2
+#error GLEW library missing or version too old. See README.md. To force compile, run qmake CONFIG=skip-version-check
+#else
+
+
+#include <opencsg.h>
+// 1.3.2 -> 0x0132
+#if OPENCSG_VERSION < 0x0132
+#error OPENCSG library missing or version too old. See README.md. To force compile, run qmake CONFIG=skip-version-check
+#else
+#endif // ENABLE_OPENCSG
+
+#include <QtCore/qglobal.h>
+#if QT_VERSION < 0x040603
+#error QT library missing or version too old. See README.md. To force compile, run qmake CONFIG=skip-version-check
+#endif // QT
+
+
+#ifdef ENABLE_OPENCSG
+#endif // OpenCSG
+#endif // GLEW
+#endif // ENABLE_OPENCSG
+
+#ifdef ENABLE_CGAL
+#endif // CGAL error
+#endif // ENABLE_CGAL
+
+#endif // Boost
+#endif // Eigen2
+#endif // MPFR
+#endif // GMP
+
+#endif // OPENSCAD_SKIP_VERSION_CHECK
+
contact: Jan Huwald // Impressum