From 431bd434eee86d851500cb6e3105faff36ae5dfc Mon Sep 17 00:00:00 2001
From: Christoph Alt <christoph.alt@fau.de>
Date: Thu, 17 Apr 2025 11:19:25 +0200
Subject: [PATCH] also loading hip runtime libs and link them

---
 CMakeLists.txt         | 2 ++
 src/gpu/CMakeLists.txt | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 48f89c5cb..915b1d64e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -686,9 +686,11 @@ if ( WALBERLA_BUILD_WITH_HIP )
 
     if( CMAKE_HIP_COMPILER )
         enable_language(HIP)
+        find_package(hip REQUIRED)
         # since waLBerla also supports CUDA we only use HIP on an AMD platform
         add_compile_definitions(__HIP_PLATFORM_AMD__)
         # include_directories(${HSA_HEADER})
+        list (APPEND SERVICE_LIBS hip::host)
     else()
         message( FATAL_ERROR "HIP could not be found. Either make HIP available or disable WALBERLA_BUILD_WITH_HIP!" )
     endif ( )
diff --git a/src/gpu/CMakeLists.txt b/src/gpu/CMakeLists.txt
index 263650bbc..eb10f9ed1 100644
--- a/src/gpu/CMakeLists.txt
+++ b/src/gpu/CMakeLists.txt
@@ -51,6 +51,13 @@ if (WALBERLA_BUILD_WITH_CUDA)
         )
 endif (WALBERLA_BUILD_WITH_CUDA)
 
+if (WALBERLA_BUILD_WITH_HIP)
+   target_link_libraries( walberla_gpu
+        Public
+        hip::host
+        )
+endif (WALBERLA_BUILD_WITH_HIP)
+
 add_subdirectory( sweeps )
 add_subdirectory( communication )
 add_subdirectory( lbm )
-- 
GitLab