[libcalamaresui] Don't build QML bits if they're not wanted

When WITH_QML is off (by explicit choice)

- don't build the QmlViewStep
- don't build the QML slideshow
This commit is contained in:
Adriaan de Groot 2020-05-14 16:18:52 +02:00
parent 47979555fe
commit 736f99768a
4 changed files with 28 additions and 14 deletions

View File

@ -14,11 +14,9 @@ set( calamaresui_SOURCES
utils/CalamaresUtilsGui.cpp utils/CalamaresUtilsGui.cpp
utils/ImageRegistry.cpp utils/ImageRegistry.cpp
utils/Paste.cpp utils/Paste.cpp
utils/Qml.cpp
viewpages/BlankViewStep.cpp viewpages/BlankViewStep.cpp
viewpages/ExecutionViewStep.cpp viewpages/ExecutionViewStep.cpp
viewpages/QmlViewStep.cpp
viewpages/Slideshow.cpp viewpages/Slideshow.cpp
viewpages/ViewStep.cpp viewpages/ViewStep.cpp
@ -45,10 +43,6 @@ if( WITH_PYTHON )
endif() endif()
if( WITH_PYTHONQT ) if( WITH_PYTHONQT )
include_directories(${PYTHON_INCLUDE_DIRS})
# *_DIRS because we also use extensions
include_directories(${PYTHONQT_INCLUDE_DIRS})
list( APPEND calamaresui_SOURCES list( APPEND calamaresui_SOURCES
modulesystem/PythonQtViewModule.cpp modulesystem/PythonQtViewModule.cpp
utils/PythonQtUtils.cpp utils/PythonQtUtils.cpp
@ -57,25 +51,33 @@ if( WITH_PYTHONQT )
viewpages/PythonQtGlobalStorageWrapper.cpp viewpages/PythonQtGlobalStorageWrapper.cpp
viewpages/PythonQtUtilsWrapper.cpp viewpages/PythonQtUtilsWrapper.cpp
) )
set( OPTIONAL_PYTHON_LIBRARIES endif()
${PYTHON_LIBRARIES}
${PYTHONQT_LIBRARIES} if( WITH_QML )
list( APPEND calamaresui_SOURCES
utils/Qml.cpp
viewpages/QmlViewStep.cpp
) )
endif() endif()
calamares_add_library( calamaresui calamares_add_library( calamaresui
SOURCES ${calamaresui_SOURCES} SOURCES ${calamaresui_SOURCES}
EXPORT_MACRO UIDLLEXPORT_PRO EXPORT_MACRO UIDLLEXPORT_PRO
LINK_PRIVATE_LIBRARIES
${OPTIONAL_PYTHON_LIBRARIES}
LINK_LIBRARIES LINK_LIBRARIES
Qt5::Svg Qt5::Svg
Qt5::QuickWidgets
RESOURCES libcalamaresui.qrc RESOURCES libcalamaresui.qrc
EXPORT CalamaresLibraryDepends EXPORT CalamaresLibraryDepends
VERSION ${CALAMARES_VERSION_SHORT} VERSION ${CALAMARES_VERSION_SHORT}
) )
if ( KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58 ) if( KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58 )
target_compile_definitions( calamaresui PRIVATE WITH_KOSRelease ) target_compile_definitions( calamaresui PRIVATE WITH_KOSRelease )
endif() endif()
if( WITH_PYTHONQT )
# *_DIRS because we also use extensions
target_include_directories( calamaresui PRIVATE ${PYTHON_INCLUDE_DIRS} ${PYTHONQT_INCLUDE_DIRS} )
target_link_libraries( calamaresui PRIVATE ${PYTHON_LIBRARIES} ${PYTHONQT_LIBRARIES} )
endif()
if( WITH_QML )
target_link_libraries( calamaresui PUBLIC Qt5::QuickWidgets )
endif()

View File

@ -23,11 +23,11 @@
#include "Slideshow.h" #include "Slideshow.h"
#include "Branding.h" #include "Branding.h"
#include "CalamaresConfig.h"
#include "Job.h" #include "Job.h"
#include "JobQueue.h" #include "JobQueue.h"
#include "Settings.h" #include "Settings.h"
#include "ViewManager.h" #include "ViewManager.h"
#include "modulesystem/Module.h" #include "modulesystem/Module.h"
#include "modulesystem/ModuleManager.h" #include "modulesystem/ModuleManager.h"
#include "utils/CalamaresUtilsGui.h" #include "utils/CalamaresUtilsGui.h"
@ -49,10 +49,12 @@ makeSlideshow( QWidget* parent )
{ {
case -1: case -1:
return new Calamares::SlideshowPictures( parent ); return new Calamares::SlideshowPictures( parent );
#ifdef WITH_QML
case 1: case 1:
FALLTHRU; FALLTHRU;
case 2: case 2:
return new Calamares::SlideshowQML( parent ); return new Calamares::SlideshowQML( parent );
#endif
default: default:
cWarning() << "Unknown Branding slideshow API" << api; cWarning() << "Unknown Branding slideshow API" << api;
return new Calamares::SlideshowPictures( parent ); return new Calamares::SlideshowPictures( parent );

View File

@ -28,10 +28,12 @@
#include <QLabel> #include <QLabel>
#include <QMutexLocker> #include <QMutexLocker>
#ifdef WITH_QML
#include <QQmlComponent> #include <QQmlComponent>
#include <QQmlEngine> #include <QQmlEngine>
#include <QQuickItem> #include <QQuickItem>
#include <QQuickWidget> #include <QQuickWidget>
#endif
#include <QTimer> #include <QTimer>
#include <chrono> #include <chrono>
@ -41,6 +43,7 @@ namespace Calamares
Slideshow::~Slideshow() {} Slideshow::~Slideshow() {}
#ifdef WITH_QML
SlideshowQML::SlideshowQML( QWidget* parent ) SlideshowQML::SlideshowQML( QWidget* parent )
: Slideshow( parent ) : Slideshow( parent )
, m_qmlShow( new QQuickWidget ) , m_qmlShow( new QQuickWidget )
@ -173,6 +176,7 @@ SlideshowQML::changeSlideShowState( Action state )
m_state = state; m_state = state;
} }
#endif
SlideshowPictures::SlideshowPictures( QWidget* parent ) SlideshowPictures::SlideshowPictures( QWidget* parent )
: Slideshow( parent ) : Slideshow( parent )

View File

@ -21,15 +21,19 @@
#ifndef LIBCALAMARESUI_SLIDESHOW_H #ifndef LIBCALAMARESUI_SLIDESHOW_H
#define LIBCALAMARESUI_SLIDESHOW_H #define LIBCALAMARESUI_SLIDESHOW_H
#include "CalamaresConfig.h"
#include <QMutex> #include <QMutex>
#include <QStringList> #include <QStringList>
#include <QWidget> #include <QWidget>
class QLabel; class QLabel;
class QTimer; class QTimer;
#ifdef WITH_QML
class QQmlComponent; class QQmlComponent;
class QQuickItem; class QQuickItem;
class QQuickWidget; class QQuickWidget;
#endif
namespace Calamares namespace Calamares
{ {
@ -81,6 +85,7 @@ protected:
Action m_state = Stop; Action m_state = Stop;
}; };
#ifdef WITH_QML
/** @brief Slideshow using a QML file /** @brief Slideshow using a QML file
* *
* This is the "classic" slideshow in Calamares, which runs some QML * This is the "classic" slideshow in Calamares, which runs some QML
@ -109,6 +114,7 @@ private:
QQmlComponent* m_qmlComponent; QQmlComponent* m_qmlComponent;
QQuickItem* m_qmlObject; ///< The actual show QQuickItem* m_qmlObject; ///< The actual show
}; };
#endif
/** @brief Slideshow using images /** @brief Slideshow using images
* *