From 21a18443e97c168f5581e48658caf833071aea26 Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Sun, 22 Feb 2026 23:32:24 +0100 Subject: [PATCH] add tracy profiler dependency --- CMakeLists.txt | 20 ++++++++++++++++++++ flake.nix | 6 +++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07f2deb..332897e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,16 +3,32 @@ project(MassSprings) set(CMAKE_CXX_STANDARD 23) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) find_package(raylib REQUIRED) find_package(OpenMP REQUIRED) +# TODO: Need to enable/disable this based on a variable for nix build +if(USE_TRACY) +include(FetchContent) +FetchContent_Declare(tracy + GIT_REPOSITORY https://github.com/wolfpld/tracy.git + GIT_TAG v0.11.1 + GIT_SHALLOW TRUE + GIT_PROGRESS TRUE +) +FetchContent_MakeAvailable(tracy) +option(TRACY_ENABLE "" ON) +option(TRACY_ON_DEMAND "" ON) +endif() + include_directories(include) add_executable(masssprings src/main.cpp src/camera.cpp src/renderer.cpp + src/octree.cpp src/physics.cpp src/puzzle.cpp src/state.cpp @@ -20,4 +36,8 @@ add_executable(masssprings ) target_include_directories(masssprings PUBLIC ${RAYLIB_CPP_INCLUDE_DIR}) +if(USE_TRACY) +target_link_libraries(masssprings PUBLIC raylib OpenMP::OpenMP_CXX TracyClient) +else() target_link_libraries(masssprings PUBLIC raylib OpenMP::OpenMP_CXX) +endif() diff --git a/flake.nix b/flake.nix index f056ab0..9ff6e54 100644 --- a/flake.nix +++ b/flake.nix @@ -125,7 +125,9 @@ rec { # clang-tools # compdb # pprof - gprof2dot + # gprof2dot + perf + hotspot kdePackages.kcachegrind gdbgui # renderdoc @@ -141,6 +143,7 @@ rec { raylib # octree # this one doesn't store center of mass per node - which I need :( llvmPackages.openmp # not required for compilation but for clangd to find the headers + tracy # raylib-cpp # tinyobjloader # gperftools @@ -225,6 +228,7 @@ rec { echo "Running cmake" cmake -G "Unix Makefiles" \ -DCMAKE_BUILD_TYPE="${type}" \ + -DUSE_TRACY=On \ .. echo "Linking compile_commands.json"