diff --git a/CMakeLists.txt b/CMakeLists.txt index 283f369..beb69bc 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index d7017f8..8bc2c71 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -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 diff --git a/launcher/src/main.cpp b/launcher/src/main.cpp index 079e085..79db364 100755 --- a/launcher/src/main.cpp +++ b/launcher/src/main.cpp @@ -8,10 +8,13 @@ #include #include #include -#include #include #include +#ifdef HAVE_WEBVIEW +#include +#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()) {