1 cmake_minimum_required(VERSION 3.22.1) 2 project(spirv_backend) 3 4 set(CMAKE_CXX_STANDARD 14) 5 6 find_package(OpenCL) 7 if ("${SPIRV_BACKEND}EMPTY" STREQUAL "EMPTY") 8 set (SPIRV_BACKEND "${CMAKE_SOURCE_DIR}") 9 message("SPIRV_BACKEND=${SPIRV_BACKEND}") 10 endif() 11 if ("${SHARED_BACKEND}EMPTY" STREQUAL "EMPTY") 12 set (SHARED_BACKEND "${CMAKE_SOURCE_DIR}/../shared") 13 message("SHARED_BACKEND=${SHARED_BACKEND}") 14 endif() 15 16 message("SPIRV") 17 18 include_directories( 19 ${SPIRV_BACKEND}/include 20 ${SHARED_BACKEND}/include 21 ${SPIRV_INCLUDE_DIR} 22 ) 23 link_directories( 24 ${CMAKE_BINARY_DIR} 25 ) 26 27 add_library(spirv_backend SHARED 28 ${SHARED_BACKEND}/cpp/shared.cpp 29 ${SPIRV_BACKEND}/cpp/spirv_backend.cpp 30 ) 31 32 33 add_executable(spirv_info 34 ${SPIRV_BACKEND}/cpp/info.cpp 35 ) 36 37 target_link_libraries(spirv_info 38 spirv_backend 39 ) 40 41 add_custom_target(spirv_natives DEPENDS spirv_info spirv_backend) 42 43 add_custom_target(copy_spirv_libs DEPENDS spirv_info spirv_backend 44 COMMAND cp ${CMAKE_BINARY_DIR}/spirv/libspirv_backend.* ${HAT_TARGET} 45 COMMAND cp ${CMAKE_BINARY_DIR}/spirv/spirv_info ${HAT_TARGET} 46 ) 47 add_dependencies(copy_libs copy_spirv_libs) 48 49