[cmake, frontend] feat: CPMUtil + dependency viewer (#238)

- creates a CPMUtil.cmake module that makes my job 10x easier and removes boilerplate
- also lets us generate dependency names/versions at compiletime, thus letting the frontend display each dependency's versions.

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/238
This commit is contained in:
crueter 2025-08-11 22:27:29 +02:00
parent 3f02d7713f
commit 1551387739
Signed by: crueter
GPG key ID: 425ACD2D4830EBC6
24 changed files with 690 additions and 183 deletions

View file

@ -232,3 +232,5 @@ if (ANDROID)
add_subdirectory(android/app/src/main/jni)
target_include_directories(yuzu-android PRIVATE android/app/src/main)
endif()
include(GenerateDepHashes)

View file

@ -159,7 +159,8 @@ add_library(
wall_clock.cpp
wall_clock.h
zstd_compression.cpp
zstd_compression.h)
zstd_compression.h
)
if(YUZU_ENABLE_PORTABLE)
add_compile_definitions(YUZU_ENABLE_PORTABLE)

20
src/dep_hashes.h.in Normal file
View file

@ -0,0 +1,20 @@
// SPDX-FileCopyrightText: 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
namespace Common {
static const constexpr std::array<const char *, @DEPS_LENGTH@> dep_names = {
@DEP_NAMES@
};
static const constexpr std::array<const char *, @DEPS_LENGTH@> dep_hashes = {
@DEP_SHAS@
};
static const constexpr std::array<const char *, @DEPS_LENGTH@> dep_urls = {
@DEP_URLS@
};
} // namespace Common

View file

