[neurun] Extract NNAPI frontend from src (#4705)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 13 Mar 2019 06:16:31 +0000 (15:16 +0900)
committer오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 13 Mar 2019 06:16:31 +0000 (15:16 +0900)
This commit extracts NNAPI implementations (e.g. ANeuralNetworksModel_create)
from "src" and moves it to newly introduced frontend/nnapi directory.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
17 files changed:
runtimes/neurun/CMakeLists.txt
runtimes/neurun/frontend/nnapi/frontend/compilation.cc [moved from runtimes/neurun/src/frontend/compilation.cc with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/event.cc [moved from runtimes/neurun/src/frontend/event.cc with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/execution.cc [moved from runtimes/neurun/src/frontend/execution.cc with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/memory.cc [moved from runtimes/neurun/src/frontend/memory.cc with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/model.cc [moved from runtimes/neurun/src/frontend/model.cc with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/wrapper/OperationFactory.cc [moved from runtimes/neurun/src/frontend/wrapper/OperationFactory.cc with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/wrapper/OperationFactory.h [moved from runtimes/neurun/src/frontend/wrapper/OperationFactory.h with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/wrapper/compilation.cc [moved from runtimes/neurun/src/frontend/wrapper/compilation.cc with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/wrapper/compilation.h [moved from runtimes/neurun/src/frontend/wrapper/compilation.h with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/wrapper/event.h [moved from runtimes/neurun/src/frontend/wrapper/event.h with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/wrapper/execution.cc [moved from runtimes/neurun/src/frontend/wrapper/execution.cc with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/wrapper/execution.h [moved from runtimes/neurun/src/frontend/wrapper/execution.h with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/wrapper/memory.cc [moved from runtimes/neurun/src/frontend/wrapper/memory.cc with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/wrapper/memory.h [moved from runtimes/neurun/src/frontend/wrapper/memory.h with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/wrapper/model.cc [moved from runtimes/neurun/src/frontend/wrapper/model.cc with 100% similarity]
runtimes/neurun/frontend/nnapi/frontend/wrapper/model.h [moved from runtimes/neurun/src/frontend/wrapper/model.h with 100% similarity]

index 3ca5316..d8bacef 100644 (file)
@@ -15,7 +15,6 @@ endif(NOT "${TARGET_ARCH}" STREQUAL "x86_64")
 add_subdirectory(src/backend)
 
 file(GLOB SOURCES "src/*.cc")
-file(GLOB_RECURSE SOURCES_FRONTEND "src/frontend/*.cc")
 file(GLOB SOURCES_BACKEND "src/backend/*.cc")
 file(GLOB_RECURSE SOURCES_GRAPH "src/graph/*.cc")
 file(GLOB_RECURSE SOURCES_LINEAR "src/linear/*.cc")
@@ -26,15 +25,25 @@ file(GLOB_RECURSE SOURCES_VERIFIER "src/verifier/*.cc")
 file(GLOB_RECURSE SOURCES_UTIL "src/util/*.cc")
 file(GLOB_RECURSE SOURCES_MODEL "src/model/*.cc")
 
-set(SOURCES ${SOURCES} ${SOURCES_FRONTEND} ${SOURCES_BACKEND} ${SOURCES_GRAPH} ${SOURCES_LINEAR} ${SOURCES_DUMPER} ${SOURCES_COMPILER} ${SOURCES_EXEC} ${SOURCES_VERIFIER} ${SOURCES_UTIL} ${SOURCES_MODEL})
+set(SOURCES ${SOURCES} ${SOURCES_BACKEND} ${SOURCES_GRAPH} ${SOURCES_LINEAR} ${SOURCES_DUMPER} ${SOURCES_COMPILER} ${SOURCES_EXEC} ${SOURCES_VERIFIER} ${SOURCES_UTIL} ${SOURCES_MODEL})
 
-add_library(${LIB_NEURUN} SHARED ${SOURCES})
+add_library(neurun-core STATIC ${SOURCES})
+set_target_properties(neurun-core PROPERTIES POSITION_INDEPENDENT_CODE ON)
+target_include_directories(neurun-core PUBLIC ${NEURUN_INCLUDE_DIR})
+target_include_directories(neurun-core PUBLIC ${CMAKE_SOURCE_DIR}/externals/tensorflow)
+target_link_libraries(neurun-core nnapi-header)
+target_link_libraries(neurun-core tensorflow-lite)
+target_link_libraries(neurun-core nnfw_lib_misc)
+target_link_libraries(neurun-core nnfw_lib_cpp14)
+target_compile_options(neurun-core PRIVATE -Wall -Wextra -Werror)
+
+file(GLOB_RECURSE SOURCES_FRONTEND "frontend/nnapi/*.cc")
+
+add_library(${LIB_NEURUN} SHARED ${SOURCES_FRONTEND})
+target_include_directories(${LIB_NEURUN} PRIVATE frontend/nnapi)
 target_include_directories(${LIB_NEURUN} PUBLIC ${NEURUN_INCLUDE_DIR})
 target_include_directories(${LIB_NEURUN} PUBLIC ${CMAKE_SOURCE_DIR}/externals/tensorflow)
-target_link_libraries(${LIB_NEURUN} nnapi-header)
-target_link_libraries(${LIB_NEURUN} tensorflow-lite)
-target_link_libraries(${LIB_NEURUN} nnfw_lib_misc)
-target_link_libraries(${LIB_NEURUN} nnfw_lib_cpp14)
+target_link_libraries(${LIB_NEURUN} neurun-core)
 
 target_compile_options(${LIB_NEURUN} PRIVATE -Wall -Wextra -Werror)
 
@@ -50,6 +59,8 @@ set(TEST_NEURUN test_neurun)
 file(GLOB_RECURSE TESTS "test/*.cc")
 
 add_executable(${TEST_NEURUN} ${TESTS})
+# NOTE This line is a workaround to resolve compilation error
+target_include_directories(${TEST_NEURUN} PRIVATE frontend/nnapi)
 target_link_libraries(${TEST_NEURUN} ${LIB_NEURUN})
 target_link_libraries(${TEST_NEURUN} gtest)
 target_link_libraries(${TEST_NEURUN} gtest_main)