Skip to content

Commit

Permalink
Port to Qt 6
Browse files Browse the repository at this point in the history
  • Loading branch information
plfiorini committed Jul 4, 2024
1 parent 1948836 commit 23601c7
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 39 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ on:
- develop

jobs:
linux-qt5:
uses: lirios/.github/.github/workflows/build-linux-qt5.yml@master
linux-qt6:
uses: lirios/.github/.github/workflows/build-linux-qt6.yml@master
30 changes: 9 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
cmake_minimum_required(VERSION 3.10.0)
cmake_minimum_required(VERSION 3.19)

project("Initial Setup"
VERSION "0.0.0"
DESCRIPTION "QtQuick Wayland compositor and shell"
DESCRIPTION "Initial setup for Liri OS"
LANGUAGES CXX C
)

## Shared macros and functions:
if(NOT LIRI_LOCAL_ECM)
find_package(LiriCMakeShared "2.0.0" REQUIRED NO_MODULE)
list(APPEND CMAKE_MODULE_PATH "${LCS_MODULE_PATH}")
endif()

## Set minimum versions required:
set(QT_MIN_VERSION "5.10.0")

## Add some paths to check for CMake modules:
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_CURRENT_SOURCE_DIR}/cmake/3rdparty")

## Liri specific setup common for all modules:
include(LiriSetup)

## Only build on the appropriate platforms.
if(NOT UNIX OR ANDROID)
message(NOTICE "Skipping the build as the condition \"UNIX OR ANDROID\" is not met.")
return()
endif()

## Find Qt 5:
find_package(Qt5 "${QT_MIN_VERSION}"
CONFIG REQUIRED
## Enable C++17:
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

## Find Qt:
find_package(Qt6
REQUIRED
COMPONENTS
Core
Concurrent
Gui
Qml
Quick
Expand Down
39 changes: 27 additions & 12 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
liri_add_executable(InitialSetup
qt_add_executable(InitialSetup
WIN32 MACOSX_BUNDLE
MANUAL_FINALIZATION
main.cpp
)

set_target_properties(InitialSetup PROPERTIES
OUTPUT_NAME
"liri-initial-setup"
SOURCES
main.cpp
DEFINES
QT_NO_CAST_FROM_ASCII
QT_NO_FOREACH
INITIAL_SETUP_VERSION="${PROJECT_VERSION}"
LIBRARIES
Qt5::Core
Qt5::Gui
Qt5::Qml
)

liri_finalize_executable(InitialSetup)
qt_finalize_executable(InitialSetup)

target_compile_definitions(InitialSetup PRIVATE
QT_NO_CAST_FROM_ASCII
QT_NO_FOREACH
INITIAL_SETUP_VERSION="${PROJECT_VERSION}"
)

target_link_libraries(InitialSetup PRIVATE
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
Qt::QuickControls2
)

install(TARGETS InitialSetup
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
10 changes: 6 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@

#include <QGuiApplication>

using namespace Qt::StringLiterals;

int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
app.setApplicationName(QLatin1String("Liri Initial Setup"));
app.setApplicationName("Liri Initial Setup"_L1);
app.setApplicationVersion(QLatin1String(INITIAL_SETUP_VERSION));
app.setOrganizationDomain(QLatin1String("liri.io"));
app.setOrganizationName(QLatin1String("Liri"));
app.setDesktopFileName(QLatin1String("liri-initial-setup.desktop"));
app.setOrganizationDomain("liri.io"_L1);
app.setOrganizationName("Liri"_L1);
app.setDesktopFileName("liri-initial-setup.desktop"_L1);

return app.exec();
}

0 comments on commit 23601c7

Please sign in to comment.