Some modification of CGAL Graphic view to a better compatibility of Windows with the Qt5 version of CGAL (especially about dll import and export stuff).

This commit is contained in:
Aurelien Vialon 2014-07-17 01:55:07 +02:00
parent a3a84ce2e8
commit c3aaf0bffe
14 changed files with 79 additions and 53 deletions

View File

@ -20,8 +20,6 @@ if(USE_QT5)
find_package(Qt5) find_package(Qt5)
else (USE_QT5) else (USE_QT5)
find_package(CGAL COMPONENTS Core Qt4 ) find_package(CGAL COMPONENTS Core Qt4 )
@ -45,13 +43,14 @@ if ( CGAL_FOUND AND (QT4 OR QT5) )
# Arrangement package includes # Arrangement package includes
include_directories( BEFORE ../../include ) include_directories( BEFORE ../../include )
if(QT4)
qt_wrap_ui( arrangement_2_uis qt_wrap_ui( arrangement_2_uis
ArrangementDemoWindow.ui ArrangementDemoWindow.ui
# NewTabDialog.ui NewTabDialog.ui
OverlayDialog.ui OverlayDialog.ui
ArrangementDemoPropertiesDialog.ui ArrangementDemoPropertiesDialog.ui
) )
if(QT4)
qt_wrap_cpp( arrangement_2_mocs qt_wrap_cpp( arrangement_2_mocs
ArrangementDemoWindow.h ArrangementDemoWindow.h
ArrangementDemoTab.h ArrangementDemoTab.h
@ -64,7 +63,7 @@ if ( CGAL_FOUND AND (QT4 OR QT5) )
PropertyValueDelegate.h PropertyValueDelegate.h
# PropertyValueDelegate.cpp # PropertyValueDelegate.cpp
) )
endif(QT4) endif()
qt_add_resources( arrangement_2_resources qt_add_resources( arrangement_2_resources
ArrangementDemoWindow.qrc ArrangementDemoWindow.qrc

View File

@ -17,20 +17,20 @@
// //
// Author(s) : Laurent Rineau // Author(s) : Laurent Rineau
#ifndef CGAL_QT4_CONFIG_H #ifndef CGAL_QT_CONFIG_H
#define CGAL_QT4_CONFIG_H #define CGAL_QT_CONFIG_H
#include <QtCore/qglobal.h> #include <QtCore/qglobal.h>
#if defined(CGAL_Qt4_DLL) || defined(CGAL_Qt5_DLL) #if defined(CGAL_Qt4_DLL) || defined(CGAL_Qt5_DLL)
# if defined(CGAL_Qt4_EXPORTS) || defined(CGAL_Qt5_EXPORTS) # if defined(CGAL_Qt4_EXPORTS) || defined(CGAL_Qt5_EXPORTS)
# define CGAL_QT4_EXPORT Q_DECL_EXPORT # define CGAL_QT_EXPORT Q_DECL_EXPORT
# else # else
# define CGAL_QT4_EXPORT Q_DECL_IMPORT # define CGAL_QT_EXPORT Q_DECL_IMPORT
# endif # endif
#else #else
// empty definition // empty definition
# define CGAL_QT4_EXPORT # define CGAL_QT_EXPORT
#endif #endif
#endif // CGAL_QT4_CONFIG_H #endif // CGAL_QT_CONFIG_H

View File

@ -28,7 +28,7 @@
#include <list> #include <list>
#include <CGAL/intersection_2.h> #include <CGAL/intersection_2.h>
#include <CGAL/auto_link/Qt4.h> #include <CGAL/auto_link/Qt.h>
#include <boost/mpl/has_xxx.hpp> #include <boost/mpl/has_xxx.hpp>
@ -182,6 +182,6 @@ public:
}; };
} // namesapce Qt } // namespace Qt
} // namespace CGAL } // namespace CGAL
#endif // CGAL_QT_CONVERTER_H #endif // CGAL_QT_CONVERTER_H

View File

