Skip to content

Commit

Permalink
migrated to qt6
Browse files Browse the repository at this point in the history
Merge pull request #429 from wolfseifert/patch-gittyup-qt6
  • Loading branch information
Murmele authored Jan 28, 2025
2 parents 2e02fb7 + 1999466 commit bb91267
Show file tree
Hide file tree
Showing 82 changed files with 306 additions and 279 deletions.
76 changes: 23 additions & 53 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,7 @@ jobs:
fail-fast: false
matrix:
qt:
- version: 5.15.2
check_only: false

- version: 5.12.0
check_only: true
- version: 6.6.0

env:
- name: linux
Expand All @@ -151,7 +147,6 @@ jobs:
ninja_platform: win
qt_platform: windows
qt_arch: win64_msvc2019_64
qt_arch_check_only: win64_msvc2017_64
openssl_arch: VC-WIN64A
msvc_arch: x64
cmake_flags: "-DUSE_BUNDLED_ZLIB=1"
Expand All @@ -161,23 +156,6 @@ jobs:
CXX: clang++
pack: 1

- name: win32
os: windows-latest
ninja_platform: win
qt_platform: windows
qt_arch: win32_msvc2019
qt_arch_check_only: win32_msvc2017
openssl_arch: VC-WIN32
msvc_arch: x86
cmake_flags: "-DUSE_BUNDLED_ZLIB=1"
cmake_env:
CMAKE_RC_FLAGS: "/C 1252"
CC: clang
CXX: clang++
CMAKE_C_FLAGS: -m32
CMAKE_CXX_FLAGS: -m32
pack: 1

steps:
# otherwise the testcases will fail, because signature is invalid
- name: Set git name and email
Expand All @@ -204,9 +182,8 @@ jobs:
perl-version: '5.30'

- name: Install Qt
uses: jurplel/install-qt-action@v3.3.0
uses: jurplel/install-qt-action@v4
timeout-minutes: 10
if: "!matrix.qt.check_only"
with:
version: ${{ matrix.qt.version }}
target: desktop
Expand All @@ -215,18 +192,6 @@ jobs:
install-deps: true
modules: qtwebengine

- name: Install Qt
uses: jurplel/[email protected]
timeout-minutes: 10
if: matrix.qt.check_only
with:
version: ${{ matrix.qt.version }}
target: desktop
host: ${{ matrix.env.qt_platform }}
arch: ${{ matrix.env.qt_arch_check_only }}
install-deps: true
modules: qtwebengine

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v4
with:
Expand Down Expand Up @@ -256,10 +221,6 @@ jobs:
run: |
cd dep/openssl/openssl
# this is necessary until https://github.com/openssl/openssl/issues/18720
# is fixed in OpenSSL 1.1.1r
export CFLAGS=-Wno-error=implicit-function-declaration
./Configure ${{ matrix.env.openssl_arch }} no-shared
make
Expand Down Expand Up @@ -291,7 +252,7 @@ jobs:
# Command copied from flathub build process
- name: Validate appdata file
if: matrix.env.ninja_platform == 'linux' && !matrix.qt.check_only
if: matrix.env.ninja_platform == 'linux'
run: |
echo "Show generated appdata file"
cat ./build/release/rsrc/linux/com.github.Murmele.Gittyup.appdata.xml
Expand All @@ -302,15 +263,15 @@ jobs:
flatpak run --env=G_DEBUG=fatal-criticals org.freedesktop.appstream-glib validate ./build/release/rsrc/linux/com.github.Murmele.Gittyup.appdata.xml
- name: Publish build artifacts
if: matrix.env.pack && !matrix.qt.check_only
if: matrix.env.pack
uses: actions/upload-artifact@v4
with:
path: build/release/pack/Gittyup-*
name: Gittyup ${{ matrix.env.name }}

