Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Begin adding GitHub actions and Windows build scripts #1

Merged
merged 36 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
67abb8f
Begin adding GitHub actions and Windows build scripts
redstrate Apr 25, 2024
181219b
Don't require PkgConfig if we don't need it
redstrate Apr 25, 2024
4dcef94
Build QtKeychain on Windows
redstrate Apr 25, 2024
80c277b
Add qtshadertools to CI needed for Kirigami
redstrate Apr 25, 2024
b3e03ee
Build QtKeychain with Qt6
redstrate Apr 25, 2024
e4de39d
Don't show gamemode CMake option on Windows/macOS
redstrate Apr 26, 2024
71107f9
Switch to my personal fork of libcotp, add gpg-error and gcrypt
redstrate Apr 26, 2024
3ed199d
Fix old Windows define not working
redstrate Apr 26, 2024
064ca5b
Download libunshield on Windows
redstrate Apr 26, 2024
82c2554
Fix QtKeychain target name tripping up windeployqt
redstrate Apr 26, 2024
c3f26ee
Switch to my branch of QtKeychain temporarily
redstrate Apr 26, 2024
a89381f
Install libgamemode on Ubuntu
redstrate Apr 26, 2024
315f875
Install correct gamemode package on Ubuntu and more DLLs on Windows
redstrate Apr 26, 2024
c759f2f
Add libwinpthread dependency required by gcrypt
redstrate Apr 26, 2024
52378b5
Don't set -fexceptions on MSVC
redstrate Apr 26, 2024
533ab38
Fix copying DLL filename
redstrate Apr 26, 2024
1cbc2bc
Install libunshield on the Ubuntu CI
redstrate Apr 26, 2024
f6802c5
Make Qt6WebView optional
redstrate Apr 26, 2024
fc8edcd
Don't force qqc2-desktop-style on Windows for now
redstrate Apr 26, 2024
d70f70f
Link to libunshield explicitly on non-Windows systems
redstrate Apr 26, 2024
664439f
Install qtwebchannel on the CI
redstrate Apr 26, 2024
b400a84
Remove QtWebView & friends from the CI
redstrate Apr 26, 2024
a3a0962
Remove last use of Qt5Compat.GraphicalEffects
redstrate Apr 26, 2024
721c35b
Don't install desktop files, icons and logging categories on Windows
redstrate Apr 26, 2024
dca720c
Extract libwinpthread to the correct directory
redstrate Apr 26, 2024
cfb7abf
Copy required Kirigami DLLs and QML modules to the package
redstrate Apr 26, 2024
3e71bad
Disable websocket and examples in QCoro builds
redstrate Apr 26, 2024
b67927f
Build and include Breeze Icons on Windows
redstrate Apr 26, 2024
2e50e89
Disable Linux-only options that aren't relevant on Windows
redstrate Apr 26, 2024
94cb097
Download and install OpenSSL 1.x on Windows
redstrate Apr 26, 2024
bd3659c
Attempt to fix broken Breeze Icons on CI
redstrate Apr 26, 2024
2f4054f
Make sure the Breeze icon is the main icon theme on Windows
redstrate Apr 26, 2024
a30d0d5
Capitalize the executable name on Windows
redstrate Apr 26, 2024
971cf01
Manually copy KF6BreezeIcons.dll
redstrate Apr 26, 2024
529f816
Add application icon for Windows
redstrate Apr 26, 2024
6bd9401
Fix copying the KDE QML folders
redstrate Apr 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
256 changes: 256 additions & 0 deletions .github/workflows/main.yml

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
.directory
*.flatpak
export/
.clang-format
.clang-format
# Windows
local/
prefix/
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "external/libcotp"]
path = external/libcotp
url = https://github.com/paolostivanin/libcotp.git
url = https://github.com/redstrate/libcotp.git
[submodule "external/libphysis"]
path = external/libphysis
url = ../libphysis
Expand Down
37 changes: 25 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ 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
option(ENABLE_GAMEMODE "Build with Feral GameMode support, requires the daemon to be installed." ON)
if (NOT WIN32 AND NOT APPLE)
option(ENABLE_GAMEMODE "Build with Feral GameMode support, requires the daemon to be installed." ON)
endif()

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -27,6 +30,7 @@ include(KDEGitCommitHooks)
include(KDEClangFormat)
include(ECMAddTests)
include(ECMQtDeclareLoggingCategory)
include(ECMAddAppIcon)

