blob: 05ec851bf2de90ccdd5a6ba2f20b6a13cb1af254 [file] [log] [blame]
Sadik Armagan3c24f432020-10-19 17:35:30 +01001#
2# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
3# SPDX-License-Identifier: MIT
4#
5
6cmake_minimum_required (VERSION 3.8.0)
7project(armnnDelegate)
8
9set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
10
11set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
12
13set(armnnDelegate_sources)
14list(APPEND armnnDelegate_sources
15 include/armnn_delegate.hpp
16 include/DelegateOptions.hpp
17 src/armnn_delegate.cpp
Sadik Armagan62483be2020-10-23 17:14:43 +010018 src/DelegateOptions.cpp
19 src/Activation.hpp
20 src/ArgMinMax.hpp
21 src/BatchSpace.hpp
22 src/Comparison.hpp
23 src/Convolution.hpp
24 src/Control.hpp
25 src/DelegateUtils.hpp
26 src/ElementwiseBinary.hpp
27 src/ElementwiseUnary.hpp
28 src/Fill.hpp
29 src/FullyConnected.hpp
30 src/Gather.hpp
31 src/Lstm.hpp
32 src/Normalization.hpp
33 src/Pad.hpp
34 src/Pooling.hpp
35 src/Quantization.hpp
36 src/Redefine.hpp
37 src/Resize.hpp
38 src/Round.hpp
39 src/Slice.hpp
40 src/Softmax.hpp
41 src/SpaceDepth.hpp
42 src/Transpose.hpp)
Sadik Armagan3c24f432020-10-19 17:35:30 +010043
44add_library(armnnDelegate SHARED ${armnnDelegate_sources})
45
46target_include_directories(armnnDelegate
47 PUBLIC
48 $<INSTALL_INTERFACE:include>
49 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
50 PRIVATE
51 ${CMAKE_CURRENT_SOURCE_DIR}/src)
52
53include(GNUInstallDirs)
54
55## Add Armnn as a Dependency
56find_package(Armnn REQUIRED)
57target_link_libraries(armnnDelegate Armnn::Armnn)
58
59## Add Tensorflow v2.3.1 dependency
60find_package(Tensorflow 2.3.1 REQUIRED MODULE)
61
62target_link_libraries(armnnDelegate
63 ${Tensorflow_LIB})
64
65target_include_directories(armnnDelegate
66 PRIVATE
67 ${Tensorflow_INCLUDE_DIR})
68
69## Add TfLite v2.3.1 dependency
70find_package(TfLite REQUIRED MODULE)
71
72target_link_libraries(armnnDelegate
73 ${TfLite_LIB})
74
75target_include_directories(armnnDelegate
76 PRIVATE
77 ${TfLite_INCLUDE_DIR})
78
Sadik Armagan3c24f432020-10-19 17:35:30 +010079## Add Flatbuffers dependency
80find_package(Flatbuffers REQUIRED MODULE)
81
82target_link_libraries(armnnDelegate
83 ${Flatbuffers_LIB})
84
85target_include_directories(armnnDelegate
86 PRIVATE
87 ${Flatbuffers_INCLUDE_DIR})
88
89set(armnnDelegate_unittest_sources)
90list(APPEND armnnDelegate_unittest_sources
Sadik Armagan62483be2020-10-23 17:14:43 +010091 src/test/ArmnnDelegateTest.cpp
Sadik Armagan8b9858d2020-11-09 08:26:22 +000092 src/test/ComparisonTest.cpp
93 src/test/ComparisonTestHelper.hpp
Sadik Armagan67e95f22020-10-29 16:14:54 +000094 src/test/ElementwiseBinaryTest.cpp
95 src/test/ElementwiseBinaryTestHelper.hpp
Sadik Armagan0534e032020-10-27 17:30:18 +000096 src/test/ElementwiseUnaryTest.cpp
Matthew Sloyan0d35a932020-11-09 12:25:05 +000097 src/test/ElementwiseUnaryTestHelper.hpp
Sadik Armagan6e36a642020-11-10 21:18:41 +000098 src/test/FullyConnectedTest.cpp
99 src/test/FullyConnectedTestHelper.hpp
Narumol Prangnawarat50c87d32020-11-09 18:42:11 +0000100 src/test/Pooling2dTest.cpp
101 src/test/Pooling2dTestHelper.hpp
Matthew Sloyan0d35a932020-11-09 12:25:05 +0000102 src/test/QuantizationTest.cpp
103 src/test/QuantizationTestHelper.hpp)
Sadik Armagan3c24f432020-10-19 17:35:30 +0100104
105add_executable(DelegateUnitTests ${armnnDelegate_unittest_sources})
Sadik Armagan3c24f432020-10-19 17:35:30 +0100106target_include_directories(DelegateUnitTests PRIVATE third-party)
107
108target_link_libraries(DelegateUnitTests armnnDelegate)
Sadik Armagan6e36a642020-11-10 21:18:41 +0000109target_link_libraries(DelegateUnitTests Armnn::armnnUtils)
Sadik Armagan3c24f432020-10-19 17:35:30 +0100110
111target_include_directories(DelegateUnitTests
112 PRIVATE
113 ${TfLite_INCLUDE_DIR})
114
115target_include_directories(DelegateUnitTests
Sadik Armagan62483be2020-10-23 17:14:43 +0100116 PRIVATE
117 ${Flatbuffers_INCLUDE_DIR})
Sadik Armagan3c24f432020-10-19 17:35:30 +0100118
119####################################################
120## Export targets
121set(armnn_delegate_export_targets)
122list(APPEND armnn_delegate_export_targets
123 armnnDelegate)
124
125install(
126 TARGETS ${armnn_delegate_export_targets}
127 EXPORT armnn-delegate-targets
128 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
129 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
130 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
131
132## Set export alias
133set_target_properties(armnnDelegate
134 PROPERTIES
135 EXPORT_NAME ArmnnDelegate)
136
137## Export target scrips
138install(
139 EXPORT armnn-delegate-targets
140 FILE ArmnnDelegateTargets.cmake
141 NAMESPACE ArmnnDelegate::
142 DESTINATION ${CMAKE_INSTALL_LIBDIR})
143
144## Create ArmnnDelegateConfig.cmake
145include(CMakePackageConfigHelpers)
146set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR})
147message(STATUS "CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}" )
148message(STATUS "CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}" )
149configure_package_config_file(
150 ${CMAKE_CURRENT_LIST_DIR}/cmake/Modules/ArmnnDelegateConfig.cmake.in
151 ${CMAKE_CURRENT_BINARY_DIR}/ArmnnDelegateConfig.cmake
152 INSTALL_DESTINATION ${INSTALL_CONFIGDIR})
153
154## Install ArmNN Delegate config file
155install(
156 FILES
157 ${CMAKE_CURRENT_BINARY_DIR}/ArmnnDelegateConfig.cmake
158 DESTINATION ${INSTALL_CONFIGDIR})
159
160## Export from build tree
161export(
162 EXPORT armnn-delegate-targets
163 FILE ${CMAKE_CURRENT_BINARY_DIR}/ArmnnDelegateTargets.cmake
164 NAMESPACE ArmnnDelegate::)
165
Narumol Prangnawarat50c87d32020-11-09 18:42:11 +0000166####################################################