@ -26,8 +26,9 @@
#include <QMainWindow> #include <QMainWindow>
#include <QDragEnterEvent> #include <QDragEnterEvent>
#include <QDropEvent> #include <QDropEvent>
#include <CGAL/auto_link/Qt4.h>
#include <CGAL/export/Qt4.h> #include <CGAL/auto_link/Qt.h>
#include <CGAL/export/Qt.h>
#include <CGAL/Qt/resources.h> #include <CGAL/Qt/resources.h>
// forward declaration // forward declaration
@ -42,7 +43,7 @@ namespace Qt {
// forward declaration // forward declaration
class GraphicsViewNavigation; class GraphicsViewNavigation;
class CGAL_QT4_EXPORT DemosMainWindow : public QMainWindow class CGAL_QT_EXPORT DemosMainWindow : public QMainWindow
{ {
Q_OBJECT Q_OBJECT

View File

@ -22,8 +22,9 @@
#ifndef CGAL_QT_GRAPHICS_ITEM_H #ifndef CGAL_QT_GRAPHICS_ITEM_H
#define CGAL_QT_GRAPHICS_ITEM_H #define CGAL_QT_GRAPHICS_ITEM_H
#include <CGAL/export/Qt4.h> #include <CGAL/export/Qt.h>
#include <CGAL/auto_link/Qt4.h> #include <CGAL/auto_link/Qt.h>
#include <QObject> #include <QObject>
#include <QGraphicsItem> #include <QGraphicsItem>
#ifndef Q_MOC_RUN #ifndef Q_MOC_RUN
@ -35,7 +36,7 @@
namespace CGAL { namespace CGAL {
namespace Qt { namespace Qt {
class CGAL_QT4_EXPORT GraphicsItem : public QObject, public QGraphicsItem { class CGAL_QT_EXPORT GraphicsItem : public QObject, public QGraphicsItem {
Q_OBJECT Q_OBJECT
#if QT_VERSION >= 0x040600 #if QT_VERSION >= 0x040600

View File

@ -22,8 +22,10 @@
#ifndef CGAL_QT_GRAPHICS_VIEW_INPUT_H #ifndef CGAL_QT_GRAPHICS_VIEW_INPUT_H
#define CGAL_QT_GRAPHICS_VIEW_INPUT_H #define CGAL_QT_GRAPHICS_VIEW_INPUT_H
#include <CGAL/export/Qt4.h>
#include <CGAL/auto_link/Qt4.h> #include <CGAL/export/Qt.h>
#include <CGAL/auto_link/Qt.h>
#ifndef Q_MOC_RUN #ifndef Q_MOC_RUN
# include <CGAL/Object.h> # include <CGAL/Object.h>
#endif #endif
@ -31,7 +33,7 @@
namespace CGAL { namespace CGAL {
namespace Qt { namespace Qt {
class CGAL_QT4_EXPORT GraphicsViewInput : public QObject class CGAL_QT_EXPORT GraphicsViewInput : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -22,8 +22,9 @@
#ifndef CGAL_QT_GRAPHICS_VIEW_NAVIGATION_H #ifndef CGAL_QT_GRAPHICS_VIEW_NAVIGATION_H
#define CGAL_QT_GRAPHICS_VIEW_NAVIGATION_H #define CGAL_QT_GRAPHICS_VIEW_NAVIGATION_H
#include <CGAL/auto_link/Qt4.h> #include <CGAL/auto_link/Qt.h>
#include <CGAL/export/Qt4.h> #include <CGAL/export/Qt.h>
#include <QObject> #include <QObject>
#include <QPointF> #include <QPointF>
#include <QString> #include <QString>
@ -39,7 +40,7 @@ class QGraphicsRectItem;
namespace CGAL { namespace CGAL {
namespace Qt { namespace Qt {
class CGAL_QT4_EXPORT GraphicsViewNavigation: public QObject { class CGAL_QT_EXPORT GraphicsViewNavigation: public QObject {
Q_OBJECT Q_OBJECT

View File

@ -22,8 +22,9 @@
#ifndef CGAL_QT_GRAPHICS_VIEW_POLYLINE_INPUT_H #ifndef CGAL_QT_GRAPHICS_VIEW_POLYLINE_INPUT_H
#define CGAL_QT_GRAPHICS_VIEW_POLYLINE_INPUT_H #define CGAL_QT_GRAPHICS_VIEW_POLYLINE_INPUT_H
#include <CGAL/auto_link/Qt4.h> #include <CGAL/auto_link/Qt.h>
#include <CGAL/export/Qt4.h> #include <CGAL/export/Qt.h>
#include <QPolygonF> #include <QPolygonF>
#include <QPointF> #include <QPointF>
@ -41,7 +42,7 @@ class QObject;
namespace CGAL { namespace CGAL {
namespace Qt { namespace Qt {
class CGAL_QT4_EXPORT GraphicsViewPolylineInput_non_templated_base : public GraphicsViewInput class CGAL_QT_EXPORT GraphicsViewPolylineInput_non_templated_base : public GraphicsViewInput
{ {
public: public:
void setNumberOfVertices(int n) void setNumberOfVertices(int n)

View File

@ -22,8 +22,9 @@
#ifndef CGAL_QT_DEBUG_H #ifndef CGAL_QT_DEBUG_H
#define CGAL_QT_DEBUG_H #define CGAL_QT_DEBUG_H
#include <CGAL/auto_link/Qt4.h> #include <CGAL/auto_link/Qt.h>
#include <CGAL/export/Qt4.h> #include <CGAL/export/Qt.h>
#include <QString> #include <QString>
namespace CGAL { namespace CGAL {
@ -36,7 +37,7 @@ namespace Qt {
* CGAL::Qt:traverse_resources(":"); // view all resources * CGAL::Qt:traverse_resources(":"); // view all resources
* and displays the resources tree on std::cerr. * and displays the resources tree on std::cerr.
*/ */
CGAL_QT4_EXPORT void traverse_resources(const QString& name, CGAL_QT_EXPORT void traverse_resources(const QString& name,
const QString& dirname = QString(), const QString& dirname = QString(),
int indent = 0); int indent = 0);

View File

@ -21,11 +21,11 @@
#ifndef CGAL_QT_RESOURCES_H #ifndef CGAL_QT_RESOURCES_H
#define CGAL_QT_RESOURCES_H #define CGAL_QT_RESOURCES_H
#include <CGAL/export/Qt4.h> #include <CGAL/export/Qt.h>
// cannot use namespaces because of the Q_INIT_RESOURCE macro // cannot use namespaces because of the Q_INIT_RESOURCE macro
//New for Qt5 version ! //New for Qt5 version !
CGAL_QT4_EXPORT void CGAL_Qt_init_resources(); CGAL_QT_EXPORT void CGAL_Qt_init_resources();
//New for Qt5 version ! //New for Qt5 version !
#define CGAL_QT_INIT_RESOURCES do { CGAL_Qt_init_resources(); } while(0) #define CGAL_QT_INIT_RESOURCES do { CGAL_Qt_init_resources(); } while(0)

View File

@ -24,8 +24,9 @@
#include <QRectF> #include <QRectF>
#include <QRect> #include <QRect>
#include <CGAL/auto_link/Qt4.h>
#include <CGAL/export/Qt4.h> #include <CGAL/auto_link/Qt.h>
#include <CGAL/export/Qt.h>
class QGraphicsScene; class QGraphicsScene;
class QGraphicsView; class QGraphicsView;
@ -33,8 +34,8 @@ class QGraphicsView;
namespace CGAL { namespace CGAL {
namespace Qt { namespace Qt {
CGAL_QT4_EXPORT QRectF mapToScene(const QGraphicsView* v, const QRect rect); CGAL_QT_EXPORT QRectF mapToScene(const QGraphicsView* v, const QRect rect);
CGAL_QT4_EXPORT QRectF viewportsBbox(const QGraphicsScene*); CGAL_QT_EXPORT QRectF viewportsBbox(const QGraphicsScene*);
} // namespace Qt } // namespace Qt
} // namespace CGAL } // namespace CGAL

View File

@ -17,16 +17,17 @@
// //
// Author(s) : Laurent Rineau // Author(s) : Laurent Rineau
#ifndef CGAL_AUTO_LINK_QT4_H #ifndef CGAL_AUTO_LINK_QT_H
#define CGAL_AUTO_LINK_QT4_H #define CGAL_AUTO_LINK_QT_H
#include <CGAL/config.h> #include <CGAL/config.h>
#include <QtCore/qglobal.h>
#ifndef CGAL_NO_AUTOLINK_QT4 #if (! defined (CGAL_NO_AUTOLINK_QT4)) && ((!defined CGAL_NO_AUTOLINK_QT5))
#if ( ! defined( CGAL_EXPORTS ) ) && (! defined ( CGAL_Qt4_EXPORTS ) && (! defined (CGAL_Qt5_EXPORTS) ) ) #if ( ! defined( CGAL_EXPORTS ) ) && (! defined ( CGAL_Qt4_EXPORTS ) && (! defined (CGAL_Qt5_EXPORTS) ) )
// If CGAL_EXPORTS is defined it means that we are building the CGAL // If CGAL_EXPORTS is defined it means that we are building the CGAL
// library as a DLL. The CGAL.dll does not really depend on CGAL_Qt4, // library as a DLL. The CGAL.dll does not really depend on CGAL_Qt,
// whatever the header inclusion graph says. // whatever the header inclusion graph says.
//New for Qt5 version ! //New for Qt5 version !
@ -39,6 +40,6 @@
#include <CGAL/auto_link/auto_link.h> #include <CGAL/auto_link/auto_link.h>
#endif // CGAL_EXPORTS #endif // CGAL_EXPORTS
#endif // CGAL_NO_AUTOLINK_QT4 #endif // CGAL_NO_AUTOLINK_QT
#endif // CGAL_AUTO_LINK_QT4_H #endif // CGAL_AUTO_LINK_QT_H

View File

@ -17,9 +17,8 @@
// //
// Author(s) : Andreas Fabri // Author(s) : Andreas Fabri
#ifndef CGAL_QT4_EXPORT_H #ifndef CGAL_QT_EXPORT_H
#define CGAL_QT4_EXPORT_H #define CGAL_QT_EXPORT_H
#include <CGAL/config.h> #include <CGAL/config.h>
#include <CGAL/export/helpers.h> #include <CGAL/export/helpers.h>
@ -28,20 +27,20 @@
# if defined(CGAL_Qt4_EXPORTS) || defined(CGAL_Qt5_EXPORTS) // defined by CMake or in cpp files of the dll # if defined(CGAL_Qt4_EXPORTS) || defined(CGAL_Qt5_EXPORTS) // defined by CMake or in cpp files of the dll
# define CGAL_QT4_EXPORT CGAL_DLL_EXPORT # define CGAL_QT_EXPORT CGAL_DLL_EXPORT
# define CGAL_QT4_EXPIMP_TEMPLATE # define CGAL_QT_EXPIMP_TEMPLATE
# else // not CGAL_Qt4_EXPORTS # else // not CGAL_Qt4_EXPORTS
# define CGAL_QT4_EXPORT CGAL_DLL_IMPORT # define CGAL_QT_EXPORT CGAL_DLL_IMPORT
# define CGAL_QT4_EXPIMP_TEMPLATE extern # define CGAL_QT_EXPIMP_TEMPLATE extern
# endif // not CGAL_QT4_EXPORTS # endif // not CGAL_QT4_EXPORTS
#else // not CGAL_BUILD_SHARED_LIBS #else // not CGAL_BUILD_SHARED_LIBS
# define CGAL_QT4_EXPORT # define CGAL_QT_EXPORT
# define CGAL_QT4_EXPIMP_TEMPLATE # define CGAL_QT_EXPIMP_TEMPLATE
#endif // not CGAL_BUILD_SHARED_LIBS #endif // not CGAL_BUILD_SHARED_LIBS

View File

@ -334,13 +334,23 @@ if(QT4)
target_link_libraries(${IO_IMPLICIT_FUNCTION_PLUGIN_LIB} ${SCENE_IMPLICIT_FUNCTION_ITEM_LIB}) target_link_libraries(${IO_IMPLICIT_FUNCTION_PLUGIN_LIB} ${SCENE_IMPLICIT_FUNCTION_ITEM_LIB})
set(MESH_3_PLUGIN_LIB "${MESH_3_LIB_PREFIX}mesh_3_plugin") set(MESH_3_PLUGIN_LIB "${MESH_3_LIB_PREFIX}mesh_3_plugin")
if(QT5)
polyhedron_demo_plugin(${MESH_3_PLUGIN_LIB} Mesh_3_plugin polyhedron_demo_plugin(${MESH_3_PLUGIN_LIB} Mesh_3_plugin
Mesh_3_plugin_polyhedron_cgal_code.cpp
Mesh_3_plugin_image_cgal_code.cpp
Mesh_3_plugin_implicit_function_cgal_code.cpp
Meshing_thread.cpp
${meshingUI_FILES})
elseif(QT4)
polyhedron_demo_plugin(${MESH_3_PLUGIN_LIB} Mesh_3_plugin
Mesh_3_plugin_polyhedron_cgal_code.cpp Mesh_3_plugin_polyhedron_cgal_code.cpp
Mesh_3_plugin_image_cgal_code.cpp Mesh_3_plugin_image_cgal_code.cpp
Mesh_3_plugin_implicit_function_cgal_code.cpp Mesh_3_plugin_implicit_function_cgal_code.cpp
Meshing_thread.cpp Meshing_thread.cpp
Scene_c3t3_item.moc Scene_c3t3_item.moc
${meshingUI_FILES}) ${meshingUI_FILES})
endif()
target_link_libraries(${MESH_3_PLUGIN_LIB} target_link_libraries(${MESH_3_PLUGIN_LIB}
${SCENE_C3T3_ITEM_LIB} ${SCENE_C3T3_ITEM_LIB}
@ -352,11 +362,20 @@ if(QT4)
${OPENGL_glu_LIBRARY}) ${OPENGL_glu_LIBRARY})
set(MESH_3_OPTIMIZATION_PLUGIN_LIB "${MESH_3_LIB_PREFIX}mesh_3_optimization_plugin") set(MESH_3_OPTIMIZATION_PLUGIN_LIB "${MESH_3_LIB_PREFIX}mesh_3_optimization_plugin")
polyhedron_demo_plugin(${MESH_3_OPTIMIZATION_PLUGIN_LIB} Mesh_3_optimization_plugin
if(QT5)
polyhedron_demo_plugin(${MESH_3_OPTIMIZATION_PLUGIN_LIB} Mesh_3_optimization_plugin
Mesh_3_optimization_plugin_cgal_code.cpp
Optimizer_thread.cpp
${optimUI_FILES})
elseif(QT4)
polyhedron_demo_plugin(${MESH_3_OPTIMIZATION_PLUGIN_LIB} Mesh_3_optimization_plugin
Mesh_3_optimization_plugin_cgal_code.cpp Mesh_3_optimization_plugin_cgal_code.cpp
Optimizer_thread.cpp Optimizer_thread.cpp
Scene_c3t3_item.moc Scene_c3t3_item.moc
${optimUI_FILES}) ${optimUI_FILES})
endif()
target_link_libraries(${MESH_3_OPTIMIZATION_PLUGIN_LIB} target_link_libraries(${MESH_3_OPTIMIZATION_PLUGIN_LIB}
${SCENE_C3T3_ITEM_LIB} ${SCENE_C3T3_ITEM_LIB}