From 5051db201ed352910f885a5daea7ae3de0a667a0 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Fri, 27 Dec 2024 08:51:50 +0100 Subject: [PATCH 1/2] Show error message if TRACY_MANUAL_LIFETIME is enabled without enabled TRACY_DELAYED_INIT --- public/client/TracyProfiler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/client/TracyProfiler.cpp b/public/client/TracyProfiler.cpp index a551aa427..75116fef4 100644 --- a/public/client/TracyProfiler.cpp +++ b/public/client/TracyProfiler.cpp @@ -81,6 +81,10 @@ #include "TracySysTrace.hpp" #include "../tracy/TracyC.h" +#if defined TRACY_MANUAL_LIFETIME && !defined(TRACY_DELAYED_INIT) +# error "TRACY_MANUAL_LIFETIME requires enabled TRACY_DELAYED_INIT" +#endif + #ifdef TRACY_PORT # ifndef TRACY_DATA_PORT # define TRACY_DATA_PORT TRACY_PORT @@ -4907,7 +4911,7 @@ TRACY_API void ___tracy_fiber_enter( const char* fiber ){ tracy::Profiler::Enter TRACY_API void ___tracy_fiber_leave( void ){ tracy::Profiler::LeaveFiber(); } #endif -# ifdef TRACY_MANUAL_LIFETIME +# if defined TRACY_MANUAL_LIFETIME && defined TRACY_DELAYED_INIT TRACY_API void ___tracy_startup_profiler( void ) { tracy::StartupProfiler(); From caf0047367656183e5f28a646810647e1f5144df Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" Date: Fri, 27 Dec 2024 08:58:00 +0100 Subject: [PATCH 2/2] Catch disabled TRACY_DELAYED_INIT when TRACY_MANUAL_LIFETIME is enabled --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f1e12dff8..918c31910 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,6 +106,11 @@ mark_as_advanced(TRACY_VERBOSE) set_option(TRACY_DEMANGLE "[advanced] Don't use default demangling function - You'll need to provide your own" OFF) mark_as_advanced(TRACY_DEMANGLE) +# handle incompatible combinations +if(TRACY_MANUAL_LIFETIME AND NOT TRACY_DELAYED_INIT) + message(FATAL_ERROR "TRACY_MANUAL_LIFETIME can not be activated with disabled TRACY_DELAYED_INIT") +endif() + if(NOT TRACY_STATIC) target_compile_definitions(TracyClient PRIVATE TRACY_EXPORTS) target_compile_definitions(TracyClient PUBLIC TRACY_IMPORTS)