From b67927f5c461113b9b1b48c5265fef60b55e1ab5 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 26 Apr 2024 15:46:08 -0400 Subject: [PATCH] Build and include Breeze Icons on Windows --- .github/workflows/main.yml | 7 +++++++ CMakeLists.txt | 5 +++++ launcher/CMakeLists.txt | 7 +++++++ launcher/src/main.cpp | 8 ++++++++ scripts/windows-setup.ps1 | 8 +++++++- 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1533f70..eecb379 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -158,6 +158,13 @@ jobs: cmake -B ${{ steps.strings.outputs.build-output-dir }}-kirigami-addons -DCMAKE_PREFIX_PATH=${{ steps.strings.outputs.prefix-dir }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -S kirigami-addons -DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.prefix-dir }} -DBUILD_TESTING=OFF cmake --build ${{ steps.strings.outputs.build-output-dir }}-kirigami-addons --config ${{ matrix.build_type }} --target install + - name: Build Breeze Icons + if: (runner.os == 'Windows') && (steps.cache-prefix-restore.outputs.cache-hit != 'true') + run: | + git clone https://invent.kde.org/frameworks/breeze-icons.git + cmake -B ${{ steps.strings.outputs.build-output-dir }}-breeze-icons -DCMAKE_PREFIX_PATH=${{ steps.strings.outputs.prefix-dir }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -S breeze-icons -DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.prefix-dir }} -DICONS_LIBRARY=ON -DSKIP_INSTALL_ICONS=ON + cmake --build ${{ steps.strings.outputs.build-output-dir }}-breeze-icons --config ${{ matrix.build_type }} --target install + - name: Build Corrosion if: steps.cache-prefix-restore.outputs.cache-hit != 'true' run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index e74525c..1f913b7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,11 @@ endif () find_package(Qt6Keychain REQUIRED) +# TODO: we should really do this on all platforms anyway +if (WIN32) + find_package(KF6BreezeIcons REQUIRED) +endif () + add_subdirectory(external) add_subdirectory(launcher) diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 8bc2c71..24958cb 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -154,6 +154,13 @@ if (BUILD_WEBVIEW) ) target_compile_definitions(astra PRIVATE HAVE_WEBVIEW) endif () + +if (WIN32) + target_link_libraries(astra PRIVATE + KF6::BreezeIcons + ) +endif () + if (NOT MSVC) target_compile_options(astra PRIVATE -fexceptions) endif () diff --git a/launcher/src/main.cpp b/launcher/src/main.cpp index a9e09a9..7407e0d 100755 --- a/launcher/src/main.cpp +++ b/launcher/src/main.cpp @@ -23,6 +23,10 @@ #include "physis_logger.h" #include "sapphirelogin.h" +#ifdef Q_OS_WIN +#include +#endif + using namespace Qt::StringLiterals; int main(int argc, char *argv[]) @@ -31,6 +35,10 @@ int main(int argc, char *argv[]) QtWebView::initialize(); #endif +#ifdef Q_OS_WIN + BreezeIcons::initIcons(); +#endif + if (qEnvironmentVariable("SteamDeck") == QStringLiteral("1")) { qputenv("QT_SCALE_FACTOR", "1.25"); qputenv("QT_QUICK_CONTROLS_MOBILE", "1"); diff --git a/scripts/windows-setup.ps1 b/scripts/windows-setup.ps1 index 110d3c0..c741efa 100644 --- a/scripts/windows-setup.ps1 +++ b/scripts/windows-setup.ps1 @@ -134,4 +134,10 @@ CheckCompileResult "qtkeychain" Clone "unshield" "https://github.com/twogood/unshield.git" Configure "unshield" "-DBUILD_TESTING=OFF" cmake --build "$BuildDir-unshield" --config Debug --target install --parallel $NumCores -CheckCompileResult "unshield" \ No newline at end of file +CheckCompileResult "unshield" + +# Build breeze icons +Clone "breeze-icons" "https://invent.kde.org/frameworks/breeze-icons.git" +Configure "breeze-icons" "-DICONS_LIBRARY=ON -DSKIP_INSTALL_ICONS=ON" +cmake --build "$BuildDir-breeze-icons" --config Debug --target install --parallel $NumCores +CheckCompileResult "breeze-icons" \ No newline at end of file