[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
@@ -20,10 +20,33 @@
cmake_minimum_required(VERSION 3.21.3)
if(UNIX)
if(NOT DEFINED ROCM_PATH)
set(ROCM_PATH "/opt/rocm" CACHE STRING "Default ROCM installation directory.")
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH})
endif()
endif()
if( NOT DEFINED CMAKE_HIP_COMPILER_ROCM)
set(CMAKE_HIP_COMPILER_ROCM_ROOT ${ROCM_PATH})
endif()
set(CMAKE_HIP_ARCHITECTURES OFF)
project(cmake_hip_lang_support VERSION 1.0
DESCRIPTION "HIP Language Support with upstream CMake"
LANGUAGES HIP)
# Create the executable
add_executable(square square.hip)
target_include_directories(square PRIVATE ../../common)
# Create the executable
if(TARGET build_cookbook)
set(EXCLUDE_OPTION EXCLUDE_FROM_ALL)
else()
set(EXCLUDE_OPTION )
endif()
add_executable(square2 ${EXCLUDE_OPTION} square.hip)
target_include_directories(square2 PRIVATE ../../common)
if(TARGET build_cookbook)
add_dependencies(build_cookbook square2)
endif()