Skip to content

Commit

Permalink
Merge pull request #7397 from afabri/CGAL-Qt6-GF
Browse files Browse the repository at this point in the history
CGAL:  Qt5 -> Qt6   [ WIP]
  • Loading branch information
sloriot committed Nov 24, 2023
2 parents 5c62ae4 + f0f1d6a commit 05e6889
Show file tree
Hide file tree
Showing 333 changed files with 105,698 additions and 3,199 deletions.
3 changes: 2 additions & 1 deletion .github/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
sudo apt-get update
sudo apt-get install -y libmpfr-dev \
libeigen3-dev qtbase5-dev libqt5sql5-sqlite libqt5opengl5-dev qtscript5-dev \
libqt5svg5-dev qttools5-dev qttools5-dev-tools libboost-dev libinsighttoolkit4-dev zsh
libqt5svg5-dev qttools5-dev qttools5-dev-tools libboost-dev libinsighttoolkit4-dev zsh \
qt6-base-dev qt6-declarative-dev
#update cmake to 3.18.4
sudo apt purge --auto-remove cmake
cd /tmp
Expand Down
5 changes: 2 additions & 3 deletions .github/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
FACTOR=$1
set -ex
cd Polyhedron/demo
LIST_OF_PLUGINS=$(/usr/local/bin/cmake --build . -t help | egrep 'plugin$' |& cut -d\ -f2)
/usr/local/bin/cmake -S Polyhedron -B build -DCGAL_DIR=$2
LIST_OF_PLUGINS=$(/usr/local/bin/cmake --build build -t help | egrep 'plugin$' |& cut -d\ -f2)
PLUGINS_ARRAY=(${LIST_OF_PLUGINS});
NB_OF_PLUGINS=${#PLUGINS_ARRAY[@]}
DEL=$(($NB_OF_PLUGINS / 4))
mkdir build
cd build
/usr/local/bin/cmake -DCGAL_DIR=$2 ../Polyhedron
make -j2 ${PLUGINS_ARRAY[@]:$(($FACTOR * $DEL)):$((($FACTOR + 1) * $DEL))}
2 changes: 1 addition & 1 deletion .github/workflows/cmake-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
mkdir build && cd build && CXX=clang++ cmake -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON -DBUILD_TESTING=ON ..
ctest -L Installation -j $(getconf _NPROCESSORS_ONLN)
cmake-testsuite-with-qt5:
cmake-testsuite-with-qt:

runs-on: ubuntu-latest

Expand Down
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,6 @@ GraphicsView/demo/Triangulation_2/Makefile
GraphicsView/demo/Triangulation_2/Regular_triangulation_2
GraphicsView/demo/Triangulation_2/qrc_*.cxx
GraphicsView/demo/Triangulation_2/ui_*.h
GraphicsView/src/CGAL_Qt5/*.dll
GraphicsView/src/CGAL_Qt5/*.lib
GraphicsView/src/CGAL_Qt5/*.so
GraphicsView/src/CGAL_Qt5/Makefile
GraphicsView/src/CGAL_Qt5/moc_*.cxx
GraphicsView/src/CGAL_Qt5/qrc_*.cxx
HalfedgeDS/test/HalfedgeDS/cgal_test_with_cmake
HalfedgeDS/test/HalfedgeDS/test_hds
HalfedgeDS/test/HalfedgeDS/test_hds_decorator
Expand Down Expand Up @@ -879,7 +873,6 @@ Surface_mesher/demo/Surface_mesher/.*.deps
Surface_mesher/demo/Surface_mesher/.qglviewer.xml
Surface_mesher/demo/Surface_mesher/Makefile
Surface_mesher/demo/Surface_mesher/Surface_mesher
Surface_mesher/demo/Surface_mesher/Surface_mesher_Qt5_Demo
Surface_mesher/demo/Surface_mesher/VTK/Makefile
Surface_mesher/demo/Surface_mesher/VTK/mesh_a_3D_image
Surface_mesher/demo/Surface_mesher/VTK/mesh_a_VTK_3D_image
Expand All @@ -894,7 +887,6 @@ Surface_mesher/demo/Surface_mesher/out*.off
Surface_mesher/demo/Surface_mesher/polyhedron_remesher
Surface_mesher/demo/Surface_mesher/polyhedron_remesher_with_edges
Surface_mesher/demo/Surface_mesher/qrc_*.c*
Surface_mesher/demo/Surface_mesher/qt5-demo
Surface_mesher/demo/Surface_mesher/ui_*.h
Surface_mesher/doxygen
Surface_mesher/examples/Surface_mesher/.*.deps
Expand Down
11 changes: 1 addition & 10 deletions AABB_tree/demo/AABB_tree/AABB_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int main(int argc, char **argv)
app.setOrganizationName("INRIA");
app.setApplicationName("AABB tree demo");

// Import resources from libCGALQt (Qt5).
// Import resources from libCGALQt (Qt6).
CGAL_QT_INIT_RESOURCES;

MainWindow mainWindow;
Expand All @@ -49,12 +49,3 @@ int main(int argc, char **argv)

return app.exec();
}

# include "Scene.cpp"
# include "Scene_moc.cpp"
# include "benchmarks.cpp"
# include "Viewer.cpp"
# include "Viewer_moc.cpp"
# include "MainWindow.cpp"
# include "MainWindow_moc.cpp"

69 changes: 21 additions & 48 deletions AABB_tree/demo/AABB_tree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,73 +6,46 @@ project(AABB_tree_Demo)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)

# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
if(NOT POLICY CMP0070 AND POLICY CMP0053)
# Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning.
cmake_policy(SET CMP0053 OLD)
endif()
# Find CGAL and CGAL Qt6
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6)

if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
# Find Qt6 itself
find_package(Qt6 QUIET COMPONENTS Gui OpenGL)

# Include this package's headers first
include_directories(BEFORE ./ ./include)
if(CGAL_Qt6_FOUND AND Qt6_FOUND)

# Find CGAL and CGAL Qt5
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
add_definitions(-DQT_NO_KEYWORDS)

# Find Qt5 itself
find_package(Qt5 QUIET COMPONENTS Widgets OpenGL)
# Instruct CMake to run moc/ui/rcc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

if(CGAL_Qt5_FOUND AND Qt5_FOUND)

qt5_wrap_ui(UI_FILES MainWindow.ui)

include(AddFileDependencies)

qt5_generate_moc("MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp")
add_file_dependencies(MainWindow_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/MainWindow.h")

qt5_generate_moc("Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp")
add_file_dependencies(Viewer_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Viewer.h")

qt5_generate_moc("Scene.h" "${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp")
add_file_dependencies(Scene_moc.cpp "${CMAKE_CURRENT_SOURCE_DIR}/Scene.h")

qt5_add_resources(CGAL_Qt5_RESOURCE_FILES AABB_demo.qrc)

add_file_dependencies(
AABB_demo.cpp "${CMAKE_CURRENT_BINARY_DIR}/MainWindow_moc.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/Viewer_moc.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/Scene_moc.cpp")

add_executable(
AABB_demo AABB_demo.cpp ${UI_FILES} ${CGAL_Qt5_RESOURCE_FILES}
#${CGAL_Qt5_MOC_FILES}
qt_add_executable(
AABB_demo AABB_demo.cpp Scene.cpp benchmarks.cpp Viewer.cpp MainWindow.cpp
MainWindow.ui AABB_demo.qrc
)
# Link with Qt libraries
target_link_libraries(AABB_demo PRIVATE Qt5::Widgets Qt5::OpenGL
CGAL::CGAL CGAL::CGAL_Qt5)
target_link_libraries(AABB_demo PRIVATE Qt6::Gui Qt6::OpenGL
CGAL::CGAL CGAL::CGAL_Qt6)

add_to_cached_list(CGAL_EXECUTABLE_TARGETS AABB_demo)

include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
cgal_add_compilation_test(AABB_demo)

else(CGAL_Qt5_FOUND AND Qt5_FOUND)
else(CGAL_Qt6_FOUND AND Qt6_FOUND)

set(AABB_MISSING_DEPS "")

if(NOT CGAL_Qt5_FOUND)
set(AABB_MISSING_DEPS "CGAL_Qt5, ${AABB_MISSING_DEPS}")
if(NOT CGAL_Qt6_FOUND)
set(AABB_MISSING_DEPS "CGAL_Qt6, ${AABB_MISSING_DEPS}")
endif()

if(NOT Qt5_FOUND)
set(AABB_MISSING_DEPS "Qt5, ${AABB_MISSING_DEPS}")
if(NOT Qt6_FOUND)
set(AABB_MISSING_DEPS "Qt6, ${AABB_MISSING_DEPS}")
endif()

message("NOTICE: This demo requires ${AABB_MISSING_DEPS}, and will not be compiled.")

endif(CGAL_Qt5_FOUND AND Qt5_FOUND)
endif(CGAL_Qt6_FOUND AND Qt6_FOUND)
10 changes: 5 additions & 5 deletions AABB_tree/demo/AABB_tree/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@
#include <QSettings>
#include <QHeaderView>
#include <QClipboard>
#include <QInputDialog>

#include "ui_MainWindow.h"

MainWindow::MainWindow(QWidget* parent)
: CGAL::Qt::DemosMainWindow(parent)
: CGAL::Qt::DemosMainWindow(parent)
{
ui = new Ui::MainWindow;
ui->setupUi(this);

this->addAboutDemo(":/cgal/AABB_demo/about.html");
this->addAboutCGAL();

// saves some pointers from ui, for latter use.
m_pViewer = ui->viewer;

Expand Down Expand Up @@ -418,7 +422,3 @@ void MainWindow::on_actionCopy_snapshot_triggered()
qb->setImage(snapshot);
QApplication::restoreOverrideCursor();
}




6 changes: 2 additions & 4 deletions AABB_tree/demo/AABB_tree/MainWindow.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtOpenGL/qgl.h>
#include <CGAL/Qt/DemosMainWindow.h>

class QDragEnterEvent;
Expand All @@ -12,7 +11,6 @@ namespace Ui {
class MainWindow;
}


class MainWindow :
public CGAL::Qt::DemosMainWindow
{
Expand All @@ -21,12 +19,12 @@ class MainWindow :
MainWindow(QWidget* parent = nullptr);
~MainWindow();

public slots:
public Q_SLOTS:
void updateViewerBBox();
void open(QString filename);
void setAddKeyFrameKeyboardModifiers(Qt::KeyboardModifiers);

protected slots:
protected Q_SLOTS:

// settings
void quit();
Expand Down
6 changes: 3 additions & 3 deletions AABB_tree/demo/AABB_tree/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ void Scene::draw(CGAL::QGLViewer* viewer)
vao[0].bind();
attrib_buffers(viewer);
rendering_program.bind();
color.setRgbF(0.7,0.0,0.0);
color.setRgbF(0.7f,0.0f,0.0f);
rendering_program.setUniformValue(colorLocation, color);
rendering_program.setUniformValue(fLocation, fMatrix);
gl->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
Expand All @@ -631,7 +631,7 @@ void Scene::draw(CGAL::QGLViewer* viewer)
vao[1].bind();
attrib_buffers(viewer);
rendering_program.bind();
color.setRgbF(0.0,0.7,0.0);
color.setRgbF(0.0f,0.7f,0.0f);
rendering_program.setUniformValue(colorLocation, color);
rendering_program.setUniformValue(fLocation, fMatrix);
gl->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_lines.size()/3));
Expand Down Expand Up @@ -669,7 +669,7 @@ void Scene::draw(CGAL::QGLViewer* viewer)
vao[3].bind();
attrib_buffers(viewer);
rendering_program.bind();
color.setRgbF(1.0,0.0,0.0);
color.setRgbF(1.0f,0.0f,0.0f);
rendering_program.setUniformValue(colorLocation, color);
rendering_program.setUniformValue(fLocation, fMatrix);
gl->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_cut_segments.size()/3));
Expand Down
6 changes: 2 additions & 4 deletions AABB_tree/demo/AABB_tree/Scene.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef SCENE_H
#define SCENE_H

#include <QtOpenGL/qgl.h>
#include <iostream>
#include <cmath>

Expand Down Expand Up @@ -77,7 +76,6 @@ class Scene : public QObject
};

public:
QGLContext* context;
void draw(CGAL::QGLViewer*);
void update_bbox();
Bbox bbox() { return m_bbox; }
Expand Down Expand Up @@ -173,7 +171,7 @@ class Scene : public QObject
void attrib_buffers(CGAL::QGLViewer*);
void compile_shaders();
void compute_texture(int, int, Color_ramp, Color_ramp);
private slots:
private Q_SLOTS:
void updateCutPlane();

public:
Expand Down Expand Up @@ -255,7 +253,7 @@ private slots:



public slots:
public Q_SLOTS:
// cutting plane
void cutting_plane(bool override = false);
void changed();
Expand Down
3 changes: 0 additions & 3 deletions AABB_tree/demo/AABB_tree/Viewer.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include "Viewer.h"
#include "Scene.h"
#include <QMouseEvent>
#include <QGLFunctions>
#include <CGAL/Qt/CreateOpenGLContext.h>

Viewer::Viewer(QWidget* parent)
: CGAL::QGLViewer(parent),
m_pScene(nullptr),
Expand Down
1 change: 1 addition & 0 deletions AABB_tree/demo/AABB_tree/benchmarks.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Scene.h"
#include "Refiner.h"
#include <QInputDialog>
#include <CGAL/Memory_sizer.h>

Expand Down
4 changes: 2 additions & 2 deletions Alpha_shapes_3/demo/Alpha_shapes_3/Alpha_shape_3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ int main(int argc, char** argv)
application.setOrganizationName("GeometryFactory");
application.setApplicationName("Alpha Shape Reconstruction");

// Import resources from libCGALQt (Qt5).
// See https://doc.qt.io/qt-5/qdir.html#Q_INIT_RESOURCE
// Import resources from libCGAL_Qt6
// See https://doc.qt.io/qt-6/qtresource-proxy.html#Q_INIT_RESOURCE

CGAL_QT_INIT_RESOURCES;
Q_INIT_RESOURCE(Alpha_shape_3);
Expand Down
38 changes: 12 additions & 26 deletions Alpha_shapes_3/demo/Alpha_shapes_3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,32 @@ project(Alpha_shapes_3_Demo)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)

# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
if(NOT POLICY CMP0070 AND POLICY CMP0053)
# Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning.
cmake_policy(SET CMP0053 OLD)
endif()
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6)

find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
find_package(Qt6 QUIET COMPONENTS Widgets OpenGL)

find_package(Qt5 QUIET COMPONENTS Widgets OpenGL)

if(CGAL_Qt5_FOUND AND Qt5_FOUND)
if(CGAL_Qt6_FOUND AND Qt6_FOUND)

add_definitions(-DQT_NO_KEYWORDS)

# include(${QT_USE_FILE})
include_directories(BEFORE ./)

# ui file, created with Qt Designer
qt5_wrap_ui(uis MainWindow.ui)
# Instruct CMake to run moc/ui/rcc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

# qrc files (resources files, that contain icons, at least)
qt5_add_resources(CGAL_Qt5_RESOURCE_FILES ./Alpha_shape_3.qrc)
qt_add_executable(Alpha_shape_3 Alpha_shape_3.cpp MainWindow.cpp Viewer.cpp
MainWindow.ui Alpha_shape_3.qrc)

add_executable(
Alpha_shape_3 Alpha_shape_3.cpp MainWindow.cpp Viewer.cpp ${uis}
${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES})
add_to_cached_list(CGAL_EXECUTABLE_TARGETS Alpha_shape_3)

target_link_libraries(Alpha_shape_3 PRIVATE CGAL::CGAL CGAL::CGAL_Qt5
Qt5::Widgets Qt5::OpenGL)
target_link_libraries(Alpha_shape_3 PRIVATE CGAL::CGAL CGAL::CGAL_Qt6
Qt6::Widgets Qt6::OpenGL)

include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
cgal_add_compilation_test(Alpha_shape_3)

else()

message("NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
message("NOTICE: This demo requires CGAL and Qt6, and will not be compiled.")

endif()
Loading

0 comments on commit 05e6889

Please sign in to comment.