From 736f99768a7ab79a6585a5bba8ad75eef5b24b8c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 14 May 2020 16:18:52 +0200 Subject: [PATCH] [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 --- src/libcalamaresui/CMakeLists.txt | 28 ++++++++++--------- .../viewpages/ExecutionViewStep.cpp | 4 ++- src/libcalamaresui/viewpages/Slideshow.cpp | 4 +++ src/libcalamaresui/viewpages/Slideshow.h | 6 ++++ 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index ee7992710..c5c7e9d4b 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -14,11 +14,9 @@ set( calamaresui_SOURCES utils/CalamaresUtilsGui.cpp utils/ImageRegistry.cpp utils/Paste.cpp - utils/Qml.cpp viewpages/BlankViewStep.cpp viewpages/ExecutionViewStep.cpp - viewpages/QmlViewStep.cpp viewpages/Slideshow.cpp viewpages/ViewStep.cpp @@ -45,10 +43,6 @@ if( WITH_PYTHON ) endif() if( WITH_PYTHONQT ) - include_directories(${PYTHON_INCLUDE_DIRS}) - # *_DIRS because we also use extensions - include_directories(${PYTHONQT_INCLUDE_DIRS}) - list( APPEND calamaresui_SOURCES modulesystem/PythonQtViewModule.cpp utils/PythonQtUtils.cpp @@ -57,25 +51,33 @@ if( WITH_PYTHONQT ) viewpages/PythonQtGlobalStorageWrapper.cpp viewpages/PythonQtUtilsWrapper.cpp ) - set( OPTIONAL_PYTHON_LIBRARIES - ${PYTHON_LIBRARIES} - ${PYTHONQT_LIBRARIES} +endif() + +if( WITH_QML ) + list( APPEND calamaresui_SOURCES + utils/Qml.cpp + viewpages/QmlViewStep.cpp ) endif() calamares_add_library( calamaresui SOURCES ${calamaresui_SOURCES} EXPORT_MACRO UIDLLEXPORT_PRO - LINK_PRIVATE_LIBRARIES - ${OPTIONAL_PYTHON_LIBRARIES} LINK_LIBRARIES Qt5::Svg - Qt5::QuickWidgets RESOURCES libcalamaresui.qrc EXPORT CalamaresLibraryDepends 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 ) 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() diff --git a/src/libcalamaresui/viewpages/ExecutionViewStep.cpp b/src/libcalamaresui/viewpages/ExecutionViewStep.cpp index b4c07bff5..2dd4b79df 100644 --- a/src/libcalamaresui/viewpages/ExecutionViewStep.cpp +++ b/src/libcalamaresui/viewpages/ExecutionViewStep.cpp @@ -23,11 +23,11 @@ #include "Slideshow.h" #include "Branding.h" +#include "CalamaresConfig.h" #include "Job.h" #include "JobQueue.h" #include "Settings.h" #include "ViewManager.h" - #include "modulesystem/Module.h" #include "modulesystem/ModuleManager.h" #include "utils/CalamaresUtilsGui.h" @@ -49,10 +49,12 @@ makeSlideshow( QWidget* parent ) { case -1: return new Calamares::SlideshowPictures( parent ); +#ifdef WITH_QML case 1: FALLTHRU; case 2: return new Calamares::SlideshowQML( parent ); +#endif default: cWarning() << "Unknown Branding slideshow API" << api; return new Calamares::SlideshowPictures( parent ); diff --git a/src/libcalamaresui/viewpages/Slideshow.cpp b/src/libcalamaresui/viewpages/Slideshow.cpp index 653c9b99d..85551f797 100644 --- a/src/libcalamaresui/viewpages/Slideshow.cpp +++ b/src/libcalamaresui/viewpages/Slideshow.cpp @@ -28,10 +28,12 @@ #include #include +#ifdef WITH_QML #include #include #include #include +#endif #include #include @@ -41,6 +43,7 @@ namespace Calamares Slideshow::~Slideshow() {} +#ifdef WITH_QML SlideshowQML::SlideshowQML( QWidget* parent ) : Slideshow( parent ) , m_qmlShow( new QQuickWidget ) @@ -173,6 +176,7 @@ SlideshowQML::changeSlideShowState( Action state ) m_state = state; } +#endif SlideshowPictures::SlideshowPictures( QWidget* parent ) : Slideshow( parent ) diff --git a/src/libcalamaresui/viewpages/Slideshow.h b/src/libcalamaresui/viewpages/Slideshow.h index 2296c6d23..f338d44e2 100644 --- a/src/libcalamaresui/viewpages/Slideshow.h +++ b/src/libcalamaresui/viewpages/Slideshow.h @@ -21,15 +21,19 @@ #ifndef LIBCALAMARESUI_SLIDESHOW_H #define LIBCALAMARESUI_SLIDESHOW_H +#include "CalamaresConfig.h" + #include #include #include class QLabel; class QTimer; +#ifdef WITH_QML class QQmlComponent; class QQuickItem; class QQuickWidget; +#endif namespace Calamares { @@ -81,6 +85,7 @@ protected: Action m_state = Stop; }; +#ifdef WITH_QML /** @brief Slideshow using a QML file * * This is the "classic" slideshow in Calamares, which runs some QML @@ -109,6 +114,7 @@ private: QQmlComponent* m_qmlComponent; QQuickItem* m_qmlObject; ///< The actual show }; +#endif /** @brief Slideshow using images *