# Publish only once!
- name: Publish version file
if: matrix.env.pack && !matrix.qt.check_only && matrix.env.name == 'win64'
if: matrix.env.ninja_platform == 'linux'
uses: actions/upload-artifact@v4
with:
path: build/release/Version.txt
Expand All @@ -335,24 +296,31 @@ jobs:
ninja check_no_win32_offscreen
- name: Build Appimage
if: matrix.env.ninja_platform == 'linux' && !matrix.qt.check_only
if: matrix.env.ninja_platform == 'linux'
run: |
cd build/release
sudo apt -y install appstream
sudo apt -y install libfuse2
sudo apt -y install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0
sudo apt -y install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-cursor0 libxkbcommon0 libx11-xcb1
sudo apt -y install libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xinerama0 libxcb-xinput0 libxcb-xkb1 libxcb-xrm0 libxcb-xv0 libxcb-xvmc0 libxcb1
mkdir -p AppDir
DESTDIR=AppDir ninja install
export QTDIR=$RUNNER_WORKSPACE/Qt/${{ matrix.qt.version }}/${{ matrix.env.qt_arch }}
export QT_ROOT_DIR=$QTDIR
rm -rf ./AppDir/usr/include/
strip ./AppDir/usr/bin/cmark ./AppDir/usr/bin/gittyup ./AppDir/usr/bin/indexer ./AppDir/usr/bin/relauncher
wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2)
chmod +x appimagetool-*.AppImage
echo Show QTDIR
ls $QTDIR
echo Show QTDIR plugins
ls $QTDIR/plugins
echo Show QTDIR plugins platforms
ls $QTDIR/plugins/platforms
QTDIR=$QTDIR ./appimagetool-*.AppImage -s deploy ./AppDir/usr/share/applications/*.desktop --appimage-extract-and-run # Bundle EVERYTHING
# Modify the AppDir: move ld-linux into the same directory as the payload application
Expand All @@ -366,7 +334,7 @@ jobs:
#ls -lh Gittyup-*
- name: Publish Appimage
if: matrix.env.ninja_platform == 'linux' && !matrix.qt.check_only
if: matrix.env.ninja_platform == 'linux'
uses: actions/upload-artifact@v4
with:
path: build/release/*.AppImage
Expand Down Expand Up @@ -402,12 +370,13 @@ jobs:
title: 'Latest Build (Development)'
automatic_release_tag: 'development'
files: |
**/artifacts/Gittyup win64/Gittyup*.exe
**/artifacts/Gittyup win32/Gittyup*.exe
**/artifacts/Gittyup macos/Gittyup*.dmg
**/artifacts/GittyupFlatpak/*.flatpak
**/artifacts/GittyupAppImage/Gittyup*.AppImage
# Currently disabled, because we have problems with the theme
# **/artifacts/Gittyup win64/Gittyup*.exe
# **/artifacts/Gittyup macos/Gittyup*.dmg

- name: Update GitHub release (version tag)
uses: marvinpinto/action-automatic-releases@latest
if: ${{ env.IS_RELEASE == 'true'}}
Expand All @@ -417,12 +386,13 @@ jobs:
title: Gittyup Release ${{ steps.version.outputs.VERSION }}
automatic_release_tag: ${{ github.ref_name }}
files: |
**/artifacts/Gittyup win64/Gittyup*.exe
**/artifacts/Gittyup win32/Gittyup*.exe
**/artifacts/Gittyup macos/Gittyup*.dmg
**/artifacts/GittyupFlatpak/*.flatpak
**/artifacts/GittyupAppImage/Gittyup*.AppImage
# Currently disabled, because we have problems with the theme
# **/artifacts/Gittyup win64/Gittyup*.exe
# **/artifacts/Gittyup macos/Gittyup*.dmg

# needed otherwise the docs folder is not available
- name: Checkout repository
if: ${{ env.IS_RELEASE == 'true'}}
Expand Down
12 changes: 4 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,10 @@ else()
endif()

find_package(
Qt5 5.12
Qt6
COMPONENTS ${QT_MODULES} LinguistTools
REQUIRED)
if(FLATPAK)
find_package(
Qt5 5.15
COMPONENTS XcbQpa
REQUIRED)
add_compile_definitions(FLATPAK)
endif()

Expand All @@ -135,7 +131,7 @@ endif()

include(GNUInstallDirs) # Defines some variables as BINDIR, LIBDIR, ...

