1 cmake_minimum_required(VERSION 3.22.1) 2 project(opencl_backend) 3 4 set(CMAKE_CXX_STANDARD 14) 5 6 find_package(OpenCL) 7 if ("${MOCK_BACKEND}EMPTY" STREQUAL "EMPTY") 8 set (MOCK_BACKEND "${CMAKE_SOURCE_DIR}") 9 message("MOCK_BACKEND=${MOCK_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 17 message("MOCK") 18 19 include_directories( 20 ${MOCK_BACKEND}/include 21 ${SHARED_BACKEND}/include 22 ${MOCK_INCLUDE_DIR} 23 ) 24 link_directories( 25 ${CMAKE_BINARY_DIR} 26 ) 27 28 add_library(mock_backend SHARED 29 ${SHARED_BACKEND}/cpp/shared.cpp 30 ${MOCK_BACKEND}/cpp/mock_backend.cpp 31 ) 32 33 34 add_executable(mock_info 35 ${MOCK_BACKEND}/cpp/info.cpp 36 ) 37 38 target_link_libraries(mock_info 39 mock_backend 40 ) 41 add_custom_target(mock_natives DEPENDS mock_info mock_backend) 42 add_custom_target(copy_mock_libs DEPENDS mock_info mock_backend 43 COMMAND cp ${CMAKE_BINARY_DIR}/mock/libmock_backend.* ${HAT_TARGET} 44 COMMAND cp ${CMAKE_BINARY_DIR}/mock/mock_info ${HAT_TARGET} 45 ) 46 add_dependencies(copy_libs copy_mock_libs) 47 48 49 50