mirror of
https://github.com/wolfpld/tracy.git
synced 2026-06-08 00:23:47 +00:00
Move CMake option wrappers into cmake/options.cmake.
Move `tracy_set_option` and `tracy_set_option_value` from `CMakeLists.txt` into `cmake/options.cmake`. Add `tracy_set_option_value_as_string` for options whose value is embedded as a C string literal. All three accept an optional trailing target argument; when provided, the option is also propagated as a PUBLIC compile definition on that target. Existing `set_option`/`set_option_value` are unchanged but will be replaced later by the `tracy_*` versions.
This commit is contained in:
@@ -108,60 +108,44 @@ endif()
|
||||
|
||||
include(cmake/options.cmake)
|
||||
|
||||
# Local wrapper that also sets compile definitions for TracyClient
|
||||
macro(tracy_set_option option help value)
|
||||
set_option(${option} "${help}" ${value})
|
||||
if(${option})
|
||||
target_compile_definitions(TracyClient PUBLIC ${option})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Local wrapper for value options that also sets compile definitions for TracyClient
|
||||
macro(tracy_set_option_value var help default)
|
||||
set_option_value(${var} "${help}" "${default}")
|
||||
if(${var})
|
||||
target_compile_definitions(TracyClient PUBLIC ${var}=${${var}})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
tracy_set_option(TRACY_ENABLE "Enable profiling" OFF)
|
||||
tracy_set_option(TRACY_ON_DEMAND "On-demand profiling" OFF)
|
||||
tracy_set_option_value(TRACY_CALLSTACK "Override the callstack collection depth for tracy zones" "")
|
||||
tracy_set_option(TRACY_NO_CALLSTACK "Disable all callstack related functionality" OFF)
|
||||
tracy_set_option(TRACY_NO_CALLSTACK_INLINES "Disables the inline functions in callstacks" OFF)
|
||||
tracy_set_option(TRACY_ONLY_LOCALHOST "Only listen on the localhost interface" OFF)
|
||||
tracy_set_option(TRACY_NO_BROADCAST "Disable client discovery by broadcast to local network" OFF)
|
||||
tracy_set_option(TRACY_ONLY_IPV4 "Tracy will only accept connections on IPv4 addresses (disable IPv6)" OFF)
|
||||
tracy_set_option(TRACY_NO_CODE_TRANSFER "Disable collection of source code" OFF)
|
||||
tracy_set_option(TRACY_NO_CONTEXT_SWITCH "Disable capture of context switches" OFF)
|
||||
tracy_set_option(TRACY_NO_EXIT "Client executable does not exit until all profile data is sent to server" OFF)
|
||||
tracy_set_option(TRACY_NO_SAMPLING "Disable call stack sampling" OFF)
|
||||
tracy_set_option(TRACY_NO_VERIFY "Disable zone validation for C API" OFF)
|
||||
tracy_set_option(TRACY_NO_VSYNC_CAPTURE "Disable capture of hardware Vsync events" OFF)
|
||||
tracy_set_option(TRACY_NO_FRAME_IMAGE "Disable the frame image support and its thread" OFF)
|
||||
tracy_set_option(TRACY_NO_SYSTEM_TRACING "Disable systrace sampling" OFF)
|
||||
tracy_set_option(TRACY_PATCHABLE_NOPSLEDS "Enable nopsleds for efficient patching by system-level tools (e.g. rr)" OFF)
|
||||
tracy_set_option(TRACY_DELAYED_INIT "Enable delayed initialization of the library (init on first call)" OFF)
|
||||
tracy_set_option(TRACY_MANUAL_LIFETIME "Enable the manual lifetime management of the profile" OFF)
|
||||
tracy_set_option(TRACY_FIBERS "Enable fibers support" OFF)
|
||||
tracy_set_option(TRACY_NO_CRASH_HANDLER "Disable crash handling" OFF)
|
||||
tracy_set_option(TRACY_TIMER_FALLBACK "Use lower resolution timers" OFF)
|
||||
tracy_set_option(TRACY_DISALLOW_HW_TIMER "Disallow hardware timer (may be useful on VMs). Requires TRACY_TIMER_FALLBACK=ON" OFF)
|
||||
tracy_set_option(TRACY_LIBUNWIND_BACKTRACE "Use libunwind backtracing where supported" OFF)
|
||||
tracy_set_option(TRACY_SYMBOL_OFFLINE_RESOLVE "Instead of full runtime symbol resolution, only resolve the image path and offset to enable offline symbol resolution" OFF)
|
||||
tracy_set_option(TRACY_LIBBACKTRACE_ELF_DYNLOAD_SUPPORT "Enable libbacktrace to support dynamically loaded elfs in symbol resolution resolution after the first symbol resolve operation" OFF)
|
||||
tracy_set_option(TRACY_DEBUGINFOD "Enable debuginfod support" OFF)
|
||||
tracy_set_option(TRACY_IGNORE_MEMORY_FAULTS "Ignore instrumentation errors from memory free events that do not have a matching allocation" OFF)
|
||||
tracy_set_option(TRACY_ENABLE "Enable profiling" OFF TracyClient)
|
||||
tracy_set_option(TRACY_ON_DEMAND "On-demand profiling" OFF TracyClient)
|
||||
tracy_set_option_value(TRACY_CALLSTACK "Override the callstack collection depth for tracy zones" "" TracyClient)
|
||||
tracy_set_option(TRACY_NO_CALLSTACK "Disable all callstack related functionality" OFF TracyClient)
|
||||
tracy_set_option(TRACY_NO_CALLSTACK_INLINES "Disables the inline functions in callstacks" OFF TracyClient)
|
||||
tracy_set_option(TRACY_ONLY_LOCALHOST "Only listen on the localhost interface" OFF TracyClient)
|
||||
tracy_set_option(TRACY_NO_BROADCAST "Disable client discovery by broadcast to local network" OFF TracyClient)
|
||||
tracy_set_option(TRACY_ONLY_IPV4 "Tracy will only accept connections on IPv4 addresses (disable IPv6)" OFF TracyClient)
|
||||
tracy_set_option(TRACY_NO_CODE_TRANSFER "Disable collection of source code" OFF TracyClient)
|
||||
tracy_set_option(TRACY_NO_CONTEXT_SWITCH "Disable capture of context switches" OFF TracyClient)
|
||||
tracy_set_option(TRACY_NO_EXIT "Client executable does not exit until all profile data is sent to server" OFF TracyClient)
|
||||
tracy_set_option(TRACY_NO_SAMPLING "Disable call stack sampling" OFF TracyClient)
|
||||
tracy_set_option(TRACY_NO_VERIFY "Disable zone validation for C API" OFF TracyClient)
|
||||
tracy_set_option(TRACY_NO_VSYNC_CAPTURE "Disable capture of hardware Vsync events" OFF TracyClient)
|
||||
tracy_set_option(TRACY_NO_FRAME_IMAGE "Disable the frame image support and its thread" OFF TracyClient)
|
||||
tracy_set_option(TRACY_NO_SYSTEM_TRACING "Disable systrace sampling" OFF TracyClient)
|
||||
tracy_set_option(TRACY_PATCHABLE_NOPSLEDS "Enable nopsleds for efficient patching by system-level tools (e.g. rr)" OFF TracyClient)
|
||||
tracy_set_option(TRACY_DELAYED_INIT "Enable delayed initialization of the library (init on first call)" OFF TracyClient)
|
||||
tracy_set_option(TRACY_MANUAL_LIFETIME "Enable the manual lifetime management of the profile" OFF TracyClient)
|
||||
tracy_set_option(TRACY_FIBERS "Enable fibers support" OFF TracyClient)
|
||||
tracy_set_option(TRACY_NO_CRASH_HANDLER "Disable crash handling" OFF TracyClient)
|
||||
tracy_set_option(TRACY_TIMER_FALLBACK "Use lower resolution timers" OFF TracyClient)
|
||||
tracy_set_option(TRACY_DISALLOW_HW_TIMER "Disallow hardware timer (may be useful on VMs). Requires TRACY_TIMER_FALLBACK=ON" OFF TracyClient)
|
||||
tracy_set_option(TRACY_LIBUNWIND_BACKTRACE "Use libunwind backtracing where supported" OFF TracyClient)
|
||||
tracy_set_option(TRACY_SYMBOL_OFFLINE_RESOLVE "Instead of full runtime symbol resolution, only resolve the image path and offset to enable offline symbol resolution" OFF TracyClient)
|
||||
tracy_set_option(TRACY_LIBBACKTRACE_ELF_DYNLOAD_SUPPORT "Enable libbacktrace to support dynamically loaded elfs in symbol resolution resolution after the first symbol resolve operation" OFF TracyClient)
|
||||
tracy_set_option(TRACY_DEBUGINFOD "Enable debuginfod support" OFF TracyClient)
|
||||
tracy_set_option(TRACY_IGNORE_MEMORY_FAULTS "Ignore instrumentation errors from memory free events that do not have a matching allocation" OFF TracyClient)
|
||||
|
||||
# advanced
|
||||
tracy_set_option(TRACY_VERBOSE "[advanced] Verbose output from the profiler" OFF)
|
||||
tracy_set_option(TRACY_VERBOSE "[advanced] Verbose output from the profiler" OFF TracyClient)
|
||||
mark_as_advanced(TRACY_VERBOSE)
|
||||
tracy_set_option(TRACY_NO_INTERNAL_MESSAGE "[advanced] Prevent the profiler from logging messages" OFF)
|
||||
tracy_set_option(TRACY_NO_INTERNAL_MESSAGE "[advanced] Prevent the profiler from logging messages" OFF TracyClient)
|
||||
mark_as_advanced(TRACY_NO_INTERNAL_MESSAGE)
|
||||
tracy_set_option(TRACY_DEMANGLE "[advanced] Don't use default demangling function - You'll need to provide your own" OFF)
|
||||
tracy_set_option(TRACY_DEMANGLE "[advanced] Don't use default demangling function - You'll need to provide your own" OFF TracyClient)
|
||||
mark_as_advanced(TRACY_DEMANGLE)
|
||||
if(rocprofiler-sdk_FOUND)
|
||||
tracy_set_option(TRACY_ROCPROF_CALIBRATION "[advanced] Use continuous calibration of the Rocprof GPU time." OFF)
|
||||
tracy_set_option(TRACY_ROCPROF_CALIBRATION "[advanced] Use continuous calibration of the Rocprof GPU time." OFF TracyClient)
|
||||
mark_as_advanced(TRACY_ROCPROF_CALIBRATION)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
# Usage:
|
||||
# set_option(OPTION_NAME "Help text" ON/OFF) - for boolean options
|
||||
# set_option_value(VAR_NAME "Help text" "value") - for value options (CACHE STRING)
|
||||
#
|
||||
# The tracy_set_option* variants optionally propagate the option as a PUBLIC
|
||||
# compile definition on a target passed as trailing argument. Without a target
|
||||
# they behave identically to the bare helpers above.
|
||||
|
||||
# Boolean options (ON/OFF)
|
||||
macro(set_option option help value)
|
||||
@@ -23,3 +27,28 @@ macro(set_option_value var help default)
|
||||
message(STATUS "${var}: (not set)")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Boolean option, optionally propagated as PUBLIC compile definition.
|
||||
macro(tracy_set_option option help value)
|
||||
set_option(${option} "${help}" ${value})
|
||||
if(${option} AND ${ARGC} GREATER 3)
|
||||
target_compile_definitions(${ARGV3} PUBLIC ${option})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Value option, optionally propagated as PUBLIC compile definition (VAR=value).
|
||||
macro(tracy_set_option_value var help default)
|
||||
set_option_value(${var} "${help}" "${default}")
|
||||
if(${var} AND ${ARGC} GREATER 3)
|
||||
target_compile_definitions(${ARGV3} PUBLIC ${var}=${${var}})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Value option propagated as a C string literal (VAR="value").
|
||||
# For options whose value is a path or string consumed verbatim in C/C++ code.
|
||||
macro(tracy_set_option_value_as_string var help default)
|
||||
set_option_value(${var} "${help}" "${default}")
|
||||
if(${var} AND ${ARGC} GREATER 3)
|
||||
target_compile_definitions(${ARGV3} PUBLIC "${var}=\"${${var}}\"")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
Reference in New Issue
Block a user