Skip to content

Commit

Permalink
Migrate to Qt6 (#19)
Browse files Browse the repository at this point in the history
* Updated CI to Qt6.

* Fixed the CI for Qt6.

* Started switching to Qt6. (#16)

Co-authored-by: Alessandro Gatti <[email protected]>

* Updated the CI for Qt6.

* Updated the Linux CI for Qt6.

* Updated the Windows & MacOS CI for Qt6.

* Possibly fixed a new bug introduced by Qt6 on OpenGL objects cleanup.

* Fixed more bugs with OpenGL (due to Qt6 port).

* Updated deploy CI.

* Updated deploy CI for mac and linux.

* Tried to fix linux deploy CI job.

---------

Co-authored-by: Alessandro Gatti <[email protected]>
  • Loading branch information
DorianBDev and agatti authored Aug 12, 2023
1 parent 115e488 commit 04685b0
Show file tree
Hide file tree
Showing 27 changed files with 114 additions and 70 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ jobs:
- uses: actions/checkout@v2

- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v3
with:
version: 5.15.2 # Update Qt version here.
version: 6.2.4 # Update Qt version here.
aqtversion: '>=0.9.7'
modules: 'qtimageformats'

- name: Install Boost
shell: bash
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/build_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ jobs:
- uses: actions/checkout@v2

- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v3
with:
version: 5.15.2 # Update Qt version here.
version: 6.2.4 # Update Qt version here.
aqtversion: '>=0.9.7'
modules: 'qtimageformats'

- name: Build
shell: bash
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ jobs:
- uses: actions/checkout@v2

- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v3
with:
version: 5.15.2 # Update Qt version here.
version: 6.2.4 # Update Qt version here.
aqtversion: '>=0.9.7'
modules: 'qtimageformats'

- name: Install Boost
shell: pwsh
Expand All @@ -41,5 +42,5 @@ jobs:
cd build
cmake --build . --config $BUILD_TYPE --target DegateTests
cd tests/out/bin/$BUILD_TYPE
$Qt5_Dir/bin/windeployqt.exe ./
$Qt6_DIR/bin/windeployqt.exe ./
./DegateTests.exe
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 5.15.2 # Update Qt version here.
version: 6.2.4 # Update Qt version here.
aqtversion: '>=0.9.7'

- name: Install Boost
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/deploy_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ env:
jobs:
build:

runs-on: ubuntu-18.04 # Update Ubuntu version here (might be the oldest LTS for AppImage creation).
runs-on: ubuntu-20.04 # Update Ubuntu version here (might be the oldest LTS for AppImage creation).

steps:
- uses: actions/checkout@v2

- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v3
with:
version: 5.15.2 # Update Qt version here.
version: 6.2.4 # Update Qt version here.
aqtversion: '>=0.9.7'
modules: 'qtimageformats'

- name: Install Boost
shell: pwsh
Expand Down Expand Up @@ -80,10 +81,10 @@ jobs:
run: |
sudo apt install p7zip-full
cd etc/installer
wget https://download.qt.io/online/qtsdkrepository/linux_x64/desktop/tools_ifw/qt.tools.ifw.44/4.4.1-0-202206210640ifw-linux-x64.7z
7z x 4.4.1-0-202206210640ifw-linux-x64.7z -y
./Tools/QtInstallerFramework/4.4/bin/binarycreator --offline-only -c config/config.xml -p packages "Degate_offline_installer_Linux_x64"
./Tools/QtInstallerFramework/4.4/bin/binarycreator --online-only -c config/config.xml -p packages "Degate_online_installer_Linux_x64"
wget https://download.qt.io/online/qtsdkrepository/linux_x64/desktop/tools_ifw/qt.tools.ifw.46/4.6.0-0-202305221011ifw-linux-x64.7z
7z x 4.6.0-0-202305221011ifw-linux-x64.7z -y
./Tools/QtInstallerFramework/4.6/bin/binarycreator --offline-only -c config/config.xml -p packages "Degate_offline_installer_Linux_x64"
./Tools/QtInstallerFramework/4.6/bin/binarycreator --online-only -c config/config.xml -p packages "Degate_online_installer_Linux_x64"
- name: Upload Degate offline installer
uses: actions/upload-artifact@v2
Expand All @@ -101,7 +102,7 @@ jobs:
shell: bash
run: |
cd etc/installer
./Tools/QtInstallerFramework/4.4/bin/repogen -p packages repository
./Tools/QtInstallerFramework/4.6/bin/repogen -p packages repository
- name: Upload Degate update
uses: actions/upload-artifact@v2
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/deploy_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ jobs:
- uses: actions/checkout@v2

- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v3
with:
version: 5.15.2 # Update Qt version here.
version: 6.2.4 # Update Qt version here.
aqtversion: '>=0.9.7'
modules: 'qtimageformats'

- name: Build
shell: bash
Expand All @@ -31,7 +32,7 @@ jobs:
shell: bash
run: |
cd build/out/bin/
$Qt5_Dir/bin/macdeployqt ./Degate.app
$Qt6_DIR/bin/macdeployqt ./Degate.app
- name: Upload Degate binaries
uses: actions/upload-artifact@v2
Expand All @@ -47,10 +48,10 @@ jobs:
brew install p7zip
cp -R build/out/bin/ etc/installer/packages/Degate/data
cd etc/installer
wget https://download.qt.io/online/qtsdkrepository/mac_x64/desktop/tools_ifw/qt.tools.ifw.44/4.4.1-0-202206210643ifw-mac-x64.7z
7z x 4.4.1-0-202206210643ifw-mac-x64.7z -y
./Tools/QtInstallerFramework/4.4/bin/binarycreator --offline-only -c config/config.xml -p packages "mac_deploy_offline/Degate_offline_installer_Mac_x64"
./Tools/QtInstallerFramework/4.4/bin/binarycreator --online-only -c config/config.xml -p packages "mac_deploy_online/Degate_online_installer_Mac_x64"
wget https://download.qt.io/online/qtsdkrepository/mac_x64/desktop/tools_ifw/qt.tools.ifw.46/4.6.0-0-202305221011ifw-mac-x64.7z
7z x 4.6.0-0-202305221011ifw-mac-x64.7z -y
./Tools/QtInstallerFramework/4.6/bin/binarycreator --offline-only -c config/config.xml -p packages "mac_deploy_offline/Degate_offline_installer_Mac_x64"
./Tools/QtInstallerFramework/4.6/bin/binarycreator --online-only -c config/config.xml -p packages "mac_deploy_online/Degate_online_installer_Mac_x64"
- name: Upload Degate offline installer
uses: actions/upload-artifact@v2
Expand All @@ -68,7 +69,7 @@ jobs:
shell: bash
run: |
cd etc/installer
./Tools/QtInstallerFramework/4.4/bin/repogen -p packages repository
./Tools/QtInstallerFramework/4.6/bin/repogen -p packages repository
- name: Upload Degate update
uses: actions/upload-artifact@v2
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/deploy_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ jobs:
- uses: actions/checkout@v2

- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v3
with:
version: 5.15.2 # Update Qt version here.
version: 6.2.4 # Update Qt version here.
aqtversion: '>=0.9.7'
modules: 'qtimageformats'

- name: Install Boost
shell: pwsh
Expand All @@ -39,7 +40,7 @@ jobs:
shell: bash
run: |
cd build/out/bin/$BUILD_TYPE
$Qt5_Dir/bin/windeployqt.exe ./
$Qt6_DIR/bin/windeployqt.exe ./
- name: Upload Degate binaries
uses: actions/upload-artifact@v2
Expand All @@ -61,10 +62,10 @@ jobs:
# Update the Qt Installer Framework (ifw) version here (by providing the exe download link and changing the exe name/path).
run: |
cd etc/installer
C:\msys64\usr\bin\wget.exe https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/tools_ifw/qt.tools.ifw.44/4.4.1-0-202206210642ifw-win-x86.7z
7z.exe x 4.4.1-0-202206210642ifw-win-x86.7z -y
.\Tools\QtInstallerFramework\4.4\bin\binarycreator.exe --offline-only -c config\config.xml -p packages "Degate_offline_installer_Windows_x64.exe"
.\Tools\QtInstallerFramework\4.4\bin\binarycreator.exe --online-only -c config\config.xml -p packages "Degate_online_installer_Windows_x64.exe"
C:\msys64\usr\bin\wget.exe https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/tools_ifw/qt.tools.ifw.46/4.6.0-0-202305221011ifw-win-x86.7z
7z.exe x 4.6.0-0-202305221011ifw-win-x86.7z -y
.\Tools\QtInstallerFramework\4.6\bin\binarycreator.exe --offline-only -c config\config.xml -p packages "Degate_offline_installer_Windows_x64.exe"
.\Tools\QtInstallerFramework\4.6\bin\binarycreator.exe --online-only -c config\config.xml -p packages "Degate_online_installer_Windows_x64.exe"
- name: Upload Degate offline installer
uses: actions/upload-artifact@v2
Expand All @@ -82,7 +83,7 @@ jobs:
shell: cmd
run: |
cd etc/installer
.\Tools\QtInstallerFramework\4.4\bin\repogen.exe -p packages repository
.\Tools\QtInstallerFramework\4.6\bin\repogen.exe -p packages repository
- name: Upload Degate update
uses: actions/upload-artifact@v2
Expand Down
29 changes: 17 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ set(CMAKE_VERBOSE_MAKEFILE true)
# Set flags
#
if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -fno-inline -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -fno-inline")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
endif()
Expand Down Expand Up @@ -85,8 +85,8 @@ include_directories(${Boost_INCLUDE_DIRS})
set(LIBS ${Boost_LIBRARIES})

############# Qt
find_package(Qt5 COMPONENTS Core Widgets Gui Xml OpenGL Concurrent LinguistTools REQUIRED)
set(LIBS ${LIBS} Qt5::Widgets Qt5::Gui Qt5::Core Qt5::Xml Qt5::OpenGL Qt5::Concurrent)
find_package(Qt6 COMPONENTS Core Widgets Gui Xml OpenGL OpenGLWidgets Concurrent LinguistTools REQUIRED)
set(LIBS ${LIBS} Qt6::Widgets Qt6::Gui Qt6::Core Qt6::Xml Qt6::OpenGL Qt6::OpenGLWidgets Qt6::Concurrent)


############################################################################
Expand All @@ -96,12 +96,12 @@ set(LIBS ${LIBS} Qt5::Widgets Qt5::Gui Qt5::Core Qt5::Xml Qt5::OpenGL Qt5::Concu
#
# Configuration
#
if (CMAKE_SIZEOF_VOID_P MATCHES 8) # if x64
message(STATUS "x64 configuration")
set(CONFIGURATION "x64")
else() # if x86
message(STATUS "x86 configuration")
set(CONFIGURATION "x86")
if (CMAKE_SIZEOF_VOID_P MATCHES 8) # if 64-bits
message(STATUS "64 bits configuration")
set(CONFIGURATION "BUILD_64")
else() # if 32-bits
message(STATUS "32 bits configuration")
set(CONFIGURATION "BUILD_32")
endif()

#
Expand Down Expand Up @@ -147,10 +147,15 @@ SET(TRANSLATION_FILES

list(TRANSFORM TRANSLATION_FILES PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/res/languages/)

# Redefine "qt5_create_translation" function because of a bug (it originally parse all boost files, and make the build VERY slow)
include(${CMAKE_CURRENT_SOURCE_DIR}/etc/cmake/Qt5LinguistToolsMacros.cmake)
# Redefine "qt6_create_translation" function because of a bug (it originally parse all boost files, and make the build VERY slow)
include(${CMAKE_CURRENT_SOURCE_DIR}/etc/cmake/Qt6LinguistToolsMacros.cmake)

qt5_create_translation(QM_FILES ${SRC_FILES} ${TRANSLATION_FILES} OPTIONS -no-obsolete)
# TODO: Figure out why this is needed.
if (WIN32)
qt6_create_translation(QM_FILES ${SRC_FILES} ${TRANSLATION_FILES})
else ()
qt6_create_translation(QM_FILES ${SRC_FILES} ${TRANSLATION_FILES} OPTIONS "-no-obsolete")
endif ()

configure_file(res/languages/translations.qrc ${CMAKE_BINARY_DIR} COPYONLY)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
include(CMakeParseArguments)

# redefine this function because of a bug (it originally parse all boost files, and make the build VERY slow)
function(QT5_CREATE_TRANSLATION _qm_files)
function(QT6_CREATE_TRANSLATION _qm_files)
set(options)
set(oneValueArgs)
set(multiValueArgs OPTIONS)
Expand Down Expand Up @@ -82,7 +82,7 @@ function(QT5_CREATE_TRANSLATION _qm_files)
get_source_file_property(_qm_output_location ${_ts_file} OUTPUT_LOCATION)

add_custom_command(OUTPUT ${_tmpts_file}
COMMAND ${Qt5_LUPDATE_EXECUTABLE}
COMMAND ${Qt6_LUPDATE_EXECUTABLE}
ARGS ${_lupdate_options} "@${_ts_lst_file}" -ts ${_ts_file}
COMMAND ${CMAKE_COMMAND} -E copy ${_ts_file} ${_tmpts_file}
DEPENDS ${_my_sources}
Expand All @@ -93,6 +93,6 @@ function(QT5_CREATE_TRANSLATION _qm_files)
endif()

endforeach()
qt5_add_translation(${_qm_files} ${_my_temptsfiles})
qt6_add_translation(${_qm_files} ${_my_temptsfiles})
set(${_qm_files} ${${_qm_files}} PARENT_SCOPE)
endfunction()
2 changes: 1 addition & 1 deletion src/Core/LogicModel/Gate/GateLibraryExporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void GateLibraryExporter::export_data(std::string const& filename, GateLibrary_s
}

QTextStream stream(&file);
stream.setCodec("UTF-8");
stream.setEncoding(QStringConverter::Utf8);
stream << doc.toString();

file.close();
Expand Down
2 changes: 1 addition & 1 deletion src/Core/LogicModel/LogicModelExporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void LogicModelExporter::export_data(std::string const& filename, LogicModel_shp
}

QTextStream stream(&file);
stream.setCodec("UTF-8");
stream.setEncoding(QStringConverter::Utf8);
stream << doc.toString();

file.close();
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Project/ProjectExporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void ProjectExporter::export_data(std::string const& filename, const Project_shp
}

QTextStream stream(&file);
stream.setCodec("UTF-8");
stream.setEncoding(QStringConverter::Utf8);
stream << doc.toString();

file.close();
Expand Down
2 changes: 1 addition & 1 deletion src/Core/RuleCheck/RCVBlacklistExporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void RCVBlacklistExporter::export_data(std::string const& filename,
}

QTextStream stream(&file);
stream.setCodec("UTF-8");
stream.setEncoding(QStringConverter::Utf8);
stream << doc.toString();

file.close();
Expand Down
9 changes: 9 additions & 0 deletions src/Core/Utils/MemoryMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,17 @@ namespace degate
return RET_ERR;
}

#ifdef SYS_APPLE

struct stat inf;
if (fstat(file, &inf) < 0)

#else

struct stat64 inf;
if (fstat64(file, &inf) < 0)

#endif
{
debug(TM, "can't get the size of file: %s", filename.c_str());
return RET_ERR;
Expand Down
4 changes: 2 additions & 2 deletions src/Core/XML/XMLImporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace degate

const QString attribute = node.attribute(QString::fromStdString(attribute_str), 0);

if (attribute == 0)
if (attribute.isNull())
{
throw XMLAttributeMissingException(std::string("attribute is not present: ") + attribute_str);
}
Expand All @@ -69,7 +69,7 @@ namespace degate

const QString attribute = node.attribute(QString::fromStdString(attribute_str), 0);

if (attribute == 0) return default_value;
if (attribute.isNull()) return default_value;
else return parse_number<T>(attribute.toStdString());
}

Expand Down
3 changes: 3 additions & 0 deletions src/GUI/Dialog/GateEditDialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
#include "GateEditDialog.h"
#include "TerminalDialog.h"

#include <QFileDialog>
#include <QMessageBox>

namespace degate
{
// Entity tab
Expand Down
1 change: 1 addition & 0 deletions src/GUI/Dialog/GateEditDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <QDialogButtonBox>
#include <QLabel>
#include <QLineEdit>
#include <QTextEdit>
#include <QComboBox>
#include <QPushButton>
#include <QColorDialog>
Expand Down
2 changes: 2 additions & 0 deletions src/GUI/Dialog/GateLibraryDialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#include "GateLibraryDialog.h"

#include <QMessageBox>

namespace degate
{
GateLibraryDialog::GateLibraryDialog(QWidget* parent, const Project_shptr& project)
Expand Down
2 changes: 1 addition & 1 deletion src/GUI/Dialog/GateListDialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace degate

// ID Filter
id_filter_label.setText(tr("ID filter:"));
id_filter_edit.setValidator(new QRegExpValidator(QRegExp("[0-9]*"), this));
id_filter_edit.setValidator(new QRegularExpressionValidator(QRegularExpression("[0-9]*"), this));

// Gate template name filter
gate_template_name_filter_label.setText(tr("Gate template filter:"));
Expand Down
1 change: 1 addition & 0 deletions src/GUI/Dialog/PortPlacementDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "GUI/Widget/PortPlacementWidget.h"

#include <QDialog>
#include <QPushButton>
#include <QVBoxLayout>

namespace degate
Expand Down
Loading

0 comments on commit 04685b0

Please sign in to comment.