Skip to content

Commit

Permalink
chore: use Qt 6 by default
Browse files Browse the repository at this point in the history
  • Loading branch information
BLumia committed Apr 5, 2024
1 parent 6145925 commit be20c3d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
version: '5.15.2'
- name: Run a qt project
run: |
cmake ./
cmake ./ -DPREFER_QT_5=ON
make
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: |
mkdir build
cd build
cmake ../
cmake ../ -DPREFER_QT_5=ON
make
cpack -G DEB
- name: Try install it
Expand Down
26 changes: 11 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# SPDX-FileCopyrightText: 2022 - 2023 Gary Wang <[email protected]>
# SPDX-FileCopyrightText: 2022 - 2024 Gary Wang <[email protected]>
#
# 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)
Expand All @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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
)
Expand All @@ -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
)
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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...
Expand Down

0 comments on commit be20c3d

Please sign in to comment.