chore: use Qt 6 by default

This commit is contained in:
Gary Wang 2024-04-05 00:09:49 +08:00
parent 6145925283
commit be20c3d389
No known key found for this signature in database
GPG Key ID: 5D30A4F15EA78760
4 changed files with 15 additions and 19 deletions

View File

@ -15,5 +15,5 @@ jobs:
version: '5.15.2'
- name: Run a qt project
run: |
cmake ./
cmake ./ -DPREFER_QT_5=ON
make

View File

@ -17,7 +17,7 @@ jobs:
run: |
mkdir build
cd build
cmake ../
cmake ../ -DPREFER_QT_5=ON
make
cpack -G DEB
- name: Try install it

View File

@ -1,18 +1,18 @@
# SPDX-FileCopyrightText: 2022 - 2023 Gary Wang <git@blumia.net>
# SPDX-FileCopyrightText: 2022 - 2024 Gary Wang <git@blumia.net>
#
# SPDX-License-Identifier: MIT
project (pineapple-pictures)
cmake_minimum_required (VERSION 3.9.5)
project (pineapple-pictures)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
include (GNUInstallDirs)
include (FeatureSummary)
option (EXIV2_METADATA_SUPPORT "Better image metadata support via libexiv2" ON)
option (PREFER_QT_5 "Prefer to use Qt 5 even if we have Qt 6" ON)
option (PREFER_QT_5 "Prefer to use Qt 5" OFF)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
@ -22,7 +22,7 @@ set (CMAKE_AUTORCC ON)
if (PREFER_QT_5)
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core)
else ()
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
endif ()
if (${QT_VERSION_MAJOR} EQUAL "5")
@ -104,20 +104,21 @@ set (EXE_NAME ppic)
file (GLOB PPIC_TS_FILES app/translations/*.ts)
set (PPIC_CPP_FILES_FOR_I18N ${PPIC_CPP_FILES})
qt_create_translation(PPIC_QM_FILES ${PPIC_CPP_FILES_FOR_I18N} ${PPIC_TS_FILES})
if (WIN32)
list(APPEND PPIC_RC_FILES assets/pineapple-pictures.rc)
endif ()
add_executable (${EXE_NAME}
add_executable (${EXE_NAME} WIN32
${PPIC_HEADER_FILES}
${PPIC_CPP_FILES}
${PPIC_QRC_FILES}
${PPIC_RC_FILES}
${PPIC_QM_FILES}
)
qt_create_translation(PPIC_QM_FILES ${PPIC_CPP_FILES_FOR_I18N} ${PPIC_TS_FILES})
target_sources(${EXE_NAME} PRIVATE ${PPIC_QM_FILES})
target_link_libraries (${EXE_NAME} Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Svg)
if (${QT_VERSION_MAJOR} EQUAL "6")
target_link_libraries (${EXE_NAME} Qt::SvgWidgets)
@ -137,7 +138,7 @@ if (LibExiv2_FOUND)
)
endif ()
if (Qt5DBus_FOUND OR Qt6DBus_FOUND)
if (TARGET Qt5::DBus OR TARGET Qt6::DBus)
target_link_libraries (${EXE_NAME}
Qt${QT_VERSION_MAJOR}::DBus
)
@ -148,11 +149,6 @@ endif()
# Extra build settings
if (WIN32)
set_property (
TARGET ${EXE_NAME}
PROPERTY WIN32_EXECUTABLE true
)
target_compile_definitions(${EXE_NAME} PRIVATE
FLAG_PORTABLE_MODE_SUPPORT=1
)

View File

@ -22,7 +22,7 @@ environment:
KF_BRANCH: kf5
EXIV2_VERSION: "0.27.7"
EXIV2_CMAKE_OPTIONS: "-DEXIV2_BUILD_SAMPLES=OFF -DEXIV2_ENABLE_WIN_UNICODE=ON -DEXIV2_BUILD_EXIV2_COMMAND=OFF"
PPIC_CMAKE_OPTIONS: ""
PPIC_CMAKE_OPTIONS: "-DPREFER_QT_5=ON"
WINDEPLOYQT_ARGS: "--verbose=2 --no-quick-import --no-translations --no-opengl-sw --no-angle --no-system-d3d-compiler"
install:
@ -132,7 +132,7 @@ build_script:
# finally...
- mkdir build
- cd build
- cmake .. -G "Unix Makefiles" %PPIC_CMAKE_OPTIONS% -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_INSTALL_PREFIX='%cd%'
- cmake .. -G "Ninja" %PPIC_CMAKE_OPTIONS% -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX='%cd%'
- cmake --build . --config Release
- cmake --build . --config Release --target install/strip
# fixme: I don't know how to NOT make the binary installed to the ./bin/ folder...