1 cmake_minimum_required(VERSION 3.22.1) 2 project(cuda_backend) 3 4 set(CMAKE_CXX_STANDARD 14) 5 6 find_package(hip) 7 if(hip_FOUND) 8 message("HIP") 9 10 if ("${HIP_BACKEND}EMPTY" STREQUAL "EMPTY") 11 set (HIP_BACKEND "${CMAKE_SOURCE_DIR}") 12 message("HIP_BACKEND=${HIP_BACKEND}") 13 endif() 14 15 if ("${SHARED_BACKEND}EMPTY" STREQUAL "EMPTY") 16 set (SHARED_BACKEND "${CMAKE_SOURCE_DIR}/../shared") 17 message("SHARED_BACKEND=${SHARED_BACKEND}") 18 endif() 19 20 include_directories( 21 ${HIP_INCLUDE_DIR} 22 ${SHARED_BACKEND}/include 23 ${HIP_BACKEND}/include 24 ) 25 26 link_directories( 27 ${CMAKE_BINARY_DIR} 28 ${HIP_LIBRARY_DIR} 29 ) 30 31 add_library(hip_backend SHARED 32 ${SHARED_BACKEND}/cpp/shared.cpp 33 ${HIP_BACKEND}/cpp/hip_backend.cpp 34 ) 35 36 target_link_libraries(hip_backend 37 PRIVATE hip::host 38 ) 39 40 add_executable(hip_info 41 ${HIP_BACKEND}/cpp/info.cpp 42 ) 43 44 target_link_libraries(hip_info 45 hip_backend 46 hip::host 47 ) 48 endif()