Skip to content

Commit 18a2fdb

Browse files
committed
Properly configure hipCUB dependency
The HIP backend of MGARDX required the use of hipCUB. This is often installed with hip and will just be available, but it is not always. In the case where it is installed separately, make sure it is configured.
1 parent 58f8d40 commit 18a2fdb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,21 @@ if (MGARD_ENABLE_HIP)
207207
target_compile_definitions(mgard-library PUBLIC MGARD_ENABLE_HIP)
208208
set (CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -w")
209209
set_source_files_properties(${MGARD_X_HIP_SRC} PROPERTIES LANGUAGE HIP)
210+
211+
# Find the required hipCUB packages, which is usually, but not always,
212+
# installed with hip.
213+
find_package(rocprim REQUIRED CONFIG)
214+
find_package(hipcub REQUIRED CONFIG)
215+
# Normally, we would use target_link_libraries to include the hip::hipcub
216+
# include directories and other parameters. However, for some reason this
217+
# library has been changing the compiler and causing errors. Perhaps this
218+
# is because different sources require different compilers. So, instead just
219+
# grab the include directories.
220+
target_include_directories(mgard-library
221+
PUBLIC $<TARGET_PROPERTY:hip::hipcub,INTERFACE_INCLUDE_DIRECTORIES>
222+
PUBLIC $<TARGET_PROPERTY:roc::rocprim_hip,INTERFACE_INCLUDE_DIRECTORIES>
223+
PUBLIC $<TARGET_PROPERTY:roc::rocprim,INTERFACE_INCLUDE_DIRECTORIES>
224+
)
210225
endif()
211226

212227
if (MGARD_ENABLE_SYCL)

0 commit comments

Comments
 (0)