add tracy profiler dependency

This commit is contained in:
2026-02-22 23:32:24 +01:00
parent e43e505110
commit 21a18443e9
2 changed files with 25 additions and 1 deletions

View File

@ -3,16 +3,32 @@ project(MassSprings)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
find_package(raylib REQUIRED) find_package(raylib REQUIRED)
find_package(OpenMP 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) include_directories(include)
add_executable(masssprings add_executable(masssprings
src/main.cpp src/main.cpp
src/camera.cpp src/camera.cpp
src/renderer.cpp src/renderer.cpp
src/octree.cpp
src/physics.cpp src/physics.cpp
src/puzzle.cpp src/puzzle.cpp
src/state.cpp src/state.cpp
@ -20,4 +36,8 @@ add_executable(masssprings
) )
target_include_directories(masssprings PUBLIC ${RAYLIB_CPP_INCLUDE_DIR}) 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) target_link_libraries(masssprings PUBLIC raylib OpenMP::OpenMP_CXX)
endif()

View File

@ -125,7 +125,9 @@ rec {
# clang-tools # clang-tools
# compdb # compdb
# pprof # pprof
gprof2dot # gprof2dot
perf
hotspot
kdePackages.kcachegrind kdePackages.kcachegrind
gdbgui gdbgui
# renderdoc # renderdoc
@ -141,6 +143,7 @@ rec {
raylib raylib
# octree # this one doesn't store center of mass per node - which I need :( # 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 llvmPackages.openmp # not required for compilation but for clangd to find the headers
tracy
# raylib-cpp # raylib-cpp
# tinyobjloader # tinyobjloader
# gperftools # gperftools
@ -225,6 +228,7 @@ rec {
echo "Running cmake" echo "Running cmake"
cmake -G "Unix Makefiles" \ cmake -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE="${type}" \ -DCMAKE_BUILD_TYPE="${type}" \
-DUSE_TRACY=On \
.. ..
echo "Linking compile_commands.json" echo "Linking compile_commands.json"