diff --git a/profiler/CMakeLists.txt b/profiler/CMakeLists.txt index 95884690..50a2d10c 100644 --- a/profiler/CMakeLists.txt +++ b/profiler/CMakeLists.txt @@ -5,6 +5,7 @@ option(GTK_FILESELECTOR "Use the GTK file selector on Linux instead of the xdg-p option(LEGACY "Instead of Wayland, use the legacy X11 backend on Linux" OFF) option(NO_ISA_EXTENSIONS "Disable ISA extensions (don't pass -march=native or -mcpu=native to the compiler)" OFF) option(NO_STATISTICS "Disable calculation of statistics" OFF) +option(SELF_PROFILE "Enable self-profiling" OFF) include(${CMAKE_CURRENT_LIST_DIR}/../cmake/version.cmake) @@ -147,6 +148,15 @@ endif() include_directories(${INCLUDES}) link_libraries(${LIBS}) +if(SELF_PROFILE) + add_definitions(-DTRACY_ENABLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 -fno-omit-frame-pointer") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O3 -fno-omit-frame-pointer") + set(PROFILER_FILES ${PROFILER_FILES} + ../public/TracyClient.cpp + ) +endif() + if(WIN32) set(PROFILER_FILES ${PROFILER_FILES} win32/Tracy.manifest