mirror of
https://github.com/redstrate/Astra.git
synced 2025-07-04 16:57:44 +00:00
Make Qt6WebView optional
This is only useful on the Steam Deck, and not needed on Windows at all
This commit is contained in:
parent
1cbc2bcf42
commit
f6802c59fb
3 changed files with 20 additions and 4 deletions
|
@ -6,6 +6,7 @@ project(Astra VERSION 0.6.0 LANGUAGES CXX)
|
|||
|
||||
# build options used for distributors
|
||||
option(BUILD_FLATPAK "Build for Flatpak." OFF)
|
||||
option(BUILD_WEBVIEW "Build support for the integrated web browser. Only used on the Steam Deck." OFF)
|
||||
|
||||
# options for features you may want or need
|
||||
if (NOT WIN32 AND NOT APPLE)
|
||||
|
@ -43,6 +44,9 @@ find_package(Qt6 ${QT_MIN_VERSION} REQUIRED COMPONENTS
|
|||
WebView
|
||||
Concurrent
|
||||
Test)
|
||||
if (BUILD_WEBVIEW)
|
||||
find_package(Qt6WebView ${QT_MIN_VERSION} REQUIRED)
|
||||
endif ()
|
||||
find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami I18n Config CoreAddons Archive)
|
||||
find_package(QCoro6 REQUIRED COMPONENTS Core Network Qml)
|
||||
qcoro_enable_coroutines()
|
||||
|
|
|
@ -138,7 +138,6 @@ target_link_libraries(astra PRIVATE
|
|||
Qt6::Widgets
|
||||
Qt6::Quick
|
||||
Qt6::QuickControls2
|
||||
Qt6::WebView
|
||||
Qt6::Concurrent
|
||||
KF6::Kirigami
|
||||
KF6::I18n
|
||||
|
@ -149,6 +148,12 @@ target_link_libraries(astra PRIVATE
|
|||
QCoro::Core
|
||||
QCoro::Network
|
||||
QCoro::Qml)
|
||||
if (BUILD_WEBVIEW)
|
||||
target_link_libraries(astra PRIVATE
|
||||
Qt6::WebView
|
||||
)
|
||||
target_compile_definitions(astra PRIVATE HAVE_WEBVIEW)
|
||||
endif ()
|
||||
if (NOT MSVC)
|
||||
target_compile_options(astra PRIVATE -fexceptions)
|
||||
endif ()
|
||||
|
@ -164,7 +169,9 @@ endif ()
|
|||
|
||||
install(TARGETS astra ${KF6_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
|
||||
qt_generate_deploy_app_script(
|
||||
qt_finalize_target(astra)
|
||||
|
||||
qt_generate_deploy_qml_app_script(
|
||||
TARGET astra
|
||||
OUTPUT_SCRIPT deploy_script
|
||||
NO_UNSUPPORTED_PLATFORM_ERROR
|
||||
|
|
|
@ -8,10 +8,13 @@
|
|||
#include <QCommandLineParser>
|
||||
#include <QMessageBox>
|
||||
#include <QQuickStyle>
|
||||
#include <QtWebView>
|
||||
#include <kdsingleapplication.h>
|
||||
#include <qcoroqml.h>
|
||||
|
||||
#ifdef HAVE_WEBVIEW
|
||||
#include <QtWebView>
|
||||
#endif
|
||||
|
||||
#include "astra-version.h"
|
||||
#include "compatibilitytoolinstaller.h"
|
||||
#include "gameinstaller.h"
|
||||
|
@ -24,14 +27,16 @@ using namespace Qt::StringLiterals;
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef HAVE_WEBVIEW
|
||||
QtWebView::initialize();
|
||||
#endif
|
||||
|
||||
if (qEnvironmentVariable("SteamDeck") == QStringLiteral("1")) {
|
||||
qputenv("QT_SCALE_FACTOR", "1.25");
|
||||
qputenv("QT_QUICK_CONTROLS_MOBILE", "1");
|
||||
}
|
||||
|
||||
QApplication app(argc, argv);
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
KDSingleApplication singleApplication;
|
||||
if (!singleApplication.isPrimaryInstance()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue