[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
rodzic 4a60fe5fd1
commit 7481de706f
33 zmienionych plików z 461 dodań i 89 usunięć
@@ -12,14 +12,25 @@ if(UNIX)
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH})
endif()
set(CMAKE_CXX_COMPILER "${ROCM_PATH}/llvm/bin/clang++")
find_package(hip REQUIRED)
add_executable(test_fortran TestFortran.F90)
add_executable(test_cpp MatrixTranspose.cpp)
if(TARGET build_cookbook)
set(EXCLUDE_OPTION EXCLUDE_FROM_ALL)
else()
set(EXCLUDE_OPTION )
endif()
add_executable(test_fortran ${EXCLUDE_OPTION} TestFortran.F90)
add_executable(test_cpp1 ${EXCLUDE_OPTION} MatrixTranspose.cpp)
target_link_libraries(test_cpp PUBLIC hip::device)
target_link_libraries(test_cpp1 PUBLIC hip::device)
target_include_directories(test_cpp PRIVATE ../../common)
target_include_directories(test_cpp1 PRIVATE ../../common)
# Assuming to build a C/C++-to-Fortran library binding.
target_link_libraries(test_fortran PUBLIC hip::device)
if(TARGET build_cookbook)
add_dependencies(build_cookbook test_cpp1 test_fortran)
endif()