@ -1,4 +1,4 @@
include(CPM)
include(CPMUtil)
# Always build externals as static libraries, even when dynarmic is built as shared
if (BUILD_SHARED_LIBS)
@ -22,12 +22,12 @@ set(BUILD_TESTING OFF)
if ("riscv" IN_LIST ARCHITECTURE)
add_subdirectory(biscuit)
CPMAddPackage(
AddPackage(
NAME biscuit
VERSION 0.9.1
URL "https://github.com/lioncash/biscuit/archive/76b0be8dae.zip"
URL_HASH SHA512=47d55ed02d032d6cf3dc107c6c0a9aea686d5f25aefb81d1af91db027b6815bd5add1755505e19d76625feeb17aa2db6cd1668fe0dad2e6a411519bde6ca4489
CUSTOM_CACHE_KEY "76b0"
REPO "lioncash/biscuit"
SHA 76b0be8dae
HASH 47d55ed02d032d6cf3dc107c6c0a9aea686d5f25aefb81d1af91db027b6815bd5add1755505e19d76625feeb17aa2db6cd1668fe0dad2e6a411519bde6ca4489
)
endif()
@ -49,14 +49,14 @@ if (NOT TARGET fmt::fmt)
endif()
# mcl
CPMAddPackage(
AddPackage(
NAME mcl
VERSION 0.1.12
URL "https://github.com/azahar-emu/mcl/archive/7b08d83418.zip"
URL_HASH SHA512=f943bac39c1879986decad7a442ff4288eaeca4a2907684c7914e115a55ecc43c2782ded85c0835763fe04e40d5c82220ce864423e489e648e408a84f54dc4f3
REPO "azahar-emu/mcl"
SHA 7b08d83418
HASH f943bac39c1879986decad7a442ff4288eaeca4a2907684c7914e115a55ecc43c2782ded85c0835763fe04e40d5c82220ce864423e489e648e408a84f54dc4f3
OPTIONS
"MCL_INSTALL OFF"
CUSTOM_CACHE_KEY "7b08"
)
# oaknut
@ -71,14 +71,14 @@ CPMAddPackage(
# unordered_dense
CPMAddPackage(
AddPackage(
NAME unordered_dense
URL "https://github.com/Lizzie841/unordered_dense/archive/e59d30b7b1.zip"
URL_HASH SHA512=71eff7bd9ba4b9226967bacd56a8ff000946f8813167cb5664bb01e96fb79e4e220684d824fe9c59c4d1cc98c606f13aff05b7940a1ed8ab3c95d6974ee34fa0
REPO "Lizzie841/unordered_dense"
SHA e59d30b7b1
HASH 71eff7bd9ba4b9226967bacd56a8ff000946f8813167cb5664bb01e96fb79e4e220684d824fe9c59c4d1cc98c606f13aff05b7940a1ed8ab3c95d6974ee34fa0
FIND_PACKAGE_ARGUMENTS "CONFIG"
OPTIONS
"UNORDERED_DENSE_INSTALL OFF"
CUSTOM_CACHE_KEY "e59d"
)
# xbyak
@ -93,24 +93,24 @@ CPMAddPackage(
# zydis
if ("x86_64" IN_LIST ARCHITECTURE)
CPMAddPackage(
AddPackage(
NAME Zycore
URL "https://github.com/zyantific/zycore-c/archive/75a36c45ae.zip"
URL_HASH SHA512=15aa399f39713e042c4345bc3175c82f14dca849fde2a21d4f591f62c43e227b70d868d8bb86beb5f4eb68b1d6bd3792cdd638acf89009e787e3d10ee7401924
CUSTOM_CACHE_KEY "75a3"
REPO "zyantific/zycore-c"
SHA 75a36c45ae
HASH 15aa399f39713e042c4345bc3175c82f14dca849fde2a21d4f591f62c43e227b70d868d8bb86beb5f4eb68b1d6bd3792cdd638acf89009e787e3d10ee7401924
)
CPMAddPackage(
AddPackage(
NAME Zydis
VERSION 4
URL "https://github.com/zyantific/zydis/archive/c2d2bab025.zip"
URL_HASH SHA512=7b48f213ff7aab2926f8c9c65195959143bebbfb2b9a25051ffd8b8b0f1baf1670d9739781de674577d955925f91ac89376e16b476a03828c84e2fd765d45020
REPO "zyantific/zydis"
SHA c2d2bab025
HASH 7b48f213ff7aab2926f8c9c65195959143bebbfb2b9a25051ffd8b8b0f1baf1670d9739781de674577d955925f91ac89376e16b476a03828c84e2fd765d45020
OPTIONS
"ZYDIS_BUILD_TOOLS OFF"
"ZYDIS_BUILD_EXAMPLES OFF"
"ZYDIS_BUILD_DOXYGEN OFF"
"ZYAN_ZYCORE_PATH ${Zycore_SOURCE_DIR}"
"CMAKE_DISABLE_FIND_PACKAGE_Doxygen ON"
CUSTOM_CACHE_KEY "c2d2"
)
endif()

View file

@ -23,13 +23,13 @@ namespace Core {
static constexpr std::chrono::seconds announce_time_interval(15);
AnnounceMultiplayerSession::AnnounceMultiplayerSession() {
//#ifdef ENABLE_WEB_SERVICE
#ifdef ENABLE_WEB_SERVICE
backend = std::make_unique<WebService::RoomJson>(Settings::values.web_api_url.GetValue(),
Settings::values.eden_username.GetValue(),
Settings::values.eden_token.GetValue());
//#else
// backend = std::make_unique<AnnounceMultiplayerRoom::NullBackend>();
//#endif
#else
backend = std::make_unique<AnnounceMultiplayerRoom::NullBackend>();
#endif
}
WebService::WebResult AnnounceMultiplayerSession::Register() {
@ -156,11 +156,11 @@ bool AnnounceMultiplayerSession::IsRunning() const {
void AnnounceMultiplayerSession::UpdateCredentials() {
ASSERT_MSG(!IsRunning(), "Credentials can only be updated when session is not running");
//#ifdef ENABLE_WEB_SERVICE
#ifdef ENABLE_WEB_SERVICE
backend = std::make_unique<WebService::RoomJson>(Settings::values.web_api_url.GetValue(),
Settings::values.eden_username.GetValue(),
Settings::values.eden_token.GetValue());
//#endif
#endif
}
} // namespace Core

View file

@ -70,7 +70,7 @@ Id GetMaxThreadId(EmitContext& ctx, Id thread_id, Id clamp, Id segmentation_mask
Id SelectValue(EmitContext& ctx, Id in_range, Id value, Id src_thread_id) {
return ctx.OpSelect(
ctx.U32[1], in_range,
ctx.OpGroupNonUniformShuffleXor(ctx.U32[1], SubgroupScope(ctx), value, src_thread_id), value);
ctx.OpGroupNonUniformShuffle(ctx.U32[1], SubgroupScope(ctx), value, src_thread_id), value);
}
Id AddPartitionBase(EmitContext& ctx, Id thread_id) {

View file

@ -337,6 +337,10 @@ if (VulkanUtilityLibraries_ADDED)
target_include_directories(video_core PUBLIC ${VulkanUtilityLibraries_SOURCE_DIR}/include)
endif()
if (VulkanHeaders_ADDED)
target_include_directories(video_core PUBLIC ${VulkanHeaders_SOURCE_DIR}/include)
endif()
target_link_libraries(video_core PRIVATE sirit Vulkan::Headers)
if (ENABLE_NSIGHT_AFTERMATH)

View file

@ -974,7 +974,6 @@ bool Device::GetSuitability(bool requires_swapchain) {
// Configure properties.
VkPhysicalDeviceVulkan12Features features_1_2{};
VkPhysicalDeviceVulkan13Features features_1_3{};
VkPhysicalDeviceVulkan14Features features_1_4{};
// Configure properties.
properties.properties = physical.GetProperties();
@ -1053,13 +1052,10 @@ bool Device::GetSuitability(bool requires_swapchain) {
if (instance_version >= VK_API_VERSION_1_2) {
features_1_2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
features_1_3.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES;
features_1_4.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_4_FEATURES;
features_1_2.pNext = &features_1_3;
features_1_3.pNext = &features_1_4;
*next = &features_1_2;
// next = &features_1_4.pNext;
}
// Test all features we know about. If the feature is not available in core at our

View file

@ -238,6 +238,10 @@ add_executable(yuzu
migration_dialog.h migration_dialog.cpp
migration_worker.h
migration_worker.cpp
deps_dialog.cpp
deps_dialog.h
deps_dialog.ui
)
set_target_properties(yuzu PROPERTIES OUTPUT_NAME "eden")

View file

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>About eden</string>
<string>About Eden</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>

121
src/yuzu/deps_dialog.cpp Normal file
View file

@ -0,0 +1,121 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include "yuzu/deps_dialog.h"
#include <QAbstractTextDocumentLayout>
#include <QDesktopServices>
#include <QIcon>
#include <QPainter>
#include <QTableWidget>
#include <QTextEdit>
#include "dep_hashes.h"
#include "ui_deps_dialog.h"
#include <fmt/ranges.h>
DepsDialog::DepsDialog(QWidget* parent)
: QDialog(parent)
, ui{std::make_unique<Ui::DepsDialog>()}
{
ui->setupUi(this);
constexpr size_t rows = Common::dep_hashes.size();
ui->tableDeps->setRowCount(rows);
QStringList labels;
labels << tr("Dependency") << tr("Version");
ui->tableDeps->setHorizontalHeaderLabels(labels);
ui->tableDeps->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeMode::Stretch);
ui->tableDeps->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeMode::Fixed);
ui->tableDeps->horizontalHeader()->setMinimumSectionSize(200);
for (size_t i = 0; i < rows; ++i) {
const std::string name = Common::dep_names.at(i);
const std::string sha = Common::dep_hashes.at(i);
const std::string url = Common::dep_urls.at(i);
std::string dependency = fmt::format("<a href=\"{}\">{}</a>", url, name);
QTableWidgetItem *nameItem = new QTableWidgetItem(QString::fromStdString(dependency));
QTableWidgetItem *shaItem = new QTableWidgetItem(QString::fromStdString(sha));
ui->tableDeps->setItem(i, 0, nameItem);
ui->tableDeps->setItem(i, 1, shaItem);
}
ui->tableDeps->setItemDelegateForColumn(0, new LinkItemDelegate(this));
}
DepsDialog::~DepsDialog() = default;
LinkItemDelegate::LinkItemDelegate(QObject *parent)
: QStyledItemDelegate(parent)
{}
void LinkItemDelegate::paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
auto options = option;
initStyleOption(&options, index);
QTextDocument doc;
QString html = index.data(Qt::DisplayRole).toString();
doc.setHtml(html);
options.text.clear();
painter->save();
painter->translate(options.rect.topLeft());
doc.drawContents(painter, QRectF(0, 0, options.rect.width(), options.rect.height()));
painter->restore();
}
QSize LinkItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyleOptionViewItem options = option;
initStyleOption(&options, index);
QTextDocument doc;
doc.setHtml(options.text);
doc.setTextWidth(options.rect.width());
return QSize(doc.idealWidth(), doc.size().height());
}
bool LinkItemDelegate::editorEvent(QEvent *event,
QAbstractItemModel *model,
const QStyleOptionViewItem &option,
const QModelIndex &index)
{
if (event->type() == QEvent::MouseButtonRelease) {
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::LeftButton) {
QString html = index.data(Qt::DisplayRole).toString();
QTextDocument doc;
doc.setHtml(html);
doc.setTextWidth(option.rect.width());
// this is kinda silly but it werks
QAbstractTextDocumentLayout *layout = doc.documentLayout();
QPoint pos = mouseEvent->pos() - option.rect.topLeft();
int charPos = layout->hitTest(pos, Qt::ExactHit);
if (charPos >= 0) {
QTextCursor cursor(&doc);
cursor.setPosition(charPos);
QTextCharFormat format = cursor.charFormat();
if (format.isAnchor()) {
QString href = format.anchorHref();
if (!href.isEmpty()) {
QDesktopServices::openUrl(QUrl(href));
return true;
}
}
}
}
}
return QStyledItemDelegate::editorEvent(event, model, option, index);
}

41
src/yuzu/deps_dialog.h Normal file
View file

@ -0,0 +1,41 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QDialog>
#include <QStyledItemDelegate>
#include <QTableView>
#include <memory>
namespace Ui { class DepsDialog; }
class DepsDialog : public QDialog
{
Q_OBJECT
public:
explicit DepsDialog(QWidget *parent);
~DepsDialog() override;
private:
std::unique_ptr<Ui::DepsDialog> ui;
};
class LinkItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit LinkItemDelegate(QObject *parent = 0);
protected:
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index) const override;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
bool editorEvent(QEvent *event,
QAbstractItemModel *model,
const QStyleOptionViewItem &option,
const QModelIndex &index) override;
};

166
src/yuzu/deps_dialog.ui Normal file
View file

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DepsDialog</class>
<widget class="QDialog" name="DepsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>701</width>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
<string>Eden Dependencies</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="labelLogo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>200</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../dist/qt_themes/default/default.qrc">:/icons/default/256x256/eden.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="labelEden">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:28pt;&quot;&gt;Eden Dependencies&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelInfo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The projects that make Eden possible&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="tableDeps">
<property name="editTriggers">
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SelectionMode::NoSelection</enum>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column/>
<column/>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::StandardButton::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../dist/qt_themes/default/default.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DepsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DepsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# cpm
include(CPM)
include(CPMUtil)
# Disable tests/tools in all externals supporting the standard option name
set(BUILD_TESTING OFF)
@ -14,11 +14,11 @@ set(BUILD_SHARED_LIBS OFF)
set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL ON)
# QuaZip
set(CPM_USE_LOCAL_PACKAGES ON)
CPMAddPackage(
AddPackage(
NAME QuaZip-Qt6
VERSION 1.3
URL "https://github.com/crueter/quazip-qt6/archive/f838774d63.zip"
CUSTOM_CACHE_KEY "f838"
REPO "crueter/quazip-qt6"
SHA f838774d63
HASH 9f629a438699801244a106c8df6d5f8f8d19e80df54f530a89403a10c8c4e37a6e95606bbdd307f23636961e8ce34eb37a2186d589a1f227ac9c8e2c678e326e
SYSTEM_PACKAGE ON
)

View file

@ -160,6 +160,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "yuzu/debugger/console.h"
#include "yuzu/debugger/controller.h"
#include "yuzu/debugger/wait_tree.h"
#include "yuzu/deps_dialog.h"
#include "yuzu/discord.h"
#include "yuzu/game_list.h"
#include "yuzu/game_list_p.h"
@ -1769,6 +1770,7 @@ void GMainWindow::ConnectMenuEvents() {
connect_menu(ui->action_Firmware_From_ZIP, &GMainWindow::OnInstallFirmwareFromZIP);
connect_menu(ui->action_Install_Keys, &GMainWindow::OnInstallDecryptionKeys);
connect_menu(ui->action_About, &GMainWindow::OnAbout);
connect_menu(ui->action_Eden_Dependencies, &GMainWindow::OnEdenDependencies);
}
void GMainWindow::UpdateMenuState() {
@ -3742,7 +3744,7 @@ void GMainWindow::OnOpenFAQ() {
}
void GMainWindow::OnOpenDiscord() {
OpenURL(QUrl(QStringLiteral("https://discord.gg/kXAmGCXBGD")));
OpenURL(QUrl(QStringLiteral("https://discord.gg/HstXbPch7X")));
}
void GMainWindow::OnOpenRevolt() {
@ -4582,6 +4584,11 @@ void GMainWindow::OnAbout() {
aboutDialog.exec();
}
void GMainWindow::OnEdenDependencies() {
DepsDialog depsDialog(this);
depsDialog.exec();
}
void GMainWindow::OnToggleFilterBar() {
game_list->SetFilterVisible(ui->action_Show_Filter_Bar->isChecked());
if (ui->action_Show_Filter_Bar->isChecked()) {

View file

@ -397,6 +397,7 @@ private slots:
void OnInstallFirmwareFromZIP();
void OnInstallDecryptionKeys();
void OnAbout();
void OnEdenDependencies();
void OnToggleFilterBar();
void OnToggleStatusBar();
void OnGameListRefresh();

View file

@ -217,6 +217,7 @@
<addaction name="action_Revolt"/>
<addaction name="separator"/>
<addaction name="action_About"/>
<addaction name="action_Eden_Dependencies"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menu_Emulation"/>
@ -575,6 +576,11 @@
<string/>
</property>
</action>
<action name="action_Eden_Dependencies">
<property name="text">
<string>&amp;Eden Dependencies</string>
</property>
</action>
</widget>
<resources>
<include location="yuzu.qrc"/>