From aee9e4eb247376071b2c90a0bc33b2c85854ccbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Vialon?= Date: Thu, 26 Jun 2014 14:38:23 +0200 Subject: [PATCH] Commit of new demonstrations porting. --- .../ArrangementDemoWindow.cpp | 31 ++++ .../Arrangement_on_surface_2/CMakeLists.txt | 41 ++++- .../CMakeLists.txt | 47 ++++-- .../boolean_operations_2.cpp | 10 +- .../CGAL/Qt/GraphicsViewBezierPolygonInput.h | 8 +- .../Qt/GraphicsViewCircularPolygonInput.h | 5 + .../CGAL/Qt/PiecewiseRegionGraphicsItem.h | 8 +- .../CGAL/Qt/PiecewiseSetGraphicsItem.h | 4 +- GraphicsView/include/CGAL/Qt/resources.h | 2 +- GraphicsView/src/CGAL_Qt5/CMakeLists.txt | 5 +- GraphicsView/src/CGAL_Qt5/resources.cpp | 5 +- Installation/cmake/modules/FindQt5.cmake | 9 +- .../demo/Linear_cell_complex/CMakeLists.txt | 25 ++- .../demo/Linear_cell_complex/MainWindow.cpp | 1 + Polyhedron/demo/Polyhedron/CMakeLists.txt | 159 +++++++++++------- .../implicit_functions/CMakeLists.txt | 57 +++++-- .../Polyhedron/polyhedron_demo_macros.cmake | 9 +- .../CMakeLists.txt | 64 +++++-- .../MainWindow.cpp | 4 + .../Principal_component_analysis/PCA_demo.cpp | 6 +- .../demo/Surface_mesher/CMakeLists.txt | 26 +-- .../demo/Triangulation_3/CMakeLists.txt | 15 +- 22 files changed, 368 insertions(+), 173 deletions(-) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoWindow.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoWindow.cpp index ecb50a788c4..128ed6b3f11 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoWindow.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoWindow.cpp @@ -1140,6 +1140,36 @@ void ArrangementDemoWindow::on_actionPreferences_triggered( ) if ( dialog->exec( ) == QDialog::Accepted ) { typedef ArrangementDemoPropertiesDialog Dialog; + + //New for Qt5 version ! + #if QT_VERSION >= 0x050000 + QColor edgeColor = dialog->property(Dialog::EDGE_COLOR_KEY).value(); + + unsigned int edgeWidth = dialog->property(Dialog::EDGE_WIDTH_KEY).value(); + + QColor vertexColor = dialog->property(Dialog::VERTEX_COLOR_KEY).value(); + + unsigned int vertexRadius = dialog->property(Dialog::VERTEX_RADIUS_KEY).value(); + + QColor envelopeEdgeColor = dialog->property(Dialog::ENVELOPE_EDGE_COLOR_KEY).value(); + + unsigned int envelopeEdgeWidth = dialog->property(Dialog::ENVELOPE_EDGE_WIDTH_KEY).value(); + + QColor envelopeVertexColor = dialog->property(Dialog::ENVELOPE_VERTEX_COLOR_KEY).value(); + + unsigned int envelopeVertexRadius = dialog->property(Dialog::ENVELOPE_VERTEX_RADIUS_KEY).value(); + + QColor verticalRayEdgeColor = dialog->property(Dialog::VERTICAL_RAY_EDGE_COLOR_KEY).value(); + + unsigned int verticalRayEdgeWidth = dialog->property(Dialog::VERTICAL_RAY_EDGE_WIDTH_KEY).value(); + + DeleteCurveMode mode = dialog->property(Dialog::DELETE_CURVE_MODE_KEY).value(); + + unsigned int gridSize = dialog->property(Dialog::GRID_SIZE_KEY).value(); + + QColor gridColor = dialog->property(Dialog::GRID_COLOR_KEY).value(); + + #else QColor edgeColor = qVariantValue(dialog->property(Dialog::EDGE_COLOR_KEY)); unsigned int edgeWidth = @@ -1172,6 +1202,7 @@ void ArrangementDemoWindow::on_actionPreferences_triggered( ) qVariantValue(dialog->property(Dialog::GRID_SIZE_KEY)); QColor gridColor = qVariantValue(dialog->property(Dialog::GRID_COLOR_KEY)); + #endif QPen edgesPen(QBrush(edgeColor), edgeWidth); QPen verticesPen(QBrush(vertexColor), vertexRadius); diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt index f192fd34a47..4b4e7ee6075 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/CMakeLists.txt @@ -9,24 +9,47 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Core Qt4 ) -include( ${CGAL_USE_FILE} ) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) -find_package( Qt4 ) +if(USE_QT5) + + find_package(CGAL COMPONENTS Core Qt5 ) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Core Qt4 ) + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) + +if ( CGAL_FOUND AND (QT4 OR QT5) ) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND) - include( ${QT_USE_FILE} ) include_directories( ./ ) # Arrangement package includes include_directories( BEFORE ../../include ) - qt4_wrap_ui( arrangement_2_uis + qt_wrap_ui( arrangement_2_uis ArrangementDemoWindow.ui NewTabDialog.ui OverlayDialog.ui ArrangementDemoPropertiesDialog.ui ) - qt4_wrap_cpp( arrangement_2_mocs + qt_wrap_cpp( arrangement_2_mocs ArrangementDemoWindow.h ArrangementDemoTab.h Callback.h @@ -38,7 +61,7 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND) PropertyValueDelegate.h #PropertyValueDelegate.cpp ) - qt4_add_resources( arrangement_2_resources + qt_add_resources( arrangement_2_resources ArrangementDemoWindow.qrc ) add_executable( arrangement_2 @@ -77,7 +100,7 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND) else() - message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.") + message(STATUS "NOTICE: This demo requires CGAL and Qt, and will not be compiled.") endif() diff --git a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/CMakeLists.txt b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/CMakeLists.txt index 1f3a8ae6634..c7cbc2b5b76 100644 --- a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/CMakeLists.txt +++ b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/CMakeLists.txt @@ -10,30 +10,53 @@ else() cmake_policy(VERSION 2.6) endif() -find_package(CGAL COMPONENTS Qt4 Core ) - -include(${CGAL_USE_FILE}) - set( QT_USE_QTMAIN TRUE ) -find_package(Qt4) +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5 Core ) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + +else (USE_QT5) + + + find_package(CGAL COMPONENTS Qt4 Core ) + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../include ) include_directories (BEFORE ${CMAKE_CURRENT_BINARY_DIR}) include_directories (BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include ) -if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND AND CGAL_Core_FOUND ) +if ( CGAL_FOUND AND (CGAL_Qt4_FOUND OR CGAL_Qt5_FOUND) AND (QT4 OR QT5) AND CGAL_Core_FOUND ) - include(${QT_USE_FILE}) + #include(${QT_USE_FILE}) # UI files (Qt Designer files) - qt4_wrap_ui( CDT_UI_FILES boolean_operations_2.ui ) + qt_wrap_ui( CDT_UI_FILES boolean_operations_2.ui ) # qrc files (resources files, that contain icons, at least) - qt4_add_resources ( CDT_RESOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/boolean_operations_2.qrc ) + qt_add_resources ( CDT_RESOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/boolean_operations_2.qrc ) # use the Qt MOC preprocessor on classes that derives from QObject - qt4_generate_moc( "boolean_operations_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/boolean_operations_2.moc" ) + qt_generate_moc( "boolean_operations_2.cpp" "${CMAKE_CURRENT_BINARY_DIR}/boolean_operations_2.moc" ) # The executable itself. add_executable ( boolean_operations_2 ${CMAKE_CURRENT_SOURCE_DIR}/boolean_operations_2.cpp boolean_operations_2.moc ${CDT_UI_FILES} ${CDT_RESOURCE_FILES} ) @@ -44,8 +67,8 @@ if ( CGAL_FOUND AND CGAL_Qt4_FOUND AND QT4_FOUND AND CGAL_Core_FOUND ) # Link with CGAL target_link_libraries( boolean_operations_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}) -else() +else( CGAL_FOUND AND (CGAL_Qt4_FOUND OR CGAL_Qt5_FOUND) AND (QT4 OR QT5) AND CGAL_Core_FOUND ) message(STATUS "NOTICE: This demo requires CGAL and Qt4, and will not be compiled.") -endif() +endif( CGAL_FOUND AND (CGAL_Qt4_FOUND OR CGAL_Qt5_FOUND) AND (QT4 OR QT5) AND CGAL_Core_FOUND ) diff --git a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/boolean_operations_2.cpp b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/boolean_operations_2.cpp index 70ac9d92c85..a8a3a679bcf 100644 --- a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/boolean_operations_2.cpp +++ b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/boolean_operations_2.cpp @@ -52,6 +52,11 @@ void trace( std::string s ) #include #include +//New for Qt5 version ! +#if QT_VERSION >= 0x050000 +#include +#endif + #include #include #include @@ -81,6 +86,7 @@ void trace( std::string s ) #include #endif + #include #include #include @@ -1631,7 +1637,9 @@ int main(int argc, char **argv) // Import resources from libCGALQt4. // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + + //New for Qt5 version ! + CGAL_QT_INIT_RESOURCES; MainWindow mainWindow; mainWindow.show(); diff --git a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/GraphicsViewBezierPolygonInput.h b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/GraphicsViewBezierPolygonInput.h index a4c2897c2aa..35e491bc65c 100644 --- a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/GraphicsViewBezierPolygonInput.h +++ b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/GraphicsViewBezierPolygonInput.h @@ -28,6 +28,12 @@ #include #include +//New for Qt5 version ! +#if QT_VERSION >= 0x050000 +#include +#include +#endif + #include #include #include @@ -132,7 +138,7 @@ namespace Qt { bool rHandled = false ; Point lP = cvt(aEvent->scenePos()); - + if ( aEvent->button() == ::Qt::LeftButton ) { switch (mState) diff --git a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/GraphicsViewCircularPolygonInput.h b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/GraphicsViewCircularPolygonInput.h index 46dfe4c7ece..40a8b616f3d 100644 --- a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/GraphicsViewCircularPolygonInput.h +++ b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/GraphicsViewCircularPolygonInput.h @@ -28,6 +28,11 @@ #include #include +//New for Qt5 version ! +#if QT_VERSION >= 0x050000 +#include +#endif + #include #include #include diff --git a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/PiecewiseRegionGraphicsItem.h b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/PiecewiseRegionGraphicsItem.h index 14488fbd3f5..6a8b46029cd 100644 --- a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/PiecewiseRegionGraphicsItem.h +++ b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/PiecewiseRegionGraphicsItem.h @@ -80,19 +80,19 @@ protected: template void Piecewise_region_graphics_item::update_region_bbox( Piecewise_region const& aRegion, Piecewise_graphics_item_base::Bbox_builder& aBboxBuilder ) { - update_boundary_bbox( aRegion.outer_boundary(), aBboxBuilder ) ; + this->update_boundary_bbox( aRegion.outer_boundary(), aBboxBuilder ) ;//"This" added for qt5 version ! for( Hole_const_itertator hit = aRegion.holes_begin(); hit != aRegion.holes_end(); ++ hit ) - update_boundary_bbox(*hit,aBboxBuilder); + this->update_boundary_bbox(*hit,aBboxBuilder);//"This" added for qt5 version ! } template void Piecewise_region_graphics_item::draw_region( Piecewise_region const& aRegion, QPainterPath& aPath ) { - draw_boundary( aRegion.outer_boundary(), aPath ) ; + this->draw_boundary( aRegion.outer_boundary(), aPath ) ;//This added for qt5 version ! for( Hole_const_itertator hit = aRegion.holes_begin(); hit != aRegion.holes_end(); ++ hit ) - draw_boundary(*hit,aPath); + this->draw_boundary(*hit,aPath);//"This" added for qt5 version ! } diff --git a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/PiecewiseSetGraphicsItem.h b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/PiecewiseSetGraphicsItem.h index 3cf1f580356..445b38dbd61 100644 --- a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/PiecewiseSetGraphicsItem.h +++ b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/PiecewiseSetGraphicsItem.h @@ -103,7 +103,7 @@ void Piecewise_set_graphics_item::update_set_bbox( Piecewise_set const& a aSet.polygons_with_holes( std::back_inserter(vec) ) ; for( Region_const_iterator rit = vec.begin(); rit != vec.end() ; ++ rit ) - update_region_bbox(*rit,aBboxBuilder); + this->update_region_bbox(*rit,aBboxBuilder);//This added for Qt5 version ! } template @@ -114,7 +114,7 @@ void Piecewise_set_graphics_item::draw_set( Piecewise_set const& aSet, QP aSet.polygons_with_holes( std::back_inserter(vec) ) ; for( Region_const_iterator rit = vec.begin(); rit != vec.end() ; ++ rit ) - draw_region(*rit,aPath); + this->draw_region(*rit,aPath);//This added for Qt5 version ! } } // namespace Qt diff --git a/GraphicsView/include/CGAL/Qt/resources.h b/GraphicsView/include/CGAL/Qt/resources.h index 22e45f528b8..6da43315e53 100644 --- a/GraphicsView/include/CGAL/Qt/resources.h +++ b/GraphicsView/include/CGAL/Qt/resources.h @@ -28,7 +28,7 @@ CGAL_QT4_EXPORT void CGAL_Qt_init_resources(); //New for Qt5 version ! -#define CGAL_QT4_INIT_RESOURCES do { CGAL_Qt_init_resources(); } while(0) +#define CGAL_QT_INIT_RESOURCES do { CGAL_Qt_init_resources(); } while(0) // The do{}while(0) trick is used to make that macro value a regular // statement and not a compound statement. diff --git a/GraphicsView/src/CGAL_Qt5/CMakeLists.txt b/GraphicsView/src/CGAL_Qt5/CMakeLists.txt index a2252781c7e..889f363e5ea 100644 --- a/GraphicsView/src/CGAL_Qt5/CMakeLists.txt +++ b/GraphicsView/src/CGAL_Qt5/CMakeLists.txt @@ -22,11 +22,8 @@ list(APPEND QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_L list(APPEND QT_DEFINITIONS ${Qt5Core_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5OpenGL_DEFINITIONS}) -<<<<<<< HEAD + if( Qt5Widgets_FOUND AND Qt5Gui_FOUND AND Qt5Widgets_FOUND AND Qt5OpenGL_FOUND ) -======= -if( Qt5Widgets_FOUND AND Qt5Gui_FOUND AND Qt5Widgets_FOUND AND Qt5OpenGL_FOUND) ->>>>>>> 1f669ad498d664482b6b486e3e95a50a56076759 if( OPENGL_FOUND ) diff --git a/GraphicsView/src/CGAL_Qt5/resources.cpp b/GraphicsView/src/CGAL_Qt5/resources.cpp index a3ed7843a99..142d7492d3b 100644 --- a/GraphicsView/src/CGAL_Qt5/resources.cpp +++ b/GraphicsView/src/CGAL_Qt5/resources.cpp @@ -22,11 +22,8 @@ #include // cannot use namespaces because of the Q_INIT_RESOURCE macro -<<<<<<< HEAD + void CGAL_Qt_init_resources() { -======= -void CGAL_Qt5_init_resources() { ->>>>>>> 1f669ad498d664482b6b486e3e95a50a56076759 Q_INIT_RESOURCE(File); Q_INIT_RESOURCE(Triangulation_2); Q_INIT_RESOURCE(Input); diff --git a/Installation/cmake/modules/FindQt5.cmake b/Installation/cmake/modules/FindQt5.cmake index 3de6604eaa4..0b75d61267f 100644 --- a/Installation/cmake/modules/FindQt5.cmake +++ b/Installation/cmake/modules/FindQt5.cmake @@ -7,6 +7,10 @@ if(WIN32) endif() +if (QT_USE_QTMAIN ) + find_package(Qt5Core) +endif(QT_USE_QTMAIN ) + # Qt modules FOREACH(module Core GUI OpenGL Multimedia Network QML Quick SQL Test WebKit @@ -31,5 +35,8 @@ FOREACH(module Core GUI OpenGL Multimedia ENDFOREACH(module) -SET(QT5 TRUE) +set(QT5 TRUE) set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +message("End of searching Qt5 modules.") diff --git a/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt index 4b5c8e2c71b..afe4f6f0204 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/demo/Linear_cell_complex/CMakeLists.txt @@ -34,7 +34,7 @@ set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) #New for Qt5 version ! -option (USE_QT5 "Use Qt5 version instead of Qt4" OFF) +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) if(USE_QT5) @@ -43,20 +43,24 @@ if(USE_QT5) include(${CGAL_USE_FILE}) find_package(Qt5) - + else (USE_QT5) + find_package(CGAL COMPONENTS Qt4) include(${CGAL_USE_FILE}) find_package(Qt4) - include(${QT_USE_FILE}) if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) message("Qt4 found") set(QT4 TRUE) endif() + endif (USE_QT5) +include(QtChoice) + find_package(OpenGL) find_package(QGLViewer) @@ -84,21 +88,14 @@ include_directories(BEFORE . ../../include/) FILE (GLOB CPP *.cpp) -if(QT4) - # ui file, created wih Qt Designer - qt4_wrap_ui(uis MainWindow.ui CreateMesh.ui CreateMenger.ui) +# ui file, created wih Qt Designer - # qrc files (resources files, that contain icons, at least) - qt4_add_resources (RESOURCE_FILES ./Linear_cell_complex_3.qrc) +qt_wrap_ui(uis MainWindow.ui CreateMesh.ui CreateMenger.ui) - qt4_automoc(MainWindow.cpp Viewer.cpp) -endif() -if(QT5) - qt5_wrap_ui(uis MainWindow.ui CreateMesh.ui CreateMenger.ui) +qt_add_resources (RESOURCE_FILES ./Linear_cell_complex_3.qrc) - qt5_add_resources (RESOURCE_FILES ./Linear_cell_complex_3.qrc) +qt_automoc(MainWindow.cpp Viewer.cpp) -endif() add_executable(Linear_cell_complex_3_demo ${CPP} ${uis} diff --git a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp index 3e3e92d4d39..74c830d4ff9 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.cpp @@ -37,6 +37,7 @@ MainWindow::MainWindow (QWidget * parent):CGAL::Qt::DemosMainWindow (parent), dialogmesh (this), dialogmenger(this) { + setupUi (this); scene.lcc = new LCC; diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index b6955e5ae4f..904599601a6 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -27,17 +27,17 @@ foreach(DEP_PKG AABB_tree STL_Extension GraphicsView Surface_mesher Filtered_ker endforeach() endforeach() +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" OFF) + +option( POLYHEDRON_QTSCRIPT_DEBUGGER + "Activate the use of Qt Script Debugger in Polyhedron_3 demo" OFF) + # Include this package's headers first include_directories( BEFORE ./ ./include ../../include ./CGAL_demo) add_subdirectory( implicit_functions ) -# Find CGAL and CGAL Qt4 -find_package(CGAL COMPONENTS Qt4) -include( ${CGAL_USE_FILE} ) - -option( POLYHEDRON_QTSCRIPT_DEBUGGER - "Activate the use of Qt Script Debugger in Polyhedron_3 demo" OFF) # Find Qt4 itself set( QT_USE_QTXML TRUE ) @@ -47,17 +47,43 @@ set( QT_USE_QTOPENGL TRUE ) if( POLYHEDRON_QTSCRIPT_DEBUGGER) set( QT_USE_QTSCRIPTTOOLS TRUE ) endif() -find_package(Qt4) + + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(COMPATIBILITY_QT4 TRUE) + +else (USE_QT5) + # Find CGAL and CGAL Qt4 + find_package(CGAL COMPONENTS Qt4) + include( ${CGAL_USE_FILE} ) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + message("Qt4 found") + include(${QT_USE_FILE}) + + set(QT4 TRUE) + endif() +endif(USE_QT5) + +include(QtChoice) # Find OpenGL find_package(OpenGL) # Find QGLViewer -if(QT4_FOUND) - include(${QT_USE_FILE}) +if(QT4 OR QT5) include_directories( ${QT_INCLUDE_DIR}/QtScriptTools ) find_package(QGLViewer ) -endif(QT4_FOUND) +endif(QT4 OR QT5) @@ -80,7 +106,7 @@ else() endif() -if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) +if((QT4 OR QT5) AND OPENGL_FOUND AND QGLVIEWER_FOUND) set(Boost_USE_MULTITHREADED ON) find_package(Boost COMPONENTS thread system) @@ -97,51 +123,52 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) message(STATUS "NOTICE: Eigen 3.1 (or greater) and LAPACK is not found. curvatures estimation will not be available.") endif(NOT EIGEN3_FOUND AND NOT LAPACK_FOUND) - qt4_wrap_ui( MainWindowUI_files MainWindow.ui ) - qt4_wrap_ui( FileLoaderDialogUI_files FileLoaderDialog.ui ) - qt4_wrap_ui( Show_point_dialogUI_FILES Show_point_dialog.ui ) - qt4_wrap_ui( remeshingUI_FILES Remeshing_dialog.ui) - qt4_wrap_ui( meshingUI_FILES Meshing_dialog.ui Meshing_pause_widget.ui ) - qt4_wrap_ui( cameraUI_FILES Camera_positions_list.ui ) - qt4_wrap_ui( PreferencesUI_FILES Preferences.ui ) - qt4_wrap_ui( point_inside_polyhedronUI_FILES Point_inside_polyhedron_widget.ui) - qt4_wrap_ui( polyhedron_slicerUI_FILES Polyhedron_slicer_widget.ui) - qt4_wrap_ui( segmentationUI_FILES Mesh_segmentation_widget.ui) - qt4_wrap_ui( funcUI_FILES Function_dialog.ui ) + #New for Qt5 version ! + qt_wrap_ui( MainWindowUI_files MainWindow.ui ) + qt_wrap_ui( FileLoaderDialogUI_files FileLoaderDialog.ui ) + qt_wrap_ui( Show_point_dialogUI_FILES Show_point_dialog.ui ) + qt_wrap_ui( remeshingUI_FILES Remeshing_dialog.ui) + qt_wrap_ui( meshingUI_FILES Meshing_dialog.ui Meshing_pause_widget.ui ) + qt_wrap_ui( cameraUI_FILES Camera_positions_list.ui ) + qt_wrap_ui( PreferencesUI_FILES Preferences.ui ) + qt_wrap_ui( point_inside_polyhedronUI_FILES Point_inside_polyhedron_widget.ui) + qt_wrap_ui( polyhedron_slicerUI_FILES Polyhedron_slicer_widget.ui) + qt_wrap_ui( segmentationUI_FILES Mesh_segmentation_widget.ui) + qt_wrap_ui( funcUI_FILES Function_dialog.ui ) - qt4_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" ) - qt4_generate_moc( "File_loader_dialog.h" "${CMAKE_CURRENT_BINARY_DIR}/File_loader_dialog_moc.cpp" ) - add_file_dependencies( MainWindow_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h" ) - add_file_dependencies( File_loader_dialog_moc_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/File_loader_dialog.h" ) + qt_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" ) + qt_generate_moc( "File_loader_dialog.h" "${CMAKE_CURRENT_BINARY_DIR}/File_loader_dialog_moc.cpp" ) - qt4_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" ) - add_file_dependencies( Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h" ) + add_file_dependencies( MainWindow_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h" ) + add_file_dependencies( File_loader_dialog_moc_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/File_loader_dialog.h" ) - include( ${CMAKE_CURRENT_SOURCE_DIR}/polyhedron_demo_macros.cmake ) + qt_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" ) + add_file_dependencies( Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h" ) - qt4_add_resources ( RESOURCE_FILES Polyhedron_3.qrc ) + include( ${CMAKE_CURRENT_SOURCE_DIR}/polyhedron_demo_macros.cmake ) - qt4_generate_moc( "CGAL_demo/Viewer_interface.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_interface_moc.cpp" ) + qt_add_resources ( RESOURCE_FILES Polyhedron_3.qrc ) - qt4_automoc(Scene.cpp - Scene_item.cpp - Scene_plane_item.cpp - Scene_combinatorial_map_item.cpp - Scene_polygon_soup_item.cpp - Scene_polyhedron_item.cpp - Scene_polyhedron_transform_item.cpp - Scene_polylines_item.cpp - Scene_edit_polyhedron_item.cpp - Scene_textured_polyhedron_item.cpp - Scene_c2t3_item.cpp - Scene_nef_polyhedron_item.cpp - Show_point_dialog.cpp - Mesher_base.cpp - Camera_positions_list.cpp - Scene_points_with_normal_item.cpp + qt_generate_moc( "CGAL_demo/Viewer_interface.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_interface_moc.cpp" ) + + qt_automoc(Scene.cpp + Scene_item.cpp + Scene_plane_item.cpp + Scene_combinatorial_map_item.cpp + Scene_polygon_soup_item.cpp + Scene_polyhedron_item.cpp + Scene_polyhedron_transform_item.cpp + Scene_polylines_item.cpp + Scene_edit_polyhedron_item.cpp + Scene_textured_polyhedron_item.cpp + Scene_c2t3_item.cpp + Scene_nef_polyhedron_item.cpp + Show_point_dialog.cpp + Mesher_base.cpp + Camera_positions_list.cpp + Scene_points_with_normal_item.cpp ) - qt4_automoc( Scene_implicit_function_item.cpp ) - + qt_automoc( Scene_implicit_function_item.cpp ) # AUXILIARY LIBRARIES @@ -264,6 +291,7 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polyhedron_3 ) + ########### # PLUGINS # ########### @@ -281,7 +309,8 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) target_link_libraries( camera_positions_plugin ${QGLVIEWER_LIBRARIES} demo_framework) if ( Boost_VERSION GREATER 103400 ) - qt4_generate_moc( "Polyhedron_demo_mesh_3_plugin_cgal_code.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Scene_c3t3_item.moc" ) + + qt_generate_moc( "Polyhedron_demo_mesh_3_plugin_cgal_code.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Scene_c3t3_item.moc" ) polyhedron_demo_plugin(mesh_3_plugin Polyhedron_demo_mesh_3_plugin Polyhedron_demo_mesh_3_plugin_cgal_code.cpp Scene_c3t3_item.moc) @@ -343,21 +372,25 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) endif(EIGEN3_FOUND OR TAUCS_FOUND) if(TAUCS_FOUND OR EIGEN3_FOUND) - qt4_wrap_ui( poissonUI_FILES Polyhedron_demo_poisson_plugin.ui) + + qt_wrap_ui( poissonUI_FILES Polyhedron_demo_poisson_plugin.ui) + polyhedron_demo_plugin(poisson_plugin Polyhedron_demo_poisson_plugin Polyhedron_demo_poisson_plugin_impl.cpp ${poissonUI_FILES}) target_link_libraries(poisson_plugin scene_polyhedron_item scene_points_with_normal_item) else(TAUCS_FOUND OR EIGEN3_FOUND) message(STATUS "NOTICE: Neither TAUCS nor Eigen 3.1 (or greater) libraries have been found. Poisson reconstruction will not be available.") endif(TAUCS_FOUND OR EIGEN3_FOUND) - + # Link with BLAS and LAPACK only (optional), for Jet Fitting if (NOT EIGEN3_FOUND AND LAPACK_FOUND) include( ${LAPACK_USE_FILE} ) endif() if(EIGEN3_FOUND OR LAPACK_FOUND) - qt4_wrap_ui( normal_estimationUI_FILES Polyhedron_demo_normal_estimation_plugin.ui) + + qt_wrap_ui( normal_estimationUI_FILES Polyhedron_demo_normal_estimation_plugin.ui) + polyhedron_demo_plugin(normal_estimation_plugin Polyhedron_demo_normal_estimation_plugin ${normal_estimationUI_FILES}) target_link_libraries(normal_estimation_plugin scene_points_with_normal_item) @@ -417,12 +450,14 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) polyhedron_demo_plugin(point_inside_polyhedron_plugin Polyhedron_demo_point_inside_polyhedron_plugin ${point_inside_polyhedronUI_FILES}) target_link_libraries(point_inside_polyhedron_plugin scene_polyhedron_item scene_points_with_normal_item) - - qt4_wrap_ui(point_set_simplificationUI_FILES Polyhedron_demo_point_set_simplification_plugin.ui) + + qt_wrap_ui(point_set_simplificationUI_FILES Polyhedron_demo_point_set_simplification_plugin.ui) + polyhedron_demo_plugin(point_set_simplification_plugin Polyhedron_demo_point_set_simplification_plugin ${point_set_simplificationUI_FILES}) target_link_libraries(point_set_simplification_plugin scene_points_with_normal_item) - qt4_wrap_ui( ps_outliers_removal_UI_FILES Polyhedron_demo_point_set_outliers_removal_plugin.ui) + qt_wrap_ui( ps_outliers_removal_UI_FILES Polyhedron_demo_point_set_outliers_removal_plugin.ui) + polyhedron_demo_plugin(point_set_outliers_removal_plugin Polyhedron_demo_point_set_outliers_removal_plugin ${ps_outliers_removal_UI_FILES}) target_link_libraries(point_set_outliers_removal_plugin scene_points_with_normal_item) @@ -432,9 +467,13 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) if(TARGET CGAL_Qt4) export(TARGETS CGAL_Qt4 FILE polyhedron_demo_targets.cmake NAMESPACE Polyhedron_) export(TARGETS CGAL CGAL_Qt4 FILE polyhedron_demo_targets.cmake NAMESPACE Polyhedron_) + elseif(TARGET CGAL_Qt5) + export(TARGETS CGAL_Qt5 FILE polyhedron_demo_targets.cmake NAMESPACE Polyhedron_) + export(TARGETS CGAL CGAL_Qt5 FILE polyhedron_demo_targets.cmake NAMESPACE Polyhedron_) else() export(TARGETS FILE polyhedron_demo_targets.cmake) endif() + export( TARGETS demo_framework @@ -447,7 +486,7 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) configure_file(CGAL_polyhedron_demoConfig.cmake.in CGAL_polyhedron_demoConfig.cmake) -else (CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) +else ((QT4 OR QT5) AND OPENGL_FOUND AND QGLVIEWER_FOUND) set(POLYHEDRON_MISSING_DEPS "") @@ -455,8 +494,8 @@ else (CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) set(POLYHEDRON_MISSING_DEPS "the CGAL Qt4 library, ${POLYHEDRON_MISSING_DEPS}") endif() - if(NOT QT4_FOUND) - set(POLYHEDRON_MISSING_DEPS "Qt4, ${POLYHEDRON_MISSING_DEPS}") + if(NOT (QT4 OR QT5)) + set(POLYHEDRON_MISSING_DEPS "Qt, ${POLYHEDRON_MISSING_DEPS}") endif() if(NOT OPENGL_FOUND) @@ -469,4 +508,4 @@ else (CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) message(STATUS "NOTICE: This demo requires ${POLYHEDRON_MISSING_DEPS}and will not be compiled.") -endif (CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) +endif ((QT4 OR QT5) AND OPENGL_FOUND AND QGLVIEWER_FOUND) diff --git a/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt b/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt index 79b3492ad1b..9e5bd45cabf 100644 --- a/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt @@ -15,21 +15,42 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") # Include directory of demo includes include_directories( BEFORE ${Mesh_3_implicit_functions_BINARY_DIR} ../include ) -# Find CGAL and CGAL Qt4 -find_package(CGAL COMPONENTS Qt4) -include( ${CGAL_USE_FILE} ) - -# Find Qt4 itself +# Find Qt set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) -find_package(Qt4) -if(CGAL_Qt4_FOUND AND QT4_FOUND) - include(${QT_USE_FILE}) +if(USE_QT5) + find_package(CGAL COMPONENTS Qt5) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + + set(COMPATIBILITY_QT4 TRUE) + +else(USE_QT5) + # Find CGAL and CGAL Qt4 + find_package(CGAL COMPONENTS Qt4) + include( ${CGAL_USE_FILE} ) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + message("Qt4 found") + include(${QT_USE_FILE}) + + set(QT4 TRUE) + endif() +endif(USE_QT5) + +include(QtChoice) + +if(QT4 OR QT5) + # put plugins (which are shared libraries) at the same location as # executable files set(LIBRARY_OUTPUT_PATH ${RUNTIME_OUTPUT_PATH}) @@ -49,7 +70,9 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND) else() set(other_sources ${ARGN_TAIL}) endif() - qt4_generate_moc( "${CMAKE_CURRENT_SOURCE_DIR}/${plugin_implementation_base_name}.cpp" ${plugin_implementation_base_name}.moc ) + + qt_generate_moc( "${CMAKE_CURRENT_SOURCE_DIR}/${plugin_implementation_base_name}.cpp" ${plugin_implementation_base_name}.moc ) + add_file_dependencies( ${plugin_implementation_base_name}.moc "${CMAKE_CURRENT_SOURCE_DIR}/${plugin_implementation_base_name}.cpp" ) add_library(${plugin_name} MODULE ${option} ${plugin_implementation_base_name}.moc ${plugin_implementation_base_name}.cpp ${other_sources}) @@ -64,18 +87,26 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND) polyhedron_demo_plugin(p_tanglecube_function_plugin Tanglecube_implicit_function) polyhedron_demo_plugin(p_klein_function_plugin Klein_implicit_function) -else (CGAL_Qt4_FOUND AND QT4_FOUND) +else (QT4 OR QT5) set(MESH_3_MISSING_DEPS "") - if(NOT CGAL_Qt4_FOUND) + if(NOT CGAL_Qt4_FOUND AND NOT USE_QT5) set(MESH_3_MISSING_DEPS "the CGAL Qt4 library, ${MESH_3_MISSING_DEPS}") endif() - if(NOT QT4_FOUND) + if(NOT CGAL_Qt5_FOUND AND USE_QT5) + set(MESH_3_MISSING_DEPS "the CGAL Qt4 library, ${MESH_3_MISSING_DEPS}") + endif() + + if(NOT QT4_FOUND AND NOT USE_QT5) + set(MESH_3_MISSING_DEPS "Qt4, ${MESH_3_MISSING_DEPS}") + endif() + + if(NOT QT5_FOUND AND USE_QT5) set(MESH_3_MISSING_DEPS "Qt4, ${MESH_3_MISSING_DEPS}") endif() message(STATUS "NOTICE: This demo requires ${MESH_3_MISSING_DEPS}and will not be compiled.") -endif (CGAL_Qt4_FOUND AND QT4_FOUND) +endif (QT4 OR QT5) diff --git a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake b/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake index f7d5ed89516..a6cbeb037f6 100644 --- a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake +++ b/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake @@ -17,7 +17,14 @@ include(AddFileDependencies) set(moc_file_name "") else() set(moc_file_name ${plugin_implementation_base_name}.moc ) - qt4_generate_moc( ${plugin_implementation_base_name}.cpp "${CMAKE_CURRENT_BINARY_DIR}/${moc_file_name}" ) + + #New for Qt5 version ! + if(QT5) + qt5_generate_moc( ${plugin_implementation_base_name}.cpp "${CMAKE_CURRENT_BINARY_DIR}/${moc_file_name}" ) + else(QT5) + qt4_generate_moc( ${plugin_implementation_base_name}.cpp "${CMAKE_CURRENT_BINARY_DIR}/${moc_file_name}" ) + endif(QT5) + add_file_dependencies( ${moc_file_name} "${CMAKE_CURRENT_SOURCE_DIR}/${plugin_implementation_base_name}.cpp" ) endif() diff --git a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt index 5f39801b913..bb026de74ba 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/demo/Principal_component_analysis/CMakeLists.txt @@ -17,41 +17,63 @@ endforeach() include_directories( ./ ) -# Find CGAL and CGAL Qt4 -find_package(CGAL COMPONENTS Qt4) -include( ${CGAL_USE_FILE} ) - -# Find Qt4 itself +# Find Qt set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) -find_package(Qt4) + +#New for Qt5 version ! +option (USE_QT5 "Use Qt5 version instead of Qt4" ON) + +if(USE_QT5) + + find_package(CGAL COMPONENTS Qt5) + + include(${CGAL_USE_FILE}) + + find_package(Qt5) + +else (USE_QT5) + + find_package(CGAL COMPONENTS Qt4) + include(${CGAL_USE_FILE}) + + find_package(Qt4) + + if(CGAL_Qt4_FOUND AND QT4_FOUND) + include(${QT_USE_FILE}) + message("Qt4 found") + set(QT4 TRUE) + endif() + +endif (USE_QT5) + +include(QtChoice) # Find OpenGL find_package(OpenGL) # Find QGLViewer -if(QT4_FOUND) - include(${QT_USE_FILE}) +if(QT4 OR QT5) find_package(QGLViewer ) -endif(QT4_FOUND) +endif(QT4 OR QT5) -if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) +if((QT4 OR QT5) AND OPENGL_FOUND AND QGLVIEWER_FOUND) include_directories ( ${QGLVIEWER_INCLUDE_DIR} ) - qt4_wrap_ui( UI_FILES MainWindow.ui ) + qt_wrap_ui( UI_FILES MainWindow.ui ) include(AddFileDependencies) - qt4_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" ) + qt_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" ) add_file_dependencies( MainWindow_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h" ) - qt4_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" ) + qt_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" ) add_file_dependencies( Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h" ) - qt4_add_resources ( RESOURCE_FILES PCA_demo.qrc ) + qt_add_resources ( RESOURCE_FILES PCA_demo.qrc ) add_file_dependencies( PCA_demo.cpp "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp" ) @@ -69,11 +91,15 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) add_to_cached_list( CGAL_EXECUTABLE_TARGETS PCA_demo ) -else (CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) +else ((QT4 OR QT5) AND OPENGL_FOUND AND QGLVIEWER_FOUND) set(PCA_MISSING_DEPS "") - if(NOT CGAL_Qt4_FOUND) + if(NOT CGAL_Qt5_FOUND AND USE_QT5) + set(PCA_MISSING_DEPS "the CGAL Qt5 library, ${PCA_MISSING_DEPS}") + endif() + + if(NOT CGAL_Qt4_FOUND AND NOT USE_QT5) set(PCA_MISSING_DEPS "the CGAL Qt4 library, ${PCA_MISSING_DEPS}") endif() @@ -81,6 +107,10 @@ else (CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) set(PCA_MISSING_DEPS "Qt4, ${PCA_MISSING_DEPS}") endif() + if(NOT QT5_FOUND) + set(PCA_MISSING_DEPS "Qt5, ${PCA_MISSING_DEPS}") + endif() + if(NOT OPENGL_FOUND) set(PCA_MISSING_DEPS "OpenGL, ${PCA_MISSING_DEPS}") endif() @@ -91,4 +121,4 @@ else (CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) message(STATUS "NOTICE: This demo requires ${PCA_MISSING_DEPS} and will not be compiled.") -endif (CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) +endif ((QT4 OR QT5) AND OPENGL_FOUND AND QGLVIEWER_FOUND) diff --git a/Principal_component_analysis/demo/Principal_component_analysis/MainWindow.cpp b/Principal_component_analysis/demo/Principal_component_analysis/MainWindow.cpp index a4b984c5880..6c6ac1b7ed4 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/MainWindow.cpp +++ b/Principal_component_analysis/demo/Principal_component_analysis/MainWindow.cpp @@ -13,6 +13,10 @@ #include "ui_MainWindow.h" +#if QT_VERSION >= 0x050000 +#include +#endif + MainWindow::MainWindow(QWidget* parent) : CGAL::Qt::DemosMainWindow(parent) { diff --git a/Principal_component_analysis/demo/Principal_component_analysis/PCA_demo.cpp b/Principal_component_analysis/demo/Principal_component_analysis/PCA_demo.cpp index 4a5c6c08663..cd8be5fcb4a 100644 --- a/Principal_component_analysis/demo/Principal_component_analysis/PCA_demo.cpp +++ b/Principal_component_analysis/demo/Principal_component_analysis/PCA_demo.cpp @@ -34,9 +34,11 @@ int main(int argc, char **argv) app.setOrganizationName("INRIA"); app.setApplicationName("PCA demo"); - // Import resources from libCGALQt4. + // Import resources from libCGALQt. // See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE - CGAL_QT4_INIT_RESOURCES; + + //New for Qt5 version ! + CGAL_QT_INIT_RESOURCES; MainWindow mainWindow; mainWindow.show(); diff --git a/Surface_mesher/demo/Surface_mesher/CMakeLists.txt b/Surface_mesher/demo/Surface_mesher/CMakeLists.txt index dcee2b5d3f2..30aca0493ff 100644 --- a/Surface_mesher/demo/Surface_mesher/CMakeLists.txt +++ b/Surface_mesher/demo/Surface_mesher/CMakeLists.txt @@ -37,10 +37,12 @@ set( QT_USE_QTMAIN TRUE ) option (USE_QT5 "Use Qt5 version instead of Qt4" OFF) if(USE_QT5) + find_package(CGAL COMPONENTS ImageIO Qt5) include(${CGAL_USE_FILE}) find_package(Qt5) + else (USE_QT5) find_package(CGAL COMPONENTS ImageIO Qt4) @@ -55,6 +57,8 @@ else (USE_QT5) endif() endif (USE_QT5) +include(QtChoice) + if ( CGAL_FOUND AND (QT4 OR QT5)) include( ${CGAL_USE_FILE} ) @@ -95,29 +99,17 @@ if ( CGAL_FOUND AND (QT4 OR QT5)) set(sources ${sources} ${PACKAGE_ROOT}/../Marching_cube/src/mc/ply.c) add_definitions(-DCGAL_SURFACE_MESH_DEMO_USE_MARCHING_CUBE) endif() - - if(QT4) - qt4_automoc( ${sources} ) + + qt_automoc( ${sources} ) - qt4_generate_moc( "surface.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_surface.cpp" ) + qt_generate_moc( "surface.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_surface.cpp" ) set( sources ${sources} moc_surface.cpp) - qt4_wrap_ui( uis ui/values_list.ui ui/mainwindow.ui ui/optionsdialog.ui ui/raw_image.ui ) + qt_wrap_ui( uis ui/values_list.ui ui/mainwindow.ui ui/optionsdialog.ui ui/raw_image.ui ) - qt4_add_resources( qrc_sources values_list.qrc surface_mesher.qrc ) - endif() + qt_add_resources( qrc_sources values_list.qrc surface_mesher.qrc ) - if(QT5) - qt5_generate_moc( "surface.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_surface.cpp" ) - - set( sources ${sources} moc_surface.cpp) - - qt5_wrap_ui(uis ui/values_list.ui ui/mainwindow.ui ui/optionsdialog.ui ui/raw_image.ui) - - qt5_add_resources (qrc_sources values_list.qrc surface_mesher.qrc) - - endif() add_executable ( Surface_mesher ${sources} ${uis} diff --git a/Triangulation_3/demo/Triangulation_3/CMakeLists.txt b/Triangulation_3/demo/Triangulation_3/CMakeLists.txt index 879fd68b834..9afa506d1f9 100644 --- a/Triangulation_3/demo/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/demo/Triangulation_3/CMakeLists.txt @@ -36,6 +36,8 @@ else(USE_QT5) endif(QT4_FOUND) endif (USE_QT5) +include(QtChoice) + find_package(OpenGL) find_package(QGLViewer) @@ -46,22 +48,15 @@ if ( CGAL_FOUND AND (QT4 OR QT5) AND OPENGL_FOUND AND QGLVIEWER_FOUND ) FILE (GLOB CPP *.cpp) - if(QT4) # ui files, created with Qt Designer - qt4_wrap_ui( uis MainWindow.ui ) + qt_wrap_ui( uis MainWindow.ui ) # qrc files (resources files, that contain icons, at least) - qt4_add_resources ( RESOURCE_FILES ./T3_demo.qrc ) + qt_add_resources ( RESOURCE_FILES ./T3_demo.qrc ) # moc files (meta object compiler files, run moc preprocessor on the files with Widget defs) - qt4_automoc( MainWindow.cpp Viewer.cpp PreferenceDlg.cpp ) - endif(QT4) - - if(QT5) - qt5_wrap_ui(uis MainWindow.ui) + qt_automoc( MainWindow.cpp Viewer.cpp PreferenceDlg.cpp ) - qt5_add_resources (RESOURCE_FILES ./T3_demo.qrc) - endif(QT5) # cpp files add_executable ( T3_demo