-
Notifications
You must be signed in to change notification settings - Fork 228
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
268 lines (244 loc) · 7.88 KB
/
CMakeLists.txt
File metadata and controls
268 lines (244 loc) · 7.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
set(DEBUG_TOOLS_DIR "${THEROCK_SOURCE_DIR}/debug-tools")
if(THEROCK_ENABLE_AMD_DBGAPI)
##############################################################################
# amd-dbgapi
#
# A library that provides support for a debugger and other tools to perform
# low-level control of the running code and inspection of the running state
# of AMD GPU's.
##############################################################################
therock_cmake_subproject_declare(amd-dbgapi
USE_DIST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/projects/rocdbgapi"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/amd-dbgapi"
COMPILER_TOOLCHAIN
amd-llvm
CMAKE_ARGS
-DTHE_ROCK_BUILD=ON
BUILD_DEPS
ROCR-Runtime
${THEROCK_BUNDLED_LIBBACKTRACE}
RUNTIME_DEPS
amd-comgr
INTERFACE_LINK_DIRS
"lib"
INTERFACE_INSTALL_RPATH_DIRS
"lib"
INTERFACE_PKG_CONFIG_DIRS
"share/pkgconfig"
)
therock_cmake_subproject_glob_c_sources(amd-dbgapi SUBDIRS
include
src
)
therock_cmake_subproject_provide_package(amd-dbgapi amd-dbgapi
lib/cmake/amd-dbgapi
)
therock_cmake_subproject_activate(amd-dbgapi)
# Check that we built the one library we're supposed to build.
therock_test_validate_shared_lib(PATH amd-dbgapi/dist/lib
LIB_NAMES
librocm-dbgapi.so
)
# The artifacts provided by amd-dbgapi.
therock_provide_artifact(amd-dbgapi
TARGET_NEUTRAL
DESCRIPTOR artifact-amd-dbgapi.toml
COMPONENTS
dbg
dev
doc
lib
SUBPROJECT_DEPS
amd-comgr
amd-dbgapi
)
endif()
if(THEROCK_ENABLE_ROCR_DEBUG_AGENT)
##############################################################################
# rocr-debug-agent
#
# A library that can be loaded by the ROCm software runtime to print the
# state of wavefronts.
##############################################################################
# Make sure to pass -DENABLE_TESTS=OFF so we don't build
# rocr-debug-agent-tests alongside the library. The tests need to be built
# for each gfx level that is requested by the build.
therock_cmake_subproject_declare(rocr-debug-agent
USE_DIST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/projects/rocr-debug-agent"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/rocr-debug-agent"
CMAKE_ARGS
"-DENABLE_TESTS=OFF"
COMPILER_TOOLCHAIN
amd-llvm
RUNTIME_DEPS
amd-dbgapi
ROCR-Runtime
${THEROCK_BUNDLED_ELFUTILS}
INTERFACE_LINK_DIRS
"lib"
INTERFACE_INSTALL_RPATH_DIRS
"lib"
)
therock_cmake_subproject_glob_c_sources(rocr-debug-agent SUBDIRS
src
)
therock_cmake_subproject_provide_package(rocr-debug-agent rocr-debug-agent
lib/cmake/rocr-debug-agent)
therock_cmake_subproject_activate(rocr-debug-agent)
# Check that we built the one library we're supposed to build.
therock_test_validate_shared_lib(PATH rocr-debug-agent/dist/lib
LIB_NAMES
librocm-debug-agent.so
)
# The artifacts provided by rocr-debug-agent.
therock_provide_artifact(rocr-debug-agent
TARGET_NEUTRAL
DESCRIPTOR artifact-rocr-debug-agent.toml
COMPONENTS
dbg
dev
doc
lib
SUBPROJECT_DEPS
${THEROCK_BUNDLED_ELFUTILS}
amd-dbgapi
rocr-debug-agent
ROCR-Runtime
)
endif()
if(THEROCK_ENABLE_ROCR_DEBUG_AGENT_TESTS)
##############################################################################
# rocr-debug-agent-tests
#
# Validation tests for the rocr-debug-agent component. This is only built
# whenever -DTHEROCK_BUILD_TESTING=ON. If multiple GPU targets are specified,
# fat binaries are built containing support for all of those GPU targets.
##############################################################################
if(THEROCK_BUILD_TESTING)
therock_cmake_subproject_declare(rocr-debug-agent-tests
USE_TEST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/projects/rocr-debug-agent/test"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/rocr-debug-agent-tests"
INSTALL_RPATH_EXECUTABLE_DIR
"tests/rocm-debug-agent"
CMAKE_ARGS
"-DHIP_PLATFORM=amd"
COMPILER_TOOLCHAIN
amd-hip
RUNTIME_DEPS
amd-dbgapi
hip-clr
rocr-debug-agent
ROCR-Runtime
${THEROCK_BUNDLED_ELFUTILS}
)
therock_cmake_subproject_glob_c_sources(rocr-debug-agent-tests SUBDIRS
.
)
therock_cmake_subproject_provide_package(rocr-debug-agent-tests rocr-debug-agent-tests
lib/cmake/rocr-debug-agent-tests)
therock_cmake_subproject_activate(rocr-debug-agent-tests)
# The artifacts provided by rocr-debug-agent-tests.
therock_provide_artifact(rocr-debug-agent-tests
TARGET_NEUTRAL
DESCRIPTOR artifact-rocr-debug-agent-tests.toml
COMPONENTS
doc
test
SUBPROJECT_DEPS
${THEROCK_BUNDLED_ELFUTILS}
amd-dbgapi
hip-clr
rocr-debug-agent
rocr-debug-agent-tests
ROCR-Runtime
)
endif()
endif()
if(THEROCK_ENABLE_ROCGDB)
##############################################################################
# rocgdb
#
# The AMD source-level debugger for Linux, based on the GNU Debugger (GDB).
##############################################################################
therock_detect_shared_python_executables(_rocgdb_python_executables)
if(_rocgdb_python_executables)
message(STATUS "Building rocgdb against the following libpython versions: ${_rocgdb_python_executables}")
# Escape semicolons so the list survives a call to
# therock_cmake_subproject_declare and also add_custom_command
# expansion in CMAKE_ARGS.
string(REPLACE ";" "\\\$<SEMICOLON>" _rocgdb_python_executables_escaped "${_rocgdb_python_executables}")
else()
message(WARNING "No Python with shared libpython found. rocgdb will be built without Python support.")
endif()
if(NOT ${THEROCK_ROCGDB_SOURCE_DIR} STREQUAL ${THEROCK_ROCGDB_SOURCE_DIR_DEFAULT})
message(WARNING "Configuring ROCgdb with modified source directory: ${THEROCK_ROCGDB_SOURCE_DIR}")
endif()
therock_cmake_subproject_declare(rocgdb
USE_DIST_AMDGPU_TARGETS
EXTERNAL_SOURCE_DIR "rocgdb"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/rocgdb"
CMAKE_ARGS
"-DPATCHELF=${PATCHELF}"
"-DBUILD_TESTING=${THEROCK_BUILD_TESTING}"
"-DROCM_VERSION=${ROCM_MAJOR_VERSION}.${ROCM_MINOR_VERSION}.${ROCM_PATCH_VERSION}"
"-DSHARED_PYTHON_EXECUTABLES=${_rocgdb_python_executables_escaped}"
"-DTHEROCK_BUNDLE_SYSDEPS=${THEROCK_BUNDLE_SYSDEPS}"
"-DROCGDB_SOURCE_DIR=${THEROCK_ROCGDB_SOURCE_DIR}"
COMPILER_TOOLCHAIN
amd-llvm
RUNTIME_DEPS
amd-comgr
amd-dbgapi
${THEROCK_BUNDLED_BZIP2}
${THEROCK_BUNDLED_GMP}
${THEROCK_BUNDLED_MPFR}
${THEROCK_BUNDLED_EXPAT}
${THEROCK_BUNDLED_NCURSES}
${THEROCK_BUNDLED_LIBLZMA}
${THEROCK_BUNDLED_ZLIB}
${THEROCK_BUNDLED_ZSTD}
INTERFACE_PROGRAM_DIRS
"bin"
INTERFACE_LINK_DIRS
"lib"
)
# We may want to adjust this to optimize rebuilds.
therock_cmake_subproject_glob_c_sources(rocgdb SUBDIRS
bfd
binutils
gdb
gdbsupport
includes
)
therock_cmake_subproject_provide_package(rocgdb rocgdb lib/cmake/rocgdb)
therock_cmake_subproject_activate(rocgdb)
# The artifacts provided by rocgdb.
therock_provide_artifact(rocgdb
TARGET_NEUTRAL
DESCRIPTOR artifact-rocgdb.toml
COMPONENTS
dbg
dev
doc
lib
run
test
SUBPROJECT_DEPS
amd-comgr
amd-dbgapi
${THEROCK_BUNDLED_BZIP2}
${THEROCK_BUNDLED_EXPAT}
${THEROCK_BUNDLED_GMP}
${THEROCK_BUNDLED_MPFR}
${THEROCK_BUNDLED_NCURSES}
${THEROCK_BUNDLED_LIBLZMA}
${THEROCK_BUNDLED_ZLIB}
${THEROCK_BUNDLED_ZSTD}
rocgdb
)
endif()