Skip to content

Commit

Permalink
[onert] Clean up gpu-cl backend cmake (#12614)
Browse files Browse the repository at this point in the history
This commit cleans up gpu-cl backend cmake.
- Remove dependencies
- Use target_compile_definitions instead of target_compile_options

ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh <[email protected]>
  • Loading branch information
hseok-oh authored Feb 8, 2024
1 parent 47769b5 commit a414ed8
Showing 1 changed file with 1 addition and 53 deletions.
54 changes: 1 addition & 53 deletions runtime/onert/backend/gpu_cl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,6 @@ if(NOT BUILD_GPU_CL)
return()
endif(NOT BUILD_GPU_CL)

nnas_find_package(Opencl_Headers QUIET)
if(NOT Opencl_Headers_FOUND)
return()
endif(NOT Opencl_Headers_FOUND)

nnas_find_package(Farmhash QUIET)
if(NOT Farmhash_FOUND)
return()
endif(NOT Farmhash_FOUND)

nnas_find_package(Abseil QUIET)
if(NOT Abseil_FOUND)
return()
endif(NOT Abseil_FOUND)

nnfw_find_package(Fp16 QUIET)
if(NOT Fp16_FOUND)
return()
endif(NOT Fp16_FOUND)

nnas_find_package(VulkanSource QUIET)
if(NOT VulkanSource_FOUND)
return()
endif(NOT VulkanSource_FOUND)

nnas_find_package(Opengl_HeadersSource QUIET)
if(NOT Opengl_HeadersSource_FOUND)
return()
endif(NOT Opengl_HeadersSource_FOUND)

nnas_find_package(Egl_HeadersSource QUIET)
if(NOT Egl_HeadersSource_FOUND)
return()
endif(NOT Egl_HeadersSource_FOUND)

if (NOT ${TARGET_OS} MATCHES "tizen")
nnas_find_package(FlatBuffers REQUIRED)
endif ()

nnfw_find_package(TensorFlowGpu QUIET)
if(NOT TensorFlowGpu_FOUND)
message(FATAL_ERROR 'TensorFlowGpu lib not found')
Expand All @@ -54,32 +15,19 @@ file(GLOB_RECURSE SOURCES "*.cc")
add_library(${LIB_ONERT_BACKEND_GPU_CL} SHARED ${SOURCES})

target_include_directories(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE ${TensorFlowSource_DIR})
target_include_directories(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE ${VulkanSource_DIR}/include)
target_include_directories(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE ${Opengl_HeadersSource_DIR}/api)
target_include_directories(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE ${Egl_HeadersSource_DIR}/api)

if (${TARGET_OS} MATCHES "tizen")
target_compile_options(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE "-Wno-error=deprecated-copy")
endif ()

target_compile_options(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE "-DCL_TARGET_OPENCL_VERSION=220" "-DEGL_NO_X11")
target_compile_definitions(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE CL_TARGET_OPENCL_VERSION=220 EGL_NO_X11)

target_link_libraries(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE abseil)
target_link_libraries(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE dl)
target_link_libraries(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE farmhash)
target_link_libraries(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE OpenCL_Headers)
target_link_libraries(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE fp16)
target_link_libraries(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE tflite-gpu-delegate)
target_link_libraries(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE onert_core)
target_link_libraries(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE ${LIB_ONERT_BACKEND_CL_COMMON})
target_link_libraries(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE nnfw_common)
target_link_libraries(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE nnfw_coverage)
if (${TARGET_OS} MATCHES "tizen")
target_link_libraries(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE flatbuffers)
else()
target_link_libraries(${LIB_ONERT_BACKEND_GPU_CL} PRIVATE flatbuffers::flatbuffers)
endif ()

set_target_properties(${LIB_ONERT_BACKEND_GPU_CL} PROPERTIES OUTPUT_NAME backend_gpu_cl)

Expand Down

0 comments on commit a414ed8

Please sign in to comment.