Qt6: resolve TODOs against missing KF6
- On FreeBSD, no KF6 was available - On KDE Neon Unstable, there are somewhat wonky KF6 packages available - Adjust CMake to find the KDE Neon versions, then fix the C++ code
This commit is contained in:
parent
4b3278058b
commit
8a8860e75c
@ -32,7 +32,7 @@
|
||||
# BUILD_<foo> : choose additional things to build
|
||||
# - TESTING (standard CMake option)
|
||||
# - SCHEMA_TESTING (requires Python, see ci/configvalidator.py)
|
||||
# - KF5Crash (uses KCrash, rather than Calamares internal, for crash reporting)
|
||||
# - BUILD_CRASH_REPORTING (uses KCrash, rather than Calamares internal, for crash reporting)
|
||||
# DEBUG_<foo> : special developer flags for debugging.
|
||||
#
|
||||
# Example usage:
|
||||
@ -85,7 +85,7 @@ option(WITH_QT6 "Use Qt6 instead of Qt5" OFF)
|
||||
# Additional parts to build that do not affect ABI
|
||||
option(BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON)
|
||||
# Options for the calamares executable
|
||||
option(BUILD_KF5Crash "Enable crash reporting with KCrash." ON)
|
||||
option(BUILD_CRASH_REPORTING "Enable crash reporting with KCrash." ON)
|
||||
|
||||
# Possible debugging flags are:
|
||||
# - DEBUG_TIMEZONES draws latitude and longitude lines on the timezone
|
||||
@ -166,21 +166,24 @@ set( _tx_incomplete eo es_PR gu ie ja-Hira kk kn lo lv mk ne_NP
|
||||
if(WITH_QT6)
|
||||
message(STATUS "Building Calamares with Qt6")
|
||||
set(qtname "Qt6")
|
||||
set(kfname "KF5")
|
||||
set(QT_VERSION 6.5.0)
|
||||
set(ECM_VERSION 5.240)
|
||||
set(KF_VERSION 5.103) # KDE Neon weirdness
|
||||
# API that was deprecated before Qt 5.15 causes a compile error
|
||||
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x060400)
|
||||
|
||||
set(BUILD_KF5Crash OFF) # TODO: Qt6
|
||||
else()
|
||||
message(STATUS "Building Calamares with Qt5")
|
||||
set(qtname "Qt5")
|
||||
set(kfname "KF5")
|
||||
set(QT_VERSION 5.15.0)
|
||||
set(ECM_VERSION 5.100)
|
||||
set(KF_VERSION 5.100)
|
||||
# API that was deprecated before Qt 5.15 causes a compile error
|
||||
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050f00)
|
||||
endif()
|
||||
|
||||
set(BOOSTPYTHON_VERSION 1.72.0)
|
||||
set(ECM_VERSION 5.100)
|
||||
set(PYTHONLIBS_VERSION 3.6)
|
||||
set(YAMLCPP_VERSION 0.5.1)
|
||||
|
||||
@ -333,6 +336,7 @@ set_package_properties(
|
||||
# no need to mess with the module path after.
|
||||
find_package(ECM ${ECM_VERSION} NO_MODULE)
|
||||
if(ECM_FOUND)
|
||||
message(STATUS "Found KDE ECM ${ECM_MODULE_PATH}")
|
||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
|
||||
if(BUILD_TESTING)
|
||||
# ECM implies that we can build the tests, too
|
||||
@ -342,20 +346,39 @@ if(ECM_FOUND)
|
||||
include(KDEInstallDirs)
|
||||
endif()
|
||||
|
||||
find_package(KF5 ${ECM_VERSION} QUIET COMPONENTS CoreAddons Crash)
|
||||
find_package(${kfname} ${KF_VERSION} QUIET COMPONENTS CoreAddons)
|
||||
set_package_properties(
|
||||
KF5::CoreAddons
|
||||
${kfname}
|
||||
PROPERTIES
|
||||
TYPE REQUIRED
|
||||
DESCRIPTION "Classes built on QtCore for About Data"
|
||||
DESCRIPTION "KDE Frameworks (CoreAddons)"
|
||||
URL "https://api.kde.org/frameworks/kcoreaddons/"
|
||||
PURPOSE "About Calamares"
|
||||
)
|
||||
if(NOT KF5Crash_FOUND)
|
||||
if(BUILD_KF5Crash)
|
||||
message(WARNING "BUILD_KF5Crash is set, but KF5::Crash is not available.")
|
||||
|
||||
feature_summary(
|
||||
WHAT REQUIRED_PACKAGES_NOT_FOUND
|
||||
FATAL_ON_MISSING_REQUIRED_PACKAGES
|
||||
DESCRIPTION "The following REQUIRED packages were not found:"
|
||||
QUIET_ON_EMPTY
|
||||
)
|
||||
|
||||
#
|
||||
# OPTIONAL DEPENDENCIES
|
||||
#
|
||||
# First, set KF back to optional so that any missing components don't trip us up.
|
||||
set_package_properties(
|
||||
${kfname}
|
||||
PROPERTIES
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
find_package(${kfname} ${KF_VERSION} QUIET COMPONENTS CoreAddons Crash)
|
||||
|
||||
if(NOT TARGET ${kfname}::Crash)
|
||||
if(BUILD_CRASH_REPORTING)
|
||||
message(WARNING "BUILD_CRASH_REPORTING is set, but ${kfname}::Crash is not available.")
|
||||
endif()
|
||||
set(BUILD_KF5Crash OFF)
|
||||
set(BUILD_CRASH_REPORTING OFF)
|
||||
endif()
|
||||
|
||||
find_package(Python ${PYTHONLIBS_VERSION} COMPONENTS Interpreter Development)
|
||||
@ -556,7 +579,7 @@ add_subdirectory(src)
|
||||
add_feature_info(Python ${WITH_PYTHON} "Python job modules")
|
||||
add_feature_info(Qml ${WITH_QML} "QML UI support")
|
||||
add_feature_info(Polkit ${INSTALL_POLKIT} "Install Polkit files")
|
||||
add_feature_info(KCrash ${BUILD_KF5Crash} "Crash dumps via KCrash")
|
||||
add_feature_info(KCrash ${BUILD_CRASH_REPORTING} "Crash dumps via KCrash")
|
||||
|
||||
### CMake infrastructure installation
|
||||
#
|
||||
@ -640,9 +663,7 @@ endif()
|
||||
|
||||
### CMAKE SUMMARY REPORT
|
||||
#
|
||||
if(NOT WITH_QT6) # TODO: Qt6
|
||||
get_directory_property(SKIPPED_MODULES DIRECTORY src/modules DEFINITION LIST_SKIPPED_MODULES)
|
||||
endif()
|
||||
calamares_explain_skipped_modules( ${SKIPPED_MODULES} )
|
||||
|
||||
feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "The following features have been disabled:" QUIET_ON_EMPTY)
|
||||
|
@ -11,15 +11,18 @@
|
||||
# library, which will add definition WITHOUT_KPMcore.
|
||||
#
|
||||
if(NOT TARGET calapmcore)
|
||||
find_package(KPMcore 20.04.0)
|
||||
set_package_properties(
|
||||
KPMcore
|
||||
PROPERTIES
|
||||
URL "https://invent.kde.org/kde/kpmcore"
|
||||
DESCRIPTION "KDE Partitioning library"
|
||||
TYPE RECOMMENDED
|
||||
PURPOSE "For disk partitioning support"
|
||||
)
|
||||
if(NOT WITH_QT6)
|
||||
# TODO: Qt6 how to detect the version of Qt that KPMCore needs?
|
||||
find_package(KPMcore 20.04.0)
|
||||
set_package_properties(
|
||||
KPMcore
|
||||
PROPERTIES
|
||||
URL "https://invent.kde.org/kde/kpmcore"
|
||||
DESCRIPTION "KDE Partitioning library"
|
||||
TYPE RECOMMENDED
|
||||
PURPOSE "For disk partitioning support"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Create an internal Calamares interface to KPMcore
|
||||
# and give it a nice alias name. If kpmcore is not found,
|
||||
|
@ -40,12 +40,10 @@ target_link_libraries(
|
||||
calamares_bin
|
||||
PRIVATE calamares calamaresui calamares-i18n kdsingleapplication ${qtname}::Core ${qtname}::Widgets
|
||||
)
|
||||
if(NOT WITH_QT6) # TODO: Qt6
|
||||
target_link_libraries(calamares_bin PRIVATE KF5::CoreAddons)
|
||||
endif()
|
||||
if(BUILD_KF5Crash)
|
||||
target_link_libraries(calamares_bin PRIVATE KF5::Crash)
|
||||
target_compile_definitions(calamares_bin PRIVATE BUILD_KF5Crash)
|
||||
target_link_libraries(calamares_bin PRIVATE ${kfname}::CoreAddons)
|
||||
if(BUILD_CRASH_REPORTING)
|
||||
target_link_libraries(calamares_bin PRIVATE ${kfname}::Crash)
|
||||
target_compile_definitions(calamares_bin PRIVATE BUILD_CRASH_REPORTING)
|
||||
endif()
|
||||
|
||||
install(TARGETS calamares_bin BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
@ -19,16 +19,9 @@
|
||||
// From 3rdparty/
|
||||
#include "kdsingleapplication.h"
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
||||
// TODO: Qt6
|
||||
// Ignore KAboutData
|
||||
#define HAVE_KABOUTDATA 0
|
||||
#else
|
||||
#include <KCoreAddons/KAboutData>
|
||||
#define HAVE_KABOUTDATA 1
|
||||
#endif
|
||||
#ifdef BUILD_KF5Crash
|
||||
#include <KCrash/KCrash>
|
||||
#include <KAboutData>
|
||||
#ifdef BUILD_CRASH_REPORTING
|
||||
#include <KCrash>
|
||||
#endif
|
||||
|
||||
#include <QCommandLineParser>
|
||||
@ -120,7 +113,6 @@ main( int argc, char* argv[] )
|
||||
#endif
|
||||
CalamaresApplication a( argc, argv );
|
||||
|
||||
#if HAVE_KABOUTDATA
|
||||
KAboutData aboutData( "calamares",
|
||||
"Calamares",
|
||||
a.applicationVersion(),
|
||||
@ -131,10 +123,9 @@ main( int argc, char* argv[] )
|
||||
"https://calamares.io",
|
||||
"https://github.com/calamares/calamares/issues" );
|
||||
KAboutData::setApplicationData( aboutData );
|
||||
#endif
|
||||
a.setApplicationDisplayName( QString() ); // To avoid putting an extra "Calamares/" into the log-file
|
||||
|
||||
#ifdef BUILD_KF5Crash
|
||||
#ifdef BUILD_CRASH_REPORTING
|
||||
KCrash::initialize();
|
||||
// KCrash::setCrashHandler();
|
||||
KCrash::setDrKonqiEnabled( true );
|
||||
|
@ -101,9 +101,7 @@ set_target_properties(
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_INSTALL_FULL_INCLUDEDIR}/libcalamares
|
||||
)
|
||||
target_link_libraries(calamares LINK_PUBLIC yamlcpp::yamlcpp ${qtname}::Core)
|
||||
if(NOT WITH_QT6) # TODO: Qt6
|
||||
target_link_libraries(calamares LINK_PUBLIC KF5::CoreAddons)
|
||||
endif()
|
||||
target_link_libraries(calamares LINK_PUBLIC ${kfname}::CoreAddons)
|
||||
|
||||
### OPTIONAL Automount support (requires dbus)
|
||||
#
|
||||
|
@ -11,16 +11,6 @@
|
||||
#include "StringExpander.h"
|
||||
#include "Logger.h"
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
||||
// TODO: Qt6
|
||||
KWordMacroExpander::~KWordMacroExpander() {};
|
||||
bool
|
||||
KWordMacroExpander::expandMacro( const QString& str, QStringList& ret )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
namespace String
|
||||
|
@ -13,44 +13,7 @@
|
||||
|
||||
#include "DllMacro.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||
#include <KMacroExpander>
|
||||
#else
|
||||
// TODO: Qt6
|
||||
//
|
||||
// Mock up part of KF6
|
||||
#include <QHash>
|
||||
#include <QString>
|
||||
class KMacroExpanderBase
|
||||
{
|
||||
public:
|
||||
QString expandMacrosShellQuote( const QString& c ) { return c; }
|
||||
};
|
||||
class KMacroExpander
|
||||
{
|
||||
public:
|
||||
static QString expandMacros( const QString& source, const QHash< QString, QString > dict, char sep )
|
||||
{
|
||||
return source;
|
||||
}
|
||||
};
|
||||
class KWordMacroExpander : public KMacroExpanderBase
|
||||
{
|
||||
public:
|
||||
KWordMacroExpander( QChar c )
|
||||
: m_escape( c )
|
||||
{
|
||||
}
|
||||
virtual ~KWordMacroExpander();
|
||||
virtual bool expandMacro( const QString& str, QStringList& ret );
|
||||
void expandMacros( QString& s ) {}
|
||||
|
||||
QChar escapeChar() const { return m_escape; }
|
||||
|
||||
private:
|
||||
QChar m_escape;
|
||||
};
|
||||
#endif
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
@ -56,12 +56,9 @@ calamares_add_library(calamaresui
|
||||
SOVERSION ${CALAMARES_SOVERSION}
|
||||
)
|
||||
target_link_libraries(calamaresui PRIVATE yamlcpp::yamlcpp)
|
||||
if(NOT WITH_QT6) # TODO: Qt6
|
||||
if(KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58)
|
||||
target_compile_definitions(calamaresui PRIVATE WITH_KOSRelease)
|
||||
target_link_libraries(calamaresui PRIVATE KF5::CoreAddons)
|
||||
endif()
|
||||
endif()
|
||||
target_compile_definitions(calamaresui PRIVATE WITH_KOSRelease)
|
||||
target_link_libraries(calamaresui PRIVATE ${kfname}::CoreAddons)
|
||||
|
||||
if(WITH_QML)
|
||||
target_link_libraries(calamaresui PUBLIC ${qtname}::QuickWidgets)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user