Build cpu kernel as separate lib `libkernel_cpu.a`.
Part of #1960
Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
set(NEURUN_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
+# Build kernels
+set(LIB_NEURUN_KERNEL_CPU neurun_kernel_cpu)
+add_subdirectory(src/kernel)
+
# Build backends
set(LIB_NEURUN_BACKEND_CPU neurun_backend_cpu)
set(LIB_NEURUN_BACKEND_ACL_CL neurun_backend_acl_cl)
file(GLOB SOURCES "src/*.cc")
file(GLOB_RECURSE SOURCES_INTERNAL "src/internal/*.cc")
-file(GLOB_RECURSE SOURCES_KERNEL "src/kernel/*.cc") # TODO should be built as a separate lib
+file(GLOB_RECURSE SOURCES_KERNEL "src/kernel/acl_cl/*.cc") # TODO should be built as a separate lib
set(SOURCES ${SOURCES} ${SOURCES_INTERNAL} ${SOURCES_KERNEL})
target_link_libraries(${LIB_NEURUN_BACKEND_CPU} tensorflow-lite)
target_link_libraries(${LIB_NEURUN_BACKEND_CPU} nnfw_util)
target_link_libraries(${LIB_NEURUN_BACKEND_CPU} nnfw_support_nnapi)
+target_link_libraries(${LIB_NEURUN_BACKEND_CPU} ${LIB_NEURUN_KERNEL_CPU})
set_target_properties(${LIB_NEURUN_BACKEND_CPU} PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(${LIB_NEURUN_BACKEND_CPU} PROPERTIES OUTPUT_NAME backend_cpu)
--- /dev/null
+add_subdirectory(cpufallback)
--- /dev/null
+file(GLOB SOURCES "*.cc")
+
+add_library(${LIB_NEURUN_KERNEL_CPU} STATIC ${SOURCES})
+
+target_include_directories(${LIB_NEURUN_KERNEL_CPU} PUBLIC ${NNFW_INCLUDE_DIR})
+target_include_directories(${LIB_NEURUN_KERNEL_CPU} PUBLIC ${NEURUN_INCLUDE_DIR})
+target_include_directories(${LIB_NEURUN_KERNEL_CPU} PUBLIC ${CMAKE_SOURCE_DIR}/externals/tensorflow)
+
+target_link_libraries(${LIB_NEURUN_KERNEL_CPU} arm_compute) # TODO We should not need this
+target_link_libraries(${LIB_NEURUN_KERNEL_CPU} tensorflow-lite)
+
+set_target_properties(${LIB_NEURUN_KERNEL_CPU} PROPERTIES POSITION_INDEPENDENT_CODE ON)
+set_target_properties(${LIB_NEURUN_KERNEL_CPU} PROPERTIES OUTPUT_NAME kernel_cpu)
+install(TARGETS ${LIB_NEURUN_KERNEL_CPU} DESTINATION lib/neurun)