[SWDEV-431345][SWDEV-432633] toplevel cmake for hip samples

Change-Id: If22e7e96604f184458cc6ab6bb9945152f9359e0
This commit is contained in:
Rahul Manocha
2023-11-13 19:12:54 +00:00
parent 4a60fe5fd1
commit 7481de706f
33 changed files with 461 additions and 89 deletions
@@ -30,13 +30,20 @@ if(UNIX)
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH})
endif()
set(CMAKE_CXX_COMPILER "${ROCM_PATH}/llvm/bin/clang++")
# Find hiprtc
find_package(hiprtc REQUIRED)
# Find hip
find_package(hip REQUIRED)
# Create the excutable
add_executable(test saxpy.cpp)
if(TARGET build_cookbook)
set(EXCLUDE_OPTION EXCLUDE_FROM_ALL)
else()
set(EXCLUDE_OPTION )
endif()
add_executable(test ${EXCLUDE_OPTION} saxpy.cpp)
# Link with HIPRTC
target_link_libraries(test hiprtc::hiprtc)
@@ -44,3 +51,7 @@ target_link_libraries(test hiprtc::hiprtc)
target_link_libraries(test hip::device)
target_include_directories(test PRIVATE ../../common)
if(TARGET build_cookbook)
add_dependencies(build_cookbook test)
endif()