# NOTE This line is a workaround to resolve compilation error
target_include_directories(${TEST_NEURUN} PRIVATE frontend/nnapi)
-target_include_directories(${TEST_NEURUN} PRIVATE backend/cpu)
target_include_directories(${TEST_NEURUN} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/core/src)
target_link_libraries(${TEST_NEURUN} ${LIB_NEURUN})
target_link_libraries(${TEST_NEURUN} gtest)
target_link_libraries(${TEST_NEURUN} gtest_main)
target_link_libraries(${TEST_NEURUN} ${LIB_PTHREAD})
-target_link_libraries(${TEST_NEURUN} ${LIB_NEURUN_BACKEND_CPU})
-target_link_libraries(${TEST_NEURUN} ${LIB_NEURUN_BACKEND_ACL_CL})
add_test(${TEST_NEURUN} ${TEST_NEURUN})
install(TARGETS ${TEST_NEURUN} DESTINATION unittest)
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})
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)
target_include_directories(neurun-core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(neurun-core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(neurun-core nnapi-header) # TODO Remove this dependency
-target_link_libraries(neurun-core nnfw_lib_misc)
-target_link_libraries(neurun-core nnfw_lib_cpp14)
+target_link_libraries(neurun-core nnfw_lib_misc nnfw_lib_cpp14 dl)
target_compile_options(neurun-core PRIVATE -Wall -Wextra -Werror)