Skip to content

Commit

Permalink
Try propagating link dependencies and add install warning
Browse files Browse the repository at this point in the history
  • Loading branch information
sethrj committed Jan 23, 2024
1 parent 27626db commit 641fa6b
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,18 @@ elseif(CELERITAS_USE_HIP)
set(CELERITAS_HAVE_ROCTX ON)
target_link_libraries(celeritas_device_toolkit INTERFACE ${ROCTX_LIBRARY})
endif()
# TODO: downstream libs don't link against correct HIP dependencies when using
# static libraries
if(NOT BUILD_SHARED_LIBS)
# Downstream libs don't link against correct HIP dependencies when using
# static libraries, and even though the code below propagates the library
# names (-lamdhip64) CMake fails to include the link directories
# (/opt/rocm/lib)
target_link_libraries(celeritas_device_toolkit
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_HIP_IMPLICIT_LINK_LIBRARIES}>"
)
target_link_directories(celeritas_device_toolkit
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_HIP_IMPLICIT_LINK_DIRECTORIES}>"
)
endif()
endif()

install(TARGETS celeritas_device_toolkit
Expand Down Expand Up @@ -610,6 +620,12 @@ message(WARNING \"The Celeritas version was not detected during configuration.
provenance data in output results.\")
")
endif()

if(CELERITAS_USE_HIP AND NOT BUILD_SHARED_LIBS)
# See celeritas_device_toolkit above
install(CODE "
message(WARNING \"CMake may not be able to correctly propagate implicit HIP
libraries: downstream executables may fail to link.\")
")
endif()

#----------------------------------------------------------------------------#

0 comments on commit 641fa6b

Please sign in to comment.