summaryrefslogtreecommitdiff
path: root/runtimes/neurun/backend/cpu/CMakeLists.txt
blob: 37fbfd8b136df5f7bbca584294495e1d0f902d21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Need internal header code to build cpu backend
nnfw_find_package(TensorFlowSource QUIET)
nnfw_find_package(TensorFlowLite QUIET)
if((NOT TensorFlowSource_FOUND) OR (NOT TensorFlowLite_FOUND))
  return()
endif()

add_subdirectory(kernel)

file(GLOB_RECURSE SOURCES "*.cc")
file(GLOB_RECURSE REMOVE_KERNEL_SOURCES "kernel/*.cc")
file(GLOB_RECURSE TESTS "*.test.cc")
list(REMOVE_ITEM SOURCES ${REMOVE_KERNEL_SOURCES})
list(REMOVE_ITEM SOURCES ${TESTS})

add_library(${LIB_NEURUN_BACKEND_CPU} SHARED ${SOURCES})

target_include_directories(${LIB_NEURUN_BACKEND_CPU} PUBLIC ${CMAKE_SOURCE_DIR}/externals/tensorflow)

target_link_libraries(${LIB_NEURUN_BACKEND_CPU} nnapi-header)
target_link_libraries(${LIB_NEURUN_BACKEND_CPU} tensorflow-lite)
target_link_libraries(${LIB_NEURUN_BACKEND_CPU} nnfw_lib_misc)
target_link_libraries(${LIB_NEURUN_BACKEND_CPU} nnfw_lib_cpp14)
target_link_libraries(${LIB_NEURUN_BACKEND_CPU} ${LIB_NEURUN_KERNEL_CPU})
target_link_libraries(${LIB_NEURUN_BACKEND_CPU} neurun-core)

target_compile_options(${LIB_NEURUN_BACKEND_CPU} PRIVATE -Wall -Wextra -Werror)

set_target_properties(${LIB_NEURUN_BACKEND_CPU} PROPERTIES OUTPUT_NAME backend_cpu)
install(TARGETS ${LIB_NEURUN_BACKEND_CPU} DESTINATION lib/neurun)

# Unit Tests
set(TEST_NEURUN_BACKEND_CPU test_neurun_backend_cpu)

add_executable(${TEST_NEURUN_BACKEND_CPU} ${TESTS})
target_link_libraries(${TEST_NEURUN_BACKEND_CPU} ${LIB_NEURUN_BACKEND_CPU})
target_link_libraries(${TEST_NEURUN_BACKEND_CPU} gtest gtest_main ${LIB_PTHREAD})
add_test(${TEST_NEURUN_BACKEND_CPU} ${TEST_NEURUN_BACKEND_CPU})

install(TARGETS ${TEST_NEURUN_BACKEND_CPU} DESTINATION unittest)