packagechooser: Adapt to Qt6

While here, deal with the WITH_ -> BUILD_ change of options.
This commit is contained in:
Adriaan de Groot 2023-09-05 22:58:29 +02:00
parent 07e7757c31
commit d7df1a8eca
4 changed files with 23 additions and 22 deletions

View File

@ -20,19 +20,21 @@
# SKIP_MODULES : a space or semicolon-separated list of directory names # SKIP_MODULES : a space or semicolon-separated list of directory names
# under src/modules that should not be built. # under src/modules that should not be built.
# USE_<foo> : fills in SKIP_MODULES for modules called <foo>-<something>. # USE_<foo> : fills in SKIP_MODULES for modules called <foo>-<something>.
# WITH_QT6 : use Qt6, rather than Qt5 (default to OFF).
# WITH_<foo> : try to enable <foo> (these usually default to ON). For # WITH_<foo> : try to enable <foo> (these usually default to ON). For
# a list of WITH_<foo> grep CMakeCache.txt after running # a list of WITH_<foo> grep CMakeCache.txt after running
# CMake once. These affect the ABI offered by Calamares. # CMake once. These affect the ABI offered by Calamares.
# - PYTHON (enable Python Job modules) # - PYTHON (enable Python Job modules)
# - QML (enable QML UI View modules) # - QML (enable QML UI View modules)
# - QT6 (use Qt6 rather than Qt5, default to OFF)
# The WITH_* options affect the ABI of Calamares: you must # The WITH_* options affect the ABI of Calamares: you must
# build (C++) modules for Calamares with the same WITH_* # build (C++) modules for Calamares with the same WITH_*
# settings, or they may not load at all. # settings, or they may not load at all.
# BUILD_<foo> : choose additional things to build # BUILD_<foo> : choose additional things to build
# - TESTING (standard CMake option) # - APPDATA (use AppData in packagechooser, requires QtXml)
# - SCHEMA_TESTING (requires Python, see ci/configvalidator.py) # - APPSTREAM (use AppStream in packagechooser, requires libappstream-qt)
# - BUILD_CRASH_REPORTING (uses KCrash, rather than Calamares internal, for crash reporting) # - BUILD_CRASH_REPORTING (uses KCrash, rather than Calamares internal, for crash reporting)
# - SCHEMA_TESTING (requires Python, see ci/configvalidator.py)
# - TESTING (standard CMake option)
# DEBUG_<foo> : special developer flags for debugging. # DEBUG_<foo> : special developer flags for debugging.
# #
# Example usage: # Example usage:

View File

@ -3,20 +3,19 @@
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org> # SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: BSD-2-Clause # SPDX-License-Identifier: BSD-2-Clause
# #
find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) find_package(${qtname} COMPONENTS Core Gui Widgets REQUIRED)
set(_extra_libraries "") set(_extra_libraries "")
set(_extra_src "") set(_extra_src "")
### OPTIONAL AppData XML support in PackageModel ### OPTIONAL AppData XML support in PackageModel
# #
# #
# TODO:3.3:WITH->BUILD (this doesn't affect the ABI offered by Calamares) option(BUILD_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON)
option(WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON) if(BUILD_APPDATA)
if(WITH_APPDATA) find_package(${qtname} COMPONENTS Xml)
find_package(Qt5 COMPONENTS Xml) if(TARGET ${qtname}::Xml)
if(Qt5Xml_FOUND)
add_definitions(-DHAVE_APPDATA) add_definitions(-DHAVE_APPDATA)
list(APPEND _extra_libraries Qt5::Xml) list(APPEND _extra_libraries ${qtname}::Xml)
list(APPEND _extra_src ItemAppData.cpp) list(APPEND _extra_src ItemAppData.cpp)
endif() endif()
endif() endif()
@ -24,8 +23,8 @@ endif()
### OPTIONAL AppStream support in PackageModel ### OPTIONAL AppStream support in PackageModel
# #
# #
option(WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON) option(BUILD_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON)
if(WITH_APPSTREAM) if(BUILD_APPSTREAM)
find_package(AppStreamQt) find_package(AppStreamQt)
set_package_properties( set_package_properties(
AppStreamQt AppStreamQt

View File

@ -23,6 +23,7 @@
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "compat/Variant.h"
#include "packages/Globals.h" #include "packages/Globals.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/Variant.h" #include "utils/Variant.h"
@ -175,7 +176,7 @@ Config::updateGlobalStorage( const QStringList& selected ) const
if ( gs->contains( "netinstallSelect" ) ) if ( gs->contains( "netinstallSelect" ) )
{ {
auto selectedOrig = gs->value( "netinstallSelect" ); auto selectedOrig = gs->value( "netinstallSelect" );
if ( selectedOrig.canConvert( QVariant::StringList ) ) if ( selectedOrig.canConvert< QStringList >() )
{ {
newSelected += selectedOrig.toStringList(); newSelected += selectedOrig.toStringList();
} }

View File

@ -9,7 +9,7 @@ if(NOT WITH_QML)
return() return()
endif() endif()
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Core) find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED Core)
# Add optional libraries here # Add optional libraries here
set(USER_EXTRA_LIB) set(USER_EXTRA_LIB)
@ -21,13 +21,12 @@ include_directories(${_packagechooser})
### OPTIONAL AppData XML support in PackageModel ### OPTIONAL AppData XML support in PackageModel
# #
# #
# TODO:3.3:WITH->BUILD (this doesn't affect the ABI offered by Calamares) option(BUILD_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON)
option(WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON) if(BUILD_APPDATA)
if(WITH_APPDATA) find_package(${qtname} COMPONENTS Xml)
find_package(Qt5 COMPONENTS Xml) if(TARGET ${qtname}::Xml)
if(Qt5Xml_FOUND)
add_definitions(-DHAVE_APPDATA) add_definitions(-DHAVE_APPDATA)
list(APPEND _extra_libraries Qt5::Xml) list(APPEND _extra_libraries ${qtname}::Xml)
list(APPEND _extra_src ${_packagechooser}/ItemAppData.cpp) list(APPEND _extra_src ${_packagechooser}/ItemAppData.cpp)
endif() endif()
endif() endif()
@ -35,8 +34,8 @@ endif()
### OPTIONAL AppStream support in PackageModel ### OPTIONAL AppStream support in PackageModel
# #
# #
option(WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON) option(BUILD_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON)
if(WITH_APPSTREAM) if(BUILD_APPSTREAM)
find_package(AppStreamQt) find_package(AppStreamQt)
set_package_properties( set_package_properties(
AppStreamQt AppStreamQt