set(QT_TRANSLATIONS_DIR "${Qt5_DIR}/../../../translations")
set(QT_TRANSLATIONS_DIR "${Qt6_DIR}/../../../translations")
set(QT_TRANSLATIONS_DIR "/usr/share/qt/translations")

if(APPLE)
Expand All @@ -145,8 +141,8 @@ if(APPLE)
# dependencies are to the release libraries (e.g. QtGui_debug depends on
# QtCore). This causes multiple symbol definition errors at application load
# time.
get_target_property(LOCATION Qt5::${QT_MODULE} LOCATION)
set_target_properties(Qt5::${QT_MODULE} PROPERTIES IMPORTED_LOCATION_DEBUG
get_target_property(LOCATION Qt6::${QT_MODULE} LOCATION)
set_target_properties(Qt6::${QT_MODULE} PROPERTIES IMPORTED_LOCATION_DEBUG
${LOCATION})
endforeach()
endif()
Expand Down
2 changes: 1 addition & 1 deletion com.github.Murmele.Gittyup.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
app-id: com.github.Murmele.Gittyup
runtime: org.kde.Platform
runtime-version: 5.15-23.08
runtime-version: 6.7
sdk: org.kde.Sdk
command: gittyup
desktop-file-name-suffix: "" # used to create development version
Expand Down
2 changes: 1 addition & 1 deletion dep/openssl/openssl
Submodule openssl updated 9063 files
2 changes: 1 addition & 1 deletion dep/scintilla/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ target_compile_definitions(

target_include_directories(scintilla PUBLIC ${SCINTILLA_DIR}/src)

target_link_libraries(scintilla Qt5::Widgets lexilla)
target_link_libraries(scintilla Qt6::Widgets lexilla)

set_target_properties(scintilla PROPERTIES AUTOMOC ON)

Expand Down
6 changes: 3 additions & 3 deletions l10n/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/languages.cpp.inc"

if(UPDATE_TRANSLATIONS)
# FIXME: Clean removes the .ts files.
qt5_create_translation(QM_FILES ${SOURCE_FILES} ${TS_FILES})
qt6_create_translation(QM_FILES ${SOURCE_FILES} ${TS_FILES})
else()
qt5_add_translation(QM_FILES ${TS_FILES})
qt6_add_translation(QM_FILES ${TS_FILES})
endif()

add_custom_target(translations DEPENDS ${QM_FILES})
add_dependencies(gittyup translations)

add_library(translation ${LANGUAGE_SOURCE_FILE})
target_include_directories(translation PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(translation Qt5::Core)
target_link_libraries(translation Qt6::Core)

# install language files

Expand Down
25 changes: 15 additions & 10 deletions pack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ if(FLATPAK)
qt_import_plugins(gittyup INCLUDE ${QT_PLUGINS})
elseif(NOT USE_SYSTEM_QT)
foreach(QT_PLUGIN ${QT_PLUGINS})
if(NOT TARGET Qt5::${QT_PLUGIN})
if(NOT TARGET Qt6::${QT_PLUGIN})
if(UNIX OR APPLE)
continue()
endif()
endif()

get_target_property(PLUGIN Qt5::${QT_PLUGIN} LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(PLUGIN Qt6::${QT_PLUGIN} LOCATION_${CMAKE_BUILD_TYPE})
get_filename_component(FILE_NAME ${PLUGIN} NAME)
get_filename_component(DIR ${PLUGIN} DIRECTORY)
get_filename_component(DIR_NAME ${DIR} NAME)
Expand Down Expand Up @@ -78,11 +78,16 @@ elseif(NOT USE_SYSTEM_QT)

# Install Qt libraries.
foreach(QT_MODULE ${QT_MODULES})
get_target_property(QT_LIBRARY Qt5::${QT_MODULE}
get_target_property(QT_LIBRARY Qt6::${QT_MODULE}
LOCATION_${CMAKE_BUILD_TYPE})

if(APPLE)
get_filename_component(QT_FRAMEWORK ${QT_LIBRARY} DIRECTORY)

# FIXME: QT_LIBRARY points directly to the library bin instead of the
# symlink 2 directories above (since qt6)
string(REGEX REPLACE "/Versions/.*" "" QT_FRAMEWORK "${QT_FRAMEWORK}")

set(DEST_DIR ${CONTENTS_DIR}/Frameworks)
install(
DIRECTORY ${QT_FRAMEWORK}
Expand All @@ -102,7 +107,7 @@ elseif(NOT USE_SYSTEM_QT)
else()
# Strip minor and patch version extensions.
get_filename_component(TARGET_NAME_WE ${QT_LIBRARY} NAME_WE)
set(TARGET_NAME ${TARGET_NAME_WE}.so.5)
set(TARGET_NAME ${TARGET_NAME_WE}.so.6)
endif()

install(
Expand Down Expand Up @@ -131,8 +136,8 @@ endif()

# Install XcbQpa library.
if(UNIX AND NOT APPLE)
set(LIB_NAME libQt5XcbQpa)
get_target_property(QT_CORE_LIBRARY Qt5::Core LOCATION)
set(LIB_NAME libQt6XcbQpa)
get_target_property(QT_CORE_LIBRARY Qt6::Core LOCATION)
get_filename_component(LIB_PATH ${QT_CORE_LIBRARY} PATH)
get_filename_component(LIB_EXT ${QT_CORE_LIBRARY} EXT)

Expand All @@ -148,20 +153,20 @@ if(UNIX AND NOT APPLE)
WORLD_READ
WORLD_EXECUTE
COMPONENT ${GITTYUP_NAME}
RENAME ${LIB_NAME}.so.5)
RENAME ${LIB_NAME}.so.6)
endif()

# Install SSL libraries.
if(NOT APPLE)
if(NOT USE_SYSTEM_OPENSSL)
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SSL_LIB_SUFFIX "-1_1-x64.dll")
set(SSL_LIB_SUFFIX "-3-x64.dll")
else()
set(SSL_LIB_SUFFIX "-1_1.dll")
set(SSL_LIB_SUFFIX "-3.dll")
endif()
else()
set(SSL_LIB_SUFFIX ".so.1.1")
set(SSL_LIB_SUFFIX ".so.3")
endif()

foreach(SSL_LIB_NAME ssl crypto)
Expand Down
21 changes: 11 additions & 10 deletions src/app/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,20 @@ static LONG WINAPI exceptionFilter(PEXCEPTION_POINTERS info) {
SYSTEMTIME localTime;
GetLocalTime(&localTime);

char temp[MAX_PATH];
wchar_t temp[MAX_PATH];
GetTempPath(MAX_PATH, temp);

char dir[MAX_PATH];
StringCchPrintf(dir, MAX_PATH, "%sGittyup", temp);
wchar_t dir[MAX_PATH];
const wchar_t *gittyup_name = L"%sGittyup";
StringCchPrintf(dir, MAX_PATH, gittyup_name, temp);
CreateDirectory(dir, NULL);

char fileName[MAX_PATH];
StringCchPrintf(
fileName, MAX_PATH, "%s\\%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp",
dir, GITTYUP_NAME, GITTYUP_VERSION, localTime.wYear, localTime.wMonth,
localTime.wDay, localTime.wHour, localTime.wMinute, localTime.wSecond,
GetCurrentProcessId(), GetCurrentThreadId());
wchar_t fileName[MAX_PATH];
const wchar_t *s = L"%s\\%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp";
StringCchPrintf(fileName, MAX_PATH, s, dir, GITTYUP_NAME, GITTYUP_VERSION,
localTime.wYear, localTime.wMonth, localTime.wDay,
localTime.wHour, localTime.wMinute, localTime.wSecond,
GetCurrentProcessId(), GetCurrentThreadId());

HANDLE dumpFile =
CreateFile(fileName, GENERIC_READ | GENERIC_WRITE,
Expand Down Expand Up @@ -359,7 +360,7 @@ class CopyDataWindow : public QWindow {

protected:
virtual bool nativeEvent(const QByteArray &eventType, void *message,
long *result) Q_DECL_OVERRIDE {
qintptr *result) Q_DECL_OVERRIDE {
MSG *msg = (MSG *)message;

if (msg->message == WM_COPYDATA) {
Expand Down
Loading

0 comments on commit bb91267

Please sign in to comment.