Files
nixpkgs/pkgs/development/rocm-modules/rocprofiler-sdk/0006-rocprofiler-sdk-allow-using-system-otf2-dependency.patch

54 lines
1.9 KiB
Diff

From 0f81ad1a46df9da7c9653812eded2165d0cd794d Mon Sep 17 00:00:00 2001
From: Robin Voetter <rvoetter@amd.com>
Date: Sat, 4 Apr 2026 21:58:13 +0000
Subject: [PATCH] [rocprofiler-sdk] allow using system otf2 dependency
This adds a new option, ROCPROFILER_BUILD_OTF2, which can be set to OFF to
make rocprofiler-sdk use a system dependency for OTF2 instead of trying to
build it manually. To mimick old behavior, ROCPROFILER_BUILD_OTF2 is set to
ON by default.
Related: https://github.com/ROCm/rocm-systems/pull/2319
---
cmake/rocprofiler_options.cmake | 2 ++
external/CMakeLists.txt | 10 +++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/cmake/rocprofiler_options.cmake b/cmake/rocprofiler_options.cmake
index da9ee9ad29..077898a520 100644
--- a/cmake/rocprofiler_options.cmake
+++ b/cmake/rocprofiler_options.cmake
@@ -69,6 +69,8 @@ rocprofiler_add_option(ROCPROFILER_BUILD_YAML_CPP
"Enable building yaml-cpp library internally" ON)
rocprofiler_add_option(ROCPROFILER_BUILD_ELFIO "Enable building ELFIO library internally"
ON)
+rocprofiler_add_option(ROCPROFILER_BUILD_OTF2 "Enable building OTF2 library internally"
+ ON)
if(ROCPROFILER_BUILD_TESTS)
rocprofiler_add_option(
ROCPROFILER_BUILD_GTEST
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
index ade8d25c1b..0c5d4e5fe5 100644
--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -225,7 +225,15 @@ endif()
#
# OTF2
#
-add_subdirectory(otf2)
+if(ROCPROFILER_BUILD_OTF2)
+ add_subdirectory(otf2)
+else()
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(OTF2 REQUIRED IMPORTED_TARGET otf2)
+ add_library(otf2 INTERFACE)
+ add_library(otf2::otf2 ALIAS otf2)
+ target_link_libraries(otf2 INTERFACE PkgConfig::OTF2)
+endif()
rocprofiler_checkout_git_submodule(
RECURSIVE
--
2.43.0