[APP] Allow profiler to be enabled via cmake option

- Hide profiler buttons if profiler is disabled
- From default it is disabled
This commit is contained in:
Gliniak
2026-05-04 19:53:37 +02:00
parent 9467c77f08
commit ec18a89da4
3 changed files with 12 additions and 5 deletions

View File

@@ -37,6 +37,10 @@ message(STATUS "Target architecture: XE_TARGET_AARCH64=${XE_TARGET_AARCH64} XE_T
option(XENIA_BUILD_TESTS "Build test suites" OFF)
option(XENIA_BUILD_MISC "Build misc subprojects (trace viewers, shader compiler, vfs-dump, demos)" OFF)
# Toggle profiler
add_compile_definitions(XE_OPTION_PROFILING=1)
add_compile_definitions(XE_OPTION_PROFILING_UI=1)
if(XENIA_BUILD_TESTS)
enable_testing()
include(${PROJECT_SOURCE_DIR}/third_party/catch/contrib/Catch.cmake)

View File

@@ -805,6 +805,7 @@ bool EmulatorWindow::Initialize() {
MenuItem::Type::kString, "Time Scalar *= 2", "Numpad +",
std::bind(&EmulatorWindow::CpuTimeScalarSetDouble, this)));
}
#if XE_OPTION_PROFILING
cpu_menu->AddChild(MenuItem::Create(MenuItem::Type::kSeparator));
{
cpu_menu->AddChild(MenuItem::Create(MenuItem::Type::kString,
@@ -814,6 +815,7 @@ bool EmulatorWindow::Initialize() {
"&Pause/Resume Profiler", "`",
[]() { Profiler::TogglePause(); }));
}
#endif
cpu_menu->AddChild(MenuItem::Create(MenuItem::Type::kSeparator));
{
cpu_menu->AddChild(MenuItem::Create(

View File

@@ -20,12 +20,13 @@
#include "xenia/ui/virtual_key.h"
#include "xenia/ui/window_listener.h"
#if XE_PLATFORM_WIN32 && 0
#define XE_OPTION_PROFILING 1
#define XE_OPTION_PROFILING_UI 1
#else
#ifndef XE_OPTION_PROFILING
#define XE_OPTION_PROFILING 0
#endif // XE_PLATFORM_WIN32
#endif
#ifndef XE_OPTION_PROFILING_UI
#define XE_OPTION_PROFILING_UI 0
#endif
#if XE_OPTION_PROFILING
// Pollutes the global namespace. Yuck.