[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
+12 -2
View File
@@ -33,7 +33,8 @@ if(UNIX)
endif()
# create square.cpp
execute_process(COMMAND sh -c "${CMAKE_PREFIX_PATH}/bin/hipify-perl ../square.cu > ../square.cpp")
execute_process(COMMAND sh -c "${CMAKE_PREFIX_PATH}/bin/hipify-perl \
${CMAKE_CURRENT_SOURCE_DIR}/square.cu > ${CMAKE_CURRENT_BINARY_DIR}/square.cpp")
# Find hip
find_package(hip)
@@ -43,7 +44,16 @@ set(CMAKE_CXX_COMPILER ${HIP_HIPCC_EXECUTABLE})
set(CMAKE_CXX_LINKER ${HIP_HIPCC_EXECUTABLE})
# Create the excutable
add_executable(square square.cpp)
if(TARGET build_intro)
set(EXCLUDE_OPTION EXCLUDE_FROM_ALL)
else()
set(EXCLUDE_OPTION )
endif()
add_executable(square ${EXCLUDE_OPTION} ${CMAKE_CURRENT_BINARY_DIR}/square.cpp)
# Link with HIP
target_link_libraries(square hip::host)
if(TARGET build_intro)
add_dependencies(build_intro square)
endif()