1
0
Fork 0

Make sure we can still use CGAL<4.5 as well

This commit is contained in:
Christian Schmitt 2014-12-28 17:57:14 +01:00
parent 95830a9a98
commit 803c618b21
5 changed files with 24 additions and 16 deletions

View file

@ -96,13 +96,18 @@ find_package(SimGear 3.1.0 REQUIRED)
find_package(GDAL 1.6.0 REQUIRED) find_package(GDAL 1.6.0 REQUIRED)
find_package(TIFF REQUIRED) # needed for SRTM find_package(TIFF REQUIRED) # needed for SRTM
set (CGAL_MINIMUM 4.0)
set (CGAL_OLD 0)
find_package(CGAL COMPONENTS Core REQUIRED) find_package(CGAL COMPONENTS Core REQUIRED)
if (CGAL_FOUND) if (CGAL_FOUND)
if(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS 4.0) if(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS ${CGAL_MINIMUM})
message(FATAL_ERROR "CGAL >= 4.0 is required. Found ${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}") message(FATAL_ERROR "CGAL >= ${CGAL_MINIMUM} is required. Found CGAL ${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}")
else(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS 4.0) else(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS ${CGAL_MINIMUM})
message(STATUS "Found CGAL ${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}") message(STATUS "Found CGAL ${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}")
endif(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS 4.0) if(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS 4.5)
set (CGAL_OLD 1)
endif()
endif(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS ${CGAL_MINIMUM})
endif (CGAL_FOUND) endif (CGAL_FOUND)
include ( ${CGAL_USE_FILE} ) include ( ${CGAL_USE_FILE} )

View file

@ -2,5 +2,4 @@
#cmakedefine HAVE_WINDOWS_H #cmakedefine HAVE_WINDOWS_H
#cmakedefine HAVE_RINT #cmakedefine HAVE_RINT
#cmakedefine HAVE_UNISTD_H #cmakedefine HAVE_UNISTD_H
#cmakedefine CGAL_OLD

View file

@ -1,3 +1,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include "tg_nodes.hxx" #include "tg_nodes.hxx"
@ -81,7 +85,7 @@ bool TGNodes::get_geod_edge( const SGBucket& b, std::vector<SGGeod>& north, std:
// Three dimensional queries is a bit overkill, but the code, although faster, is slightly more cumbersome // Three dimensional queries is a bit overkill, but the code, although faster, is slightly more cumbersome
// get function for the property map - needed for cgal trait extension // get function for the property map - needed for cgal trait extension
#if 0 #ifdef CGAL_OLD
My_point_property_map::reference get(My_point_property_map, My_point_property_map::key_type p) { My_point_property_map::reference get(My_point_property_map, My_point_property_map::key_type p) {
return boost::get<0>(p); return boost::get<0>(p);
} }
@ -256,4 +260,4 @@ void TGNodes::SaveToGzFile( gzFile& fp )
void TGNodes::LoadFromGzFile( gzFile& fp ) void TGNodes::LoadFromGzFile( gzFile& fp )
{ {
tg_node_list.LoadFromGzFile( fp ); tg_node_list.LoadFromGzFile( fp );
} }

View file

@ -1,8 +1,8 @@
#ifndef _TG_NODES_HXX #ifndef _TG_NODES_HXX
#define _TG_NODES_HXX #define _TG_NODES_HXX
#ifndef __cplusplus #ifdef HAVE_CONFIG_H
# error This library requires C++ # include <config.h>
#endif #endif
#include <cstdlib> #include <cstdlib>
@ -20,7 +20,7 @@ typedef Kernel::Point_2 Point;
typedef boost::tuple<Point, double> Point_and_Elevation; typedef boost::tuple<Point, double> Point_and_Elevation;
//definition of the property map //definition of the property map
#if 0 #ifdef CGAL_OLD
struct My_point_property_map{ struct My_point_property_map{
typedef Point value_type; typedef Point value_type;
typedef const value_type& reference; typedef const value_type& reference;
@ -31,8 +31,12 @@ struct My_point_property_map{
//typedef CGAL::Search_traits_2<Kernel> Traits; //typedef CGAL::Search_traits_2<Kernel> Traits;
typedef CGAL::Search_traits_2<Kernel> Traits_base; typedef CGAL::Search_traits_2<Kernel> Traits_base;
//typedef CGAL::Search_traits_adapter<Point_and_Elevation, My_point_property_map, Traits_base> Traits;
#ifdef CGAL_OLD
typedef CGAL::Search_traits_adapter<Point_and_Elevation, My_point_property_map, Traits_base> Traits;
#else
typedef CGAL::Search_traits_adapter<Point_and_Elevation,CGAL::Nth_of_tuple_property_map<0, Point_and_Elevation>,Traits_base> Traits; typedef CGAL::Search_traits_adapter<Point_and_Elevation,CGAL::Nth_of_tuple_property_map<0, Point_and_Elevation>,Traits_base> Traits;
#endif
typedef CGAL::Fuzzy_iso_box<Traits> Fuzzy_bb; typedef CGAL::Fuzzy_iso_box<Traits> Fuzzy_bb;
typedef CGAL::Kd_tree<Traits> Tree; typedef CGAL::Kd_tree<Traits> Tree;

View file

@ -22,10 +22,6 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
// //
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/bucket/newbucket.hxx> #include <simgear/bucket/newbucket.hxx>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>