Build arguments for Tracy

This commit is contained in:
EliteMasterEric 2024-09-17 20:50:09 -04:00
parent 4bc2510d3c
commit b70983a0e4
2 changed files with 23 additions and 0 deletions

View file

@ -96,6 +96,11 @@
"target": "windows",
"args": ["-debug", "-DFEATURE_DEBUG_FUNCTIONS"]
},
{
"label": "Windows / Debug (Tracy)",
"target": "windows",
"args": ["-debug", "-DFEATURE_DEBUG_TRACY", "-DFEATURE_DEBUG_FUNCTIONS"]
},
{
"label": "Linux / Debug",
"target": "linux",

View file

@ -149,6 +149,14 @@ class Project extends HXProject {
*/
static final FEATURE_DEBUG_FUNCTIONS:FeatureFlag = "FEATURE_DEBUG_FUNCTIONS";
/**
* `-DFEATURE_DEBUG_TRACY`
* If this flag is enabled, the game will have the necessary hooks for the Tracy profiler.
* Only enable this if you're using the correct fork of Haxe to support this.
* @see https://github.com/HaxeFoundation/hxcpp/pull/1153
*/
static final FEATURE_DEBUG_TRACY:FeatureFlag = "FEATURE_DEBUG_TRACY";
/**
* `-DFEATURE_DISCORD_RPC`
* If this flag is enabled, the game will enable the Discord Remote Procedure Call library.
@ -516,6 +524,16 @@ class Project extends HXProject {
// Cleaner looking compiler errors.
setHaxedef("message.reporting", "pretty");
if (FEATURE_DEBUG_TRACY.isEnabled(this)) {
setHaxedef("HXCPP_TELEMETRY"); // Enable telemetry
setHaxedef("HXCPP_TRACY"); // Enable Tracy telemetry
setHaxedef("HXCPP_TRACY_MEMORY"); // Track memory allocations
setHaxedef("HXCPP_TRACY_ON_DEMAND"); // Only collect telemetry when Tracy is open and reachable
// setHaxedef("HXCPP_TRACY_INCLUDE_CALLSTACKS"); // Inspect callstacks per zone, inflating telemetry data
setHaxedef("absolute-paths"); // Fix source locations so Tracy can see them
}
}
/**