1 cmake_minimum_required(VERSION 3.22.1)
 2 project(ptx_backend)
 3 
 4 set(CMAKE_CXX_STANDARD 14)
 5 
 6 find_package(CUDAToolkit)
 7 if(CUDAToolkit_FOUND)
 8     message("PTX")
 9     if ("${PTX_BACKEND}EMPTY" STREQUAL "EMPTY")
10 	    set (PTX_BACKEND "${CMAKE_SOURCE_DIR}")
11 	    message("PTX_BACKEND=${PTX_BACKEND}")
12     endif()
13     if ("${SHARED_BACKEND}EMPTY" STREQUAL "EMPTY")
14         set (SHARED_BACKEND "${CMAKE_SOURCE_DIR}/../shared")
15         message("SHARED_BACKEND=${SHARED_BACKEND}")
16     endif()
17 
18     include_directories(
19             ${CUDAToolkit_INCLUDE_DIR}
20 	    ${SHARED_BACKEND}/include
21 	    ${PTX_BACKEND}/include
22     )
23 
24     link_directories(
25             ${CMAKE_BINARY_DIR}
26             ${CUDAToolkit_LIBRARY_DIR}
27     )
28 
29     add_library(ptx_backend SHARED
30 	    ${SHARED_BACKEND}/cpp/shared.cpp
31 	    ${PTX_BACKEND}/cpp/ptx_backend.cpp
32     )
33 
34     target_link_libraries(ptx_backend
35             -lcudart
36             -lcuda
37     )
38 
39     add_executable(ptx_info
40 	    ${PTX_BACKEND}/cpp/info.cpp
41     )
42 
43     target_link_libraries(ptx_info
44             ptx_backend
45             -lcudart
46             -lcuda
47     )
48 
49 endif()
50 
51