Add cmake option to enable microprofile

This commit is contained in:
PabloMK7 2025-03-09 19:37:43 +01:00 committed by OpenSauce
parent e3a21c8ef1
commit dd9c743041
7 changed files with 30 additions and 11 deletions

View File

@ -86,6 +86,8 @@ option(ENABLE_VULKAN "Enables the Vulkan renderer" ON)
option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
option(ENABLE_MICROPROFILE "Enables microprofile capabilities" OFF)
# Compile options
CMAKE_DEPENDENT_OPTION(COMPILE_WITH_DWARF "Add DWARF debugging information" ${IS_DEBUG_BUILD} "MINGW" OFF)
option(ENABLE_LTO "Enable link time optimization" ${DEFAULT_ENABLE_LTO})

View File

@ -138,6 +138,11 @@ endif()
# MicroProfile
add_library(microprofile INTERFACE)
target_include_directories(microprofile SYSTEM INTERFACE ./microprofile)
if (ENABLE_MICROPROFILE)
target_compile_definitions(microprofile INTERFACE MICROPROFILE_ENABLED=1)
else()
target_compile_definitions(microprofile INTERFACE MICROPROFILE_ENABLED=0)
endif()
# Nihstro
add_library(nihstro-headers INTERFACE)

View File

@ -590,6 +590,11 @@ void GMainWindow::InitializeDebugWidgets() {
microProfileDialog = new MicroProfileDialog(this);
microProfileDialog->hide();
debug_menu->addAction(microProfileDialog->toggleViewAction());
#else
auto micro_profile_stub = new QAction(tr("MicroProfile (unavailable)"), this);
micro_profile_stub->setEnabled(false);
micro_profile_stub->setChecked(false);
debug_menu->addAction(micro_profile_stub);
#endif
registersWidget = new RegistersWidget(system, this);
@ -3851,8 +3856,11 @@ static Qt::HighDpiScaleFactorRoundingPolicy GetHighDpiRoundingPolicy() {
void LaunchQtFrontend(int argc, char* argv[]) {
Common::DetachedTasks detached_tasks;
#if MICROPROFILE_ENABLED
MicroProfileOnThreadCreate("Frontend");
SCOPE_EXIT({ MicroProfileShutdown(); });
#endif
// Init settings params
QCoreApplication::setOrganizationName(QStringLiteral("Azahar Developers"));

View File

@ -42,7 +42,9 @@ class GRenderWindow;
class IPCRecorderWidget;
class LLEServiceModulesWidget;
class LoadingScreen;
#if MICROPROFILE_ENABLED
class MicroProfileDialog;
#endif
class MultiplayerState;
class ProfilerWidget;
class QFileOpenEvent;
@ -383,7 +385,9 @@ private:
// Debugger panes
ProfilerWidget* profilerWidget;
#if MICROPROFILE_ENABLED
MicroProfileDialog* microProfileDialog;
#endif
RegistersWidget* registersWidget;
GPUCommandStreamWidget* graphicsWidget;
GPUCommandListWidget* graphicsCommandsWidget;

View File

@ -1,7 +1,9 @@
// Copyright 2015 Citra Emulator Project
// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#if MICROPROFILE_ENABLED
#include <QAction>
#include <QLayout>
#include <QMouseEvent>
@ -15,7 +17,7 @@
// Include the implementation of the UI in this file. This isn't in microprofile.cpp because the
// non-Qt frontends don't need it (and don't implement the UI drawing hooks either).
#if MICROPROFILE_ENABLED
#define MICROPROFILEUI_IMPL 1
#include "common/microprofileui.h"
@ -44,8 +46,6 @@ private:
qreal x_scale = 1.0, y_scale = 1.0;
};
#endif
MicroProfileDialog::MicroProfileDialog(QWidget* parent) : QWidget(parent, Qt::Dialog) {
setObjectName(QStringLiteral("MicroProfile"));
setWindowTitle(tr("MicroProfile"));
@ -53,8 +53,6 @@ MicroProfileDialog::MicroProfileDialog(QWidget* parent) : QWidget(parent, Qt::Di
// Enable the maximize button
setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint);
#if MICROPROFILE_ENABLED
MicroProfileWidget* widget = new MicroProfileWidget(this);
QLayout* layout = new QVBoxLayout(this);
@ -67,7 +65,6 @@ MicroProfileDialog::MicroProfileDialog(QWidget* parent) : QWidget(parent, Qt::Di
setFocusProxy(widget);
widget->setFocusPolicy(Qt::StrongFocus);
widget->setFocus();
#endif
}
QAction* MicroProfileDialog::toggleViewAction() {
@ -95,8 +92,6 @@ void MicroProfileDialog::hideEvent(QHideEvent* event) {
QWidget::hideEvent(event);
}
#if MICROPROFILE_ENABLED
/// There's no way to pass a user pointer to MicroProfile, so this variable is used to make the
/// QPainter available inside the drawing callbacks.
static QPainter* mp_painter = nullptr;

View File

@ -1,9 +1,11 @@
// Copyright 2015 Citra Emulator Project
// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#if MICROPROFILE_ENABLED
#include <QWidget>
#include "common/common_types.h"
#include "common/microprofile.h"
@ -24,3 +26,5 @@ protected:
private:
QAction* toggle_view_action = nullptr;
};
#endif

View File

@ -1,10 +1,11 @@
// Copyright 2022 Citra Emulator Project
// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <span>
#include <string_view>
#include <utility>
#include <vector>
#include <glad/glad.h>