From 3c24f43ff9afb50898d6a73ccddbc0936f72fdad Mon Sep 17 00:00:00 2001 From: Sadik Armagan Date: Mon, 19 Oct 2020 17:35:30 +0100 Subject: IVGCVSW-5365 'Create the TfLite Delegate subdirectory in ArmNN' * Created delegate sub-directory under armnn * Created Delegate, ArmnnSubgraph and DelegateOptions classes * Created cmake files. * Integrated doctest (under MIT license) as testing framework Signed-off-by: Sadik Armagan Change-Id: If725ebd62c40a97c783cdad22bca48709d44338c --- .../cmake/Modules/ArmnnDelegateConfig.cmake.in | 19 ++++++++++++ delegate/cmake/Modules/FindFlatbuffers.cmake | 32 ++++++++++++++++++++ delegate/cmake/Modules/FindTensorflow.cmake | 30 +++++++++++++++++++ delegate/cmake/Modules/FindTfLite.cmake | 35 ++++++++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 delegate/cmake/Modules/ArmnnDelegateConfig.cmake.in create mode 100644 delegate/cmake/Modules/FindFlatbuffers.cmake create mode 100644 delegate/cmake/Modules/FindTensorflow.cmake create mode 100644 delegate/cmake/Modules/FindTfLite.cmake (limited to 'delegate/cmake') diff --git a/delegate/cmake/Modules/ArmnnDelegateConfig.cmake.in b/delegate/cmake/Modules/ArmnnDelegateConfig.cmake.in new file mode 100644 index 0000000000..12d1161afa --- /dev/null +++ b/delegate/cmake/Modules/ArmnnDelegateConfig.cmake.in @@ -0,0 +1,19 @@ +# +# Copyright © 2020 Arm Ltd and Contributors. All rights reserved. +# SPDX-License-Identifier: MIT +# + +get_filename_component(ARMNN_DELEGATE_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY) +set(ARMNN_DELEGATE_CONFIG_FILE ${CMAKE_CURRENT_LIST_FILE}) +MESSAGE(STATUS "Found ArmnnDelegate: ${ARMNN_DELEGATE_CONFIG_FILE}") + +include(CMakeFindDependencyMacro) + +list(APPEND CMAKE_MODULE_PATH ${ARMNN_DELEGATE_CMAKE_DIR}) + +if(NOT TARGET ArmnnDelegate::ArmnnDelegate) + MESSAGE(STATUS "ArmnnDelegate Import: ${ARMNN_DELEGATE_CMAKE_DIR}/ArmnnDelegateTargets.cmake") + include("${ARMNN_DELEGATE_CMAKE_DIR}/ArmnnDelegateTargets.cmake") +endif() + +set(ARMNN_DELEGATE_LIBRARIES ArmnnDelegate::ArmnnDelegate) \ No newline at end of file diff --git a/delegate/cmake/Modules/FindFlatbuffers.cmake b/delegate/cmake/Modules/FindFlatbuffers.cmake new file mode 100644 index 0000000000..13d6f917b3 --- /dev/null +++ b/delegate/cmake/Modules/FindFlatbuffers.cmake @@ -0,0 +1,32 @@ +# +# Copyright © 2020 Arm Ltd and Contributors. All rights reserved. +# SPDX-License-Identifier: MIT +# + +include(FindPackageHandleStandardArgs) +unset(FLATBUFFERS_FOUND) + +find_path(Flatbuffers_INCLUDE_DIR + flatbuffers/flatbuffers.h + HINTS + ${FLATBUFFERS_ROOT}/include + /usr/local/include + /usr/include) + +find_library(Flatbuffers_LIB + NAMES + libflatbuffers.a + flatbuffers + HINTS + ${FLATBUFFERS_ROOT}/lib + /usr/local/lib + /usr/lib) + +## Set FLATBUFFERS_FOUND +find_package_handle_standard_args(Flatbuffers DEFAULT_MSG Flatbuffers_INCLUDE_DIR Flatbuffers_LIB) + +## Set external variables for usage in CMakeLists.txt +if(FLATBUFFERS_FOUND) + set(Flatbuffers_LIB ${Flatbuffers_LIB}) + set(Flatbuffers_INCLUDE_DIR ${Flatbuffers_INCLUDE_DIR}) +endif() \ No newline at end of file diff --git a/delegate/cmake/Modules/FindTensorflow.cmake b/delegate/cmake/Modules/FindTensorflow.cmake new file mode 100644 index 0000000000..8b47d30362 --- /dev/null +++ b/delegate/cmake/Modules/FindTensorflow.cmake @@ -0,0 +1,30 @@ +# +# Copyright © 2020 Arm Ltd and Contributors. All rights reserved. +# SPDX-License-Identifier: MIT +# + +include(FindPackageHandleStandardArgs) +unset(TENSORFLOW_FOUND) + +find_path(Tensorflow_INCLUDE_DIR + NAMES + tensorflow/core + tensorflow/cc + third_party + HINTS + ${TENSORFLOW_ROOT}) + +find_library(Tensorflow_LIB + NAMES + tensorflow_all + HINTS + ${TENSORFLOW_ROOT}) + +## Set TENSORFLOW_FOUND +find_package_handle_standard_args(Tensorflow DEFAULT_MSG Tensorflow_INCLUDE_DIR Tensorflow_LIB) + +## Set external variables for usage in CMakeLists.txt +if(TENSORFLOW_FOUND) + set(Tensorflow_LIB ${Tensorflow_LIB}) + set(Tensorflow_INCLUDE_DIRS ${Tensorflow_INCLUDE_DIR}) +endif() \ No newline at end of file diff --git a/delegate/cmake/Modules/FindTfLite.cmake b/delegate/cmake/Modules/FindTfLite.cmake new file mode 100644 index 0000000000..d6c274cb65 --- /dev/null +++ b/delegate/cmake/Modules/FindTfLite.cmake @@ -0,0 +1,35 @@ +# +# Copyright © 2020 Arm Ltd and Contributors. All rights reserved. +# SPDX-License-Identifier: MIT +# + +include(FindPackageHandleStandardArgs) +unset(TFLITE_FOUND) + +find_path(TfLite_INCLUDE_DIR + NAMES + tensorflow/lite + third_party + HINTS + ${TFLITE_LIB_ROOT}) + +find_library(TfLite_LIB + NAMES + "libtensorflow_lite_all.so" + HINTS + ${TFLITE_LIB_ROOT}) + +find_path(TfLite_Schema_INCLUDE_PATH + schema_generated.h + HINTS + ${TFLITE_LIB_ROOT}/tensorflow/lite/schema) + +## Set TFLITE_FOUND +find_package_handle_standard_args(TfLite DEFAULT_MSG TfLite_INCLUDE_DIR TfLite_LIB TfLite_Schema_INCLUDE_PATH) + +## Set external variables for usage in CMakeLists.txt +if(TFLITE_FOUND) + set(TfLite_LIB ${TfLite_LIB}) + set(TfLite_INCLUDE_DIR ${TfLite_INCLUDE_DIR}) + set(TfLite_Schema_INCLUDE_PATH ${TfLite_Schema_INCLUDE_PATH}) +endif() \ No newline at end of file -- cgit v1.2.1