Skip to content

Commit d167028

Browse files
Jeffrey Tanclayborg
authored andcommitted
Use PARTIAL_SOURCES_INTENDED
1 parent d3deb21 commit d167028

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

lldb/source/Plugins/Process/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ add_subdirectory(scripted)
2626
add_subdirectory(gdb-remote)
2727
add_subdirectory(Utility)
2828
add_subdirectory(elf-core)
29-
add_subdirectory(amdgpu-core)
29+
30+
# Only add amdgpu-core if AMDGPU plugin is enabled
31+
if(LLDB_ENABLE_AMDGPU_PLUGIN)
32+
add_subdirectory(amdgpu-core)
33+
endif()
34+
3035
add_subdirectory(mach-core)
3136
add_subdirectory(minidump)
3237
add_subdirectory(FreeBSDKernel)

lldb/source/Plugins/Process/Utility/CMakeLists.txt

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# TODO: Clean up this directory and its dependencies
22
set_property(DIRECTORY PROPERTY LLDB_PLUGIN_KIND ProcessUtility)
33

4-
# Conditionally find AMD-dbgapi package
5-
set(amd-dbgapi_DIR "${ROCM_PATH}/lib/cmake/amd-dbgapi" CACHE PATH "Path to amd-dbgapi cmake config")
6-
find_package(amd-dbgapi QUIET CONFIG)
7-
84
# Set up source files list
95
set(PROCESS_UTILITY_SOURCES
106
AuxVector.cpp
@@ -71,8 +67,8 @@ set(PROCESS_UTILITY_SOURCES
7167
ThreadMemory.cpp
7268
)
7369

74-
# Conditionally add AMD GPU support if amd-dbgapi is found
75-
set(LINK_LIBS_LIST
70+
# Set up link libraries
71+
set(UTILITY_LINK_LIBS
7672
lldbBreakpoint
7773
lldbCore
7874
lldbDataFormatters
@@ -84,19 +80,28 @@ set(LINK_LIBS_LIST
8480
lldbValueObject
8581
)
8682

87-
if(amd-dbgapi_FOUND)
88-
message(STATUS "AMD-dbgapi found, enabling AMDGPU support in ProcessUtility")
89-
list(APPEND PROCESS_UTILITY_SOURCES RegisterContextAmdGpuImpl.cpp)
90-
list(APPEND LINK_LIBS_LIST amd-dbgapi)
83+
# Conditionally add AMD GPU support if enabled
84+
if(LLDB_ENABLE_AMDGPU_PLUGIN)
85+
if(NOT DEFINED ROCM_PATH)
86+
set(ROCM_PATH "/opt/rocm" CACHE PATH "Path to ROCm installation")
87+
endif()
88+
set(amd-dbgapi_DIR "${ROCM_PATH}/lib/cmake/amd-dbgapi" CACHE PATH "Path to amd-dbgapi cmake config")
89+
find_package(amd-dbgapi REQUIRED CONFIG)
9190
include_directories(${ROCM_PATH}/include)
91+
92+
# Add AMD GPU source file to the build
93+
list(APPEND PROCESS_UTILITY_SOURCES RegisterContextAmdGpuImpl.cpp)
94+
list(APPEND UTILITY_LINK_LIBS amd-dbgapi)
9295
endif()
9396

9497
add_lldb_library(lldbPluginProcessUtility
9598
${PROCESS_UTILITY_SOURCES}
9699

100+
PARTIAL_SOURCES_INTENDED
101+
97102
LINK_COMPONENTS
98103
Support
99104
TargetParser
100105
LINK_LIBS
101-
${LINK_LIBS_LIST}
106+
${UTILITY_LINK_LIBS}
102107
)

lldb/source/Plugins/Process/amdgpu-core/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Find AMD-dbgapi package using the provided CMake config
2+
# ROCM_PATH should be set via -DROCM_PATH=... when configuring cmake
3+
if(NOT DEFINED ROCM_PATH)
4+
set(ROCM_PATH "/opt/rocm" CACHE PATH "Path to ROCm installation")
5+
message(STATUS "ROCM_PATH not set, using default: ${ROCM_PATH}")
6+
endif()
7+
28
set(amd-dbgapi_DIR "${ROCM_PATH}/lib/cmake/amd-dbgapi" CACHE PATH "Path to amd-dbgapi cmake config")
9+
message(STATUS "Looking for amd-dbgapi in: ${amd-dbgapi_DIR}")
310
find_package(amd-dbgapi REQUIRED CONFIG)
411

512
include_directories(${ROCM_PATH}/include)

0 commit comments

Comments
 (0)