ecm_setup_version(${PROJECT_VERSION}
VARIABLE_PREFIX ASTRA
Expand All @@ -38,40 +42,49 @@ find_package(Qt6 ${QT_MIN_VERSION} REQUIRED COMPONENTS
Widgets
Network
QuickControls2
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(PkgConfig REQUIRED)
find_package(QCoro6 REQUIRED COMPONENTS Core Network Qml)
qcoro_enable_coroutines()

qt_policy(SET QTP0001 NEW)

if (ENABLE_GAMEMODE)
find_package(PkgConfig REQUIRED)
pkg_search_module(GAMEMODE REQUIRED gamemode)
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)

if (BUILD_TESTING)
add_subdirectory(autotests)
endif()

install(FILES zone.xiv.astra.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES zone.xiv.astra.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
install(FILES zone.xiv.astra.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps)
if (NOT WIN32)
install(FILES zone.xiv.astra.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES zone.xiv.astra.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
install(FILES zone.xiv.astra.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps)

feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
ecm_qt_install_logging_categories(
EXPORT ASTRA
FILE astra.categories
SORT DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
)
endif()

ecm_qt_install_logging_categories(
EXPORT ASTRA
FILE astra.categories
SORT DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES src/*.cpp src/*.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
Expand Down
18 changes: 13 additions & 5 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ corrosion_import_crate(MANIFEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libphysis/Cargo
FEATURES game_install visual_data) # FIXME: split visual_data? we only need texture decompression
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libphysis/logger EXCLUDE_FROM_ALL)

find_package(PkgConfig REQUIRED)
pkg_check_modules(UNSHIELD REQUIRED IMPORTED_TARGET libunshield)

target_include_directories(physis INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libphysis/target/public)
target_link_libraries(physis INTERFACE ${UNSHIELD_LIBRARIES} z)
target_link_directories(physis INTERFACE ${UNSHIELD_LIBRARY_DIRS})

# We should use the CMake module everywhere once distros update their packages
if (WIN32)
# FIXME: unshield should include zlib in their upstream cmake
find_package(ZLIB REQUIRED)
find_package(unshield REQUIRED)
target_link_libraries(physis INTERFACE unshield::libunshield)
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(UNSHIELD REQUIRED IMPORTED_TARGET libunshield)
target_link_directories(physis INTERFACE ${UNSHIELD_LIBRARY_DIRS})
target_link_libraries(physis INTERFACE ${UNSHIELD_LIBRARIES})
endif()

set(KDSingleApplication_QT6 ON)
set(KDSingleApplication_STATIC ON)
Expand Down
2 changes: 1 addition & 1 deletion external/libcotp
44 changes: 41 additions & 3 deletions launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ target_link_libraries(astra PRIVATE
Qt6::Widgets
Qt6::Quick
Qt6::QuickControls2
Qt6::WebView
Qt6::Concurrent
KF6::Kirigami
KF6::I18n
Expand All @@ -149,7 +148,22 @@ target_link_libraries(astra PRIVATE
QCoro::Core
QCoro::Network
QCoro::Qml)
target_compile_options(astra PRIVATE -fexceptions)
if (BUILD_WEBVIEW)
target_link_libraries(astra PRIVATE
Qt6::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 ()

if (BUILD_FLATPAK)
target_compile_definitions(astra PRIVATE FLATPAK)
Expand All @@ -160,4 +174,28 @@ if (ENABLE_GAMEMODE)
target_compile_definitions(astra PRIVATE ENABLE_GAMEMODE)
endif ()

install(TARGETS astra ${KF6_INSTALL_TARGETS_DEFAULT_ARGS})
if (WIN32)
set_target_properties(astra PROPERTIES
WIN32_EXECUTABLE TRUE
OUTPUT_NAME "Astra")
endif ()

install(TARGETS astra ${KF6_INSTALL_TARGETS_DEFAULT_ARGS})

ecm_add_app_icon(astra
ICONS
${CMAKE_SOURCE_DIR}/zone.xiv.astra.svg
${CMAKE_SOURCE_DIR}/resources/16-astra.png
${CMAKE_SOURCE_DIR}/resources/32-astra.png
${CMAKE_SOURCE_DIR}/resources/48-astra.png
${CMAKE_SOURCE_DIR}/resources/256-astra.png
)

qt_finalize_target(astra)

qt_generate_deploy_qml_app_script(
TARGET astra
OUTPUT_SCRIPT deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
2 changes: 2 additions & 0 deletions launcher/include/launchercore.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class LauncherCore : public QObject
Q_PROPERTY(bool loadingFinished READ isLoadingFinished NOTIFY loadingFinished)
Q_PROPERTY(bool isSteam READ isSteam CONSTANT)
Q_PROPERTY(bool isSteamDeck READ isSteamDeck CONSTANT)
Q_PROPERTY(bool isWindows READ isWindows CONSTANT)
Q_PROPERTY(LauncherSettings *settings READ settings CONSTANT)
Q_PROPERTY(ProfileManager *profileManager READ profileManager CONSTANT)
Q_PROPERTY(AccountManager *accountManager READ accountManager CONSTANT)
Expand Down Expand Up @@ -110,6 +111,7 @@ class LauncherCore : public QObject
[[nodiscard]] bool isLoadingFinished() const;
[[nodiscard]] bool isSteam() const;
[[nodiscard]] bool isSteamDeck() const;
[[nodiscard]] bool isWindows() const;
[[nodiscard]] Q_INVOKABLE bool isPatching() const;

[[nodiscard]] QNetworkAccessManager *mgr();
Expand Down
9 changes: 9 additions & 0 deletions launcher/src/launchercore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@ bool LauncherCore::isSteamDeck() const
}
}

bool LauncherCore::isWindows() const
{
#if defined(Q_OS_WIN)
return true;
#else
return false;
#endif
}

bool LauncherCore::isPatching() const
{
return m_isPatching;
Expand Down
20 changes: 18 additions & 2 deletions launcher/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -20,18 +23,29 @@
#include "physis_logger.h"
#include "sapphirelogin.h"

#ifdef Q_OS_WIN
#include <BreezeIcons/BreezeIcons>
#endif

using namespace Qt::StringLiterals;

int main(int argc, char *argv[])
{
#ifdef HAVE_WEBVIEW
QtWebView::initialize();
#endif

#ifdef Q_OS_WIN
BreezeIcons::initIcons();
QIcon::setThemeName(QStringLiteral("Breeze"));
#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()) {
Expand Down Expand Up @@ -124,6 +138,7 @@ int main(int argc, char *argv[])
}
}

#if defined(Q_OS_LINUX)
// Default to org.kde.desktop style unless the user forces another style
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
if (isSteamDeck) {
Expand All @@ -132,6 +147,7 @@ int main(int argc, char *argv[])
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
}
}
#endif

QCoro::Qml::registerTypes();

Expand Down
6 changes: 3 additions & 3 deletions launcher/src/profilemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ void ProfileManager::deleteProfile(Profile *profile)
QString ProfileManager::getDefaultGamePath(const QString &uuid)
{
#if defined(Q_OS_WIN)
return "C:\\Program Files (x86)\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn";
return QStringLiteral("C:\\Program Files (x86)\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn");
#endif

#if defined(Q_OS_MAC)
return QDir::homePath() +
"/Library/Application Support/FINAL FANTASY XIV ONLINE/Bottles/published_Final_Fantasy/drive_c/Program "
"Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn";
QStringLiteral("/Library/Application Support/FINAL FANTASY XIV ONLINE/Bottles/published_Final_Fantasy/drive_c/Program "
"Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn");
#endif

#if defined(Q_OS_LINUX)
Expand Down
23 changes: 13 additions & 10 deletions launcher/ui/Pages/NewsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import QtQuick.Effects

import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
Expand Down Expand Up @@ -101,15 +101,18 @@ QQC2.Control {
}

layer.enabled: !(bannerImage.width < layout.maximumWidth)
layer.effect: OpacityMask {
maskSource: Item {
width: bannerImage.width
height: bannerImage.height
Rectangle {
anchors.centerIn: parent
width: bannerImage.width
height: bannerImage.height
radius: Kirigami.Units.smallSpacing
layer.effect: MultiEffect {
id: root

maskEnabled: true
maskSpreadAtMax: 1
maskSpreadAtMin: 1
maskThresholdMin: 0.5
maskSource: ShaderEffectSource {
sourceItem: Rectangle {
width: root.width
height: root.height
radius: Kirigami.Units.mediumSpacing
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions launcher/ui/Settings/ProfileSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ FormCard.FormCardPage {
}

FormCard.FormCard {
visible: !LauncherCore.isWindows

Layout.fillWidth: true

FormCard.FormComboBoxDelegate {
Expand Down Expand Up @@ -139,9 +141,12 @@ FormCard.FormCardPage {

FormCard.FormHeader {
title: i18n("Tools")
visible: !LauncherCore.isWindows
}

FormCard.FormCard {
visible: !LauncherCore.isWindows

Layout.fillWidth: true

FormCard.FormCheckDelegate {
Expand Down
1 change: 1 addition & 0 deletions launcher/ui/Settings/SettingsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ KirigamiSettings.CategorizedSettings {
text: i18n("Compatibility Tool")
icon.name: "system-run"
page: Qt.resolvedUrl("/qt/qml/zone/xiv/astra/ui/Settings/CompatibilityToolSetup.qml")
visible: !LauncherCore.isWindows
},
KirigamiSettings.SettingAction {
actionName: "devtool"
Expand Down
Binary file added resources/16-astra.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/256-astra.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/32-astra.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/48-astra.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/zone.xiv.astra.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions scripts/windows-build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SPDX-FileCopyrightText: 2024 NotNite <[email protected]>
# SPDX-License-Identifier: CC0-1.0

$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true

$LocalDir = "./local"
$BuildDir = "./build"
$PrefixDir = (Get-Location).Path + "/prefix"

cmake -B "$BuildDir" "-DCMAKE_PREFIX_PATH=$PrefixDir" "-DCMAKE_CXX_COMPILER=cl" "-DCMAKE_C_COMPILER=cl" "-DCMAKE_BUILD_TYPE=Debug" "-S" . "-DCMAKE_INSTALL_PREFIX=$BuildDir"
cmake --build "$BuildDir" --config Debug --target install

Copy-Item -Path "$PrefixDir/bin/KF6ItemViews.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/KF6IconWidgets.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/KF6GuiAddons.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/KF6ColorScheme.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/intl-8.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/KF6IconThemes.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/iconv.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$PrefixDir/bin/zlibd.dll" -Destination "$BuildDir/bin"
Copy-Item -Path "$env:QTDIR/bin/Qt6PrintSupportd.dll" -Destination "$BuildDir/bin"
Loading
Loading