diff --git a/CMakeLists.txt b/CMakeLists.txt index ccf68101..679fda6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ else() endif() find_package(Threads REQUIRED) -find_package(rocprofiler-sdk REQUIRED PATHS "/opt/rocm/lib/cmake") +find_package(rocprofiler-sdk PATHS "/opt/rocm/lib/cmake") set(TRACY_PUBLIC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/public) @@ -56,8 +56,11 @@ target_link_libraries( PUBLIC Threads::Threads ${CMAKE_DL_LIBS} - rocprofiler-sdk::rocprofiler-sdk ) +if(rocprofiler-sdk_FOUND) + target_compile_definitions(TracyClient PUBLIC TRACY_ROCPROF) + target_link_libraries(TracyClient PUBLIC rocprofiler-sdk::rocprofiler-sdk) +endif() if(TRACY_Fortran) add_library(TracyClientF90 ${TRACY_VISIBILITY} "${TRACY_PUBLIC_DIR}/TracyClient.F90") diff --git a/public/TracyClient.cpp b/public/TracyClient.cpp index 192f36e4..70bca515 100644 --- a/public/TracyClient.cpp +++ b/public/TracyClient.cpp @@ -31,7 +31,10 @@ #include "client/TracyAlloc.cpp" #include "client/TracyOverride.cpp" #include "client/TracyKCore.cpp" + +#ifdef TRACY_ROCPROF #include "client/TracyRocprof.cpp" +#endif #if defined(TRACY_HAS_CALLSTACK) # if TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 3 || TRACY_HAS_CALLSTACK == 4 || TRACY_HAS_CALLSTACK == 6