blob: 27dcd17dd497325f1c9fbd5a9af816c0084a75b1 [file] [log] [blame]
David Beck10b4dfd2018-09-19 12:03:20 +01001#
Jim Flynnbbfe6032020-07-20 16:57:44 +01002# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
Pavel Macenauer59e057f2020-04-15 14:17:26 +00003# Copyright 2020 NXP
David Beck10b4dfd2018-09-19 12:03:20 +01004# SPDX-License-Identifier: MIT
5#
Jim Flynn3091b062019-02-15 14:45:04 +00006cmake_minimum_required (VERSION 3.0.2) # 3.0.2 required for return() statement used in AddDllCopyCommands.cmake
telsoa014fcda012018-03-09 14:13:49 +00007project(armnn)
8
9set(additional_cmake_files)
10list(APPEND additional_cmake_files
Guillaume Gardet5ae78292019-10-15 08:47:26 +020011 cmake/ArmnnVersion.cmake
Matthew Sloyanac001ee2021-02-03 10:43:04 +000012 cmake/DelegateVersion.cmake
13 cmake/ParserVersion.cmake
telsoa014fcda012018-03-09 14:13:49 +000014 cmake/Utils.cmake
15 cmake/GlobalConfig.cmake
Teresa Charlin2b679db2022-02-16 12:57:19 +000016 cmake/AddDllCopyCommands.cmake
17 cmake/ArmnnTestUtilsVersion.cmake)
telsoa014fcda012018-03-09 14:13:49 +000018
19foreach(cmake_file ${additional_cmake_files})
20 include(${cmake_file})
21endforeach()
22
Sadik Armagan5d03e312020-11-17 16:43:56 +000023cmake_policy(SET CMP0057 NEW)
24
Jim Flynnfca233e2021-09-23 12:16:53 +010025# If the root of the tensorflow source tree has not been specified
26# and we are trying to build the tensorflow lite parser make
27# our best guess as to where it will be i.e. one directory above
28# the one this CMakeLists.txt file lives in, in a subdirectory
29# called tensorflow
30if (BUILD_TF_LITE_PARSER AND "${TENSORFLOW_ROOT}" STREQUAL "")
31 set(TENSORFLOW_ROOT "${PROJECT_SOURCE_DIR}/../tensorflow" CACHE INTERNAL "")
32 message(STATUS "Set TENSORFLOW_ROOT: ${TENSORFLOW_ROOT}")
33else()
34 message(STATUS "TENSORFLOW_ROOT: ${TENSORFLOW_ROOT}")
35endif()
36
37set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/delegate/cmake/Modules/")
38
Sadik Armagan5d03e312020-11-17 16:43:56 +000039set(as_subproject Armnn)
40
41macro(find_package)
42 if(NOT ${ARGV0} IN_LIST as_subproject)
43 _find_package(${ARGV})
44 endif()
45endmacro()
46
Matteo Martincighe7d44982019-08-05 12:16:47 +010047if (DYNAMIC_BACKEND_PATHS)
48 # It's expected to have the format: DYNAMIC_BACKEND_PATHS="PATH_1:PATH_2...:PATH_N"
49 add_definitions('-DDYNAMIC_BACKEND_PATHS="${DYNAMIC_BACKEND_PATHS}"')
50endif()
51
Matthew Benthama7b79282019-06-03 13:00:50 +010052include(GNUInstallDirs)
53
Ruomei Yandb7c3912019-03-08 17:50:25 +000054add_subdirectory(samples)
55add_subdirectory(src/armnnTfLiteParser)
56add_subdirectory(src/armnnSerializer)
wangg5f960d92020-08-26 01:44:32 +000057add_subdirectory(src/armnnDeserializer)
Sadik Armagana097d2a2021-11-24 15:47:28 +000058add_subdirectory(src/armnnTestUtils)
Ruomei Yandb7c3912019-03-08 17:50:25 +000059
Sadik Armagan5d03e312020-11-17 16:43:56 +000060
61if (BUILD_ARMNN_TFLITE_DELEGATE)
Finn Williamsbbbefec2020-11-25 14:32:42 +000062 set(ARMNN_SUB_PROJECT ON)
Sadik Armagan5d03e312020-11-17 16:43:56 +000063 add_subdirectory(delegate)
Sadik Armagan5d03e312020-11-17 16:43:56 +000064 add_definitions(-DARMNN_TF_LITE_DELEGATE)
65endif()
66
telsoa014fcda012018-03-09 14:13:49 +000067if (BUILD_TESTS)
68 add_subdirectory(tests)
69endif()
70
71# Include the additional cmake files in their own target so that they will appear nicely in IDEs
72add_custom_target(AdditionalCMakeFiles SOURCES ${additional_cmake_files})
73
74set(armnnUtils_sources)
75list(APPEND armnnUtils_sources
Sadik Armagan1342bed2021-11-17 15:01:00 +000076 include/armnnUtils/CompatibleTypes.hpp
Matteo Martincighe011d202019-11-28 11:35:47 +000077 include/armnnUtils/DataLayoutIndexed.hpp
78 include/armnnUtils/Permute.hpp
Rob Hughes9542f902021-07-14 09:48:54 +010079 include/armnnUtils/Filesystem.hpp
Matthew Sloyanfbba3642020-10-15 13:53:27 +010080 include/armnnUtils/FloatingPointComparison.hpp
Matteo Martincighe011d202019-11-28 11:35:47 +000081 include/armnnUtils/FloatingPointConverter.hpp
Colm Donelanc42a9872022-02-02 16:35:09 +000082 include/armnnUtils/QuantizeHelper.hpp
Francis Murtagh40d27412021-10-28 11:11:35 +010083 include/armnnUtils/TContainer.hpp
Matteo Martincighe011d202019-11-28 11:35:47 +000084 include/armnnUtils/TensorUtils.hpp
Mike Kellyc9ea45a2020-02-28 18:11:58 +000085 include/armnnUtils/Transpose.hpp
Narumol Prangnawaratc3bf6ef2020-02-28 12:45:21 +000086 src/armnnUtils/BFloat16.hpp
Sadik Armagan1342bed2021-11-17 15:01:00 +000087 src/armnnUtils/CompatibleTypes.cpp
Rob Hughesbdee4262020-01-07 17:05:24 +000088 src/armnnUtils/Filesystem.cpp
telsoa014fcda012018-03-09 14:13:49 +000089 src/armnnUtils/GraphTopologicalSort.hpp
arovir01616e7752018-10-01 17:08:59 +010090 src/armnnUtils/Half.hpp
telsoa014fcda012018-03-09 14:13:49 +000091 src/armnnUtils/Permute.cpp
Matteo Martincigh21350152018-11-28 16:22:22 +000092 src/armnnUtils/DataLayoutIndexed.cpp
surmeh01bceff2f2018-03-29 16:29:27 +010093 src/armnnUtils/DotSerializer.cpp
94 src/armnnUtils/DotSerializer.hpp
surmeh013537c2c2018-05-18 16:31:43 +010095 src/armnnUtils/HeapProfiling.cpp
96 src/armnnUtils/HeapProfiling.hpp
97 src/armnnUtils/LeakChecking.cpp
98 src/armnnUtils/LeakChecking.hpp
Éanna Ó Catháina4247d52019-05-08 14:00:45 +010099 src/armnnUtils/ModelAccuracyChecker.cpp
100 src/armnnUtils/ModelAccuracyChecker.hpp
telsoa01c577f2c2018-08-31 09:22:23 +0100101 src/armnnUtils/FloatingPointConverter.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100102 src/armnnUtils/VerificationHelpers.hpp
103 src/armnnUtils/VerificationHelpers.cpp
Sadik Armagan479045b2018-10-01 11:51:37 +0100104 src/armnnUtils/ParserHelper.hpp
105 src/armnnUtils/ParserHelper.cpp
Matthew Bentham4057d912019-01-21 15:45:51 +0000106 src/armnnUtils/ParserPrototxtFixture.hpp
Jim Flynn4c9ed1d2022-01-23 23:57:20 +0000107 src/armnnUtils/ProfilingOptionsConverter.hpp
108 src/armnnUtils/ProfilingOptionsConverter.cpp
Matthew Bentham4057d912019-01-21 15:45:51 +0000109 src/armnnUtils/PrototxtConversions.hpp
110 src/armnnUtils/PrototxtConversions.cpp
Jim Flynn2fd61002019-05-03 12:54:26 +0100111 src/armnnUtils/TensorIOUtils.hpp
Nina Drozdd41b2592018-11-19 13:03:36 +0000112 src/armnnUtils/TensorUtils.cpp
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000113 src/armnnUtils/Transpose.cpp
telsoa014fcda012018-03-09 14:13:49 +0000114 )
telsoa014fcda012018-03-09 14:13:49 +0000115
116add_library_ex(armnnUtils STATIC ${armnnUtils_sources})
Jim Flynnf92dfce2019-05-02 11:33:25 +0100117target_include_directories(armnnUtils PRIVATE src/backends)
telsoa014fcda012018-03-09 14:13:49 +0000118
telsoa01c577f2c2018-08-31 09:22:23 +0100119if(BUILD_ONNX_PARSER)
120 set(armnn_onnx_parser_sources)
121 list(APPEND armnn_onnx_parser_sources
122 include/armnnOnnxParser/IOnnxParser.hpp
Matthew Sloyanac001ee2021-02-03 10:43:04 +0000123 include/armnnOnnxParser/Version.hpp
telsoa01c577f2c2018-08-31 09:22:23 +0100124 src/armnnOnnxParser/OnnxParser.hpp
125 src/armnnOnnxParser/OnnxParser.cpp
126 ${ONNX_GENERATED_SOURCES}/onnx/onnx.pb.cc
127 )
128 # The generated onnx protobuf .cc files are not warning clean and we can't fix them.
129 if(COMPILER_IS_GNU_LIKE)
130 set_source_files_properties(${ONNX_GENERATED_SOURCES}/onnx/onnx.pb.cc PROPERTIES COMPILE_FLAGS "-Wno-conversion -Wno-sign-conversion")
131 endif()
132
133 add_library_ex(armnnOnnxParser SHARED ${armnn_onnx_parser_sources})
134
135 target_include_directories(armnnOnnxParser PRIVATE src/armnnUtils)
136
137 target_link_libraries(armnnOnnxParser armnn)
138
139 # Protobuf
140 target_link_libraries(armnnOnnxParser ${PROTOBUF_LIBRARIES})
Matthew Sloyanac001ee2021-02-03 10:43:04 +0000141 set_target_properties(armnnOnnxParser PROPERTIES VERSION ${ONNX_PARSER_LIB_VERSION} SOVERSION ${ONNX_PARSER_LIB_SOVERSION})
telsoa014fcda012018-03-09 14:13:49 +0000142endif()
143
telsoa014fcda012018-03-09 14:13:49 +0000144list(APPEND armnn_sources
145 include/armnn/ArmNN.hpp
Matteo Martincigh6db5f202019-09-05 12:02:04 +0100146 include/armnn/BackendHelper.hpp
David Beck9df2d952018-10-10 15:11:44 +0100147 include/armnn/BackendId.hpp
Derek Lamberti836b27b2019-11-20 10:51:57 +0000148 include/armnn/BackendOptions.hpp
Matteo Martincighc601aa62019-10-29 15:03:22 +0000149 include/armnn/BackendRegistry.hpp
Matteo Martincigh6db5f202019-09-05 12:02:04 +0100150 include/armnn/Conversion.hpp
151 include/armnn/Deprecated.hpp
telsoa014fcda012018-03-09 14:13:49 +0000152 include/armnn/Descriptors.hpp
153 include/armnn/DescriptorsFwd.hpp
David Beck9df2d952018-10-10 15:11:44 +0100154 include/armnn/Exceptions.hpp
Francis Murtaghcae45682021-04-26 10:07:49 +0100155 include/armnn/backends/ILayerSupport.hpp
David Monahan801e2d52021-07-19 17:06:30 +0100156 include/armnn/backends/ICustomAllocator.hpp
Keith Davise813d672021-04-22 10:10:34 +0100157 include/armnn/IAsyncExecutionCallback.hpp
jimfly015f4e41f2019-01-23 16:10:17 +0000158 include/armnn/ILayerVisitor.hpp
telsoa014fcda012018-03-09 14:13:49 +0000159 include/armnn/INetwork.hpp
David Beck9df2d952018-10-10 15:11:44 +0100160 include/armnn/IProfiler.hpp
161 include/armnn/IRuntime.hpp
Finn Williamsb454c5c2021-02-09 15:56:23 +0000162 include/armnn/IStrategy.hpp
Mike Kelly386ff1a2021-03-29 15:04:50 +0100163 include/armnn/IWorkingMemHandle.hpp
Mike Kelly8c1701a2019-02-11 17:01:27 +0000164 include/armnn/LayerVisitorBase.hpp
Derek Lamberti08446972019-11-26 16:38:31 +0000165 include/armnn/Logging.hpp
David Beck9df2d952018-10-10 15:11:44 +0100166 include/armnn/LstmParams.hpp
Derek Lambertif674aa02019-08-01 15:56:25 +0100167 include/armnn/MemorySources.hpp
David Beck9df2d952018-10-10 15:11:44 +0100168 include/armnn/NetworkFwd.hpp
David Beck5eec11d2018-10-04 15:43:17 +0100169 include/armnn/Optional.hpp
James Conroyee18dc82019-07-17 11:27:46 +0100170 include/armnn/QuantizedLstmParams.hpp
Jan Eilers1b2654f2021-09-24 15:45:46 +0100171 include/armnn/StrategyBase.hpp
telsoa014fcda012018-03-09 14:13:49 +0000172 include/armnn/Tensor.hpp
173 include/armnn/TensorFwd.hpp
Finn Williamsf364d532021-06-09 17:07:33 +0100174 include/armnn/Threadpool.hpp
telsoa014fcda012018-03-09 14:13:49 +0000175 include/armnn/Types.hpp
176 include/armnn/TypesUtils.hpp
177 include/armnn/Utils.hpp
telsoa014fcda012018-03-09 14:13:49 +0000178 include/armnn/Version.hpp
Derek Lambertidcfc6362020-02-19 13:25:42 +0000179 include/armnn/utility/Assert.hpp
Derek Lamberti9f8cad22020-02-19 13:17:02 +0000180 include/armnn/utility/IgnoreUnused.hpp
Derek Lamberti53d092d2020-02-19 13:40:56 +0000181 include/armnn/utility/NumericCast.hpp
Derek Lamberti4d4e0e22020-02-19 13:30:47 +0000182 include/armnn/utility/PolymorphicDowncast.hpp
David Monahana8837bf2020-04-16 10:01:56 +0100183 include/armnn/utility/StringUtils.hpp
Finn Williams3e54d032020-10-22 16:53:35 +0100184 include/armnn/utility/TransformIterator.hpp
Francis Murtagha49ff082022-01-17 17:08:01 +0000185 include/armnn/backends/SubgraphView.hpp
surmeh013537c2c2018-05-18 16:31:43 +0100186 src/armnn/layers/LayerCloneBase.hpp
187 src/armnn/layers/LayerWithParameters.hpp
188 src/armnn/layers/ActivationLayer.hpp
189 src/armnn/layers/ActivationLayer.cpp
190 src/armnn/layers/AdditionLayer.hpp
191 src/armnn/layers/AdditionLayer.cpp
Nikhil Rajee391d52019-09-05 17:50:44 +0100192 src/armnn/layers/ArgMinMaxLayer.hpp
193 src/armnn/layers/ArgMinMaxLayer.cpp
surmeh013537c2c2018-05-18 16:31:43 +0100194 src/armnn/layers/BatchNormalizationLayer.hpp
195 src/armnn/layers/BatchNormalizationLayer.cpp
Éanna Ó Catháin4e1e1362018-11-12 11:36:34 +0000196 src/armnn/layers/BatchToSpaceNdLayer.hpp
197 src/armnn/layers/BatchToSpaceNdLayer.cpp
mathad01b392e982021-04-07 12:07:30 +0100198 src/armnn/layers/CastLayer.hpp
199 src/armnn/layers/CastLayer.cpp
Simon Obute51f67772021-09-03 15:50:13 +0100200 src/armnn/layers/ChannelShuffleLayer.hpp
201 src/armnn/layers/ChannelShuffleLayer.cpp
Aron Virginas-Tar77bfb5e2019-10-16 17:45:38 +0100202 src/armnn/layers/ComparisonLayer.hpp
203 src/armnn/layers/ComparisonLayer.cpp
Jim Flynne242f2d2019-05-22 14:24:13 +0100204 src/armnn/layers/ConcatLayer.hpp
205 src/armnn/layers/ConcatLayer.cpp
surmeh013537c2c2018-05-18 16:31:43 +0100206 src/armnn/layers/ConstantLayer.hpp
207 src/armnn/layers/ConstantLayer.cpp
208 src/armnn/layers/Convolution2dLayer.hpp
209 src/armnn/layers/Convolution2dLayer.cpp
Matthew Sloyanb63a3112021-09-08 13:05:51 +0100210 src/armnn/layers/Convolution3dLayer.hpp
211 src/armnn/layers/Convolution3dLayer.cpp
Narumol Prangnawarat7ddbbae2020-03-13 10:26:05 +0000212 src/armnn/layers/ConvertBf16ToFp32Layer.cpp
213 src/armnn/layers/ConvertBf16ToFp32Layer.hpp
telsoa01c577f2c2018-08-31 09:22:23 +0100214 src/armnn/layers/ConvertFp16ToFp32Layer.hpp
215 src/armnn/layers/ConvertFp16ToFp32Layer.cpp
Narumol Prangnawaratea54a012020-03-16 16:36:10 +0000216 src/armnn/layers/ConvertFp32ToBf16Layer.hpp
217 src/armnn/layers/ConvertFp32ToBf16Layer.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100218 src/armnn/layers/ConvertFp32ToFp16Layer.hpp
219 src/armnn/layers/ConvertFp32ToFp16Layer.cpp
Nattapat Chaimanowonga9a1cf12018-12-03 16:06:49 +0000220 src/armnn/layers/DebugLayer.hpp
221 src/armnn/layers/DebugLayer.cpp
Aron Virginas-Tardd6247f2019-09-19 14:31:17 +0100222 src/armnn/layers/DepthToSpaceLayer.hpp
223 src/armnn/layers/DepthToSpaceLayer.cpp
surmeh013537c2c2018-05-18 16:31:43 +0100224 src/armnn/layers/DepthwiseConvolution2dLayer.hpp
225 src/armnn/layers/DepthwiseConvolution2dLayer.cpp
Nattapat Chaimanowonge4294fd2019-03-28 09:56:53 +0000226 src/armnn/layers/DequantizeLayer.hpp
227 src/armnn/layers/DequantizeLayer.cpp
Narumol Prangnawarat94dd5d82019-01-23 18:06:26 +0000228 src/armnn/layers/DetectionPostProcessLayer.hpp
229 src/armnn/layers/DetectionPostProcessLayer.cpp
Matteo Martincigh59a950c2018-12-13 12:48:25 +0000230 src/armnn/layers/ElementwiseBaseLayer.hpp
231 src/armnn/layers/ElementwiseBaseLayer.cpp
josh minor4a3c6102020-01-06 16:40:46 -0600232 src/armnn/layers/ElementwiseUnaryLayer.hpp
233 src/armnn/layers/ElementwiseUnaryLayer.cpp
surmeh013537c2c2018-05-18 16:31:43 +0100234 src/armnn/layers/FakeQuantizationLayer.hpp
235 src/armnn/layers/FakeQuantizationLayer.cpp
Ryan OSheaec6c6802020-06-05 17:17:06 +0100236 src/armnn/layers/FillLayer.hpp
237 src/armnn/layers/FillLayer.cpp
surmeh013537c2c2018-05-18 16:31:43 +0100238 src/armnn/layers/FloorLayer.hpp
239 src/armnn/layers/FloorLayer.cpp
240 src/armnn/layers/FullyConnectedLayer.hpp
241 src/armnn/layers/FullyConnectedLayer.cpp
narpra01b89b05f2019-01-16 09:53:09 +0000242 src/armnn/layers/GatherLayer.cpp
243 src/armnn/layers/GatherLayer.hpp
surmeh013537c2c2018-05-18 16:31:43 +0100244 src/armnn/layers/InputLayer.hpp
245 src/armnn/layers/InputLayer.cpp
Kevin Mayce5045a2019-10-02 14:07:47 +0100246 src/armnn/layers/InstanceNormalizationLayer.hpp
247 src/armnn/layers/InstanceNormalizationLayer.cpp
surmeh013537c2c2018-05-18 16:31:43 +0100248 src/armnn/layers/L2NormalizationLayer.hpp
249 src/armnn/layers/L2NormalizationLayer.cpp
James Conroyaba90cd2020-11-06 16:28:18 +0000250 src/armnn/layers/LogicalBinaryLayer.hpp
251 src/armnn/layers/LogicalBinaryLayer.cpp
Aron Virginas-Tarf982dea2019-10-11 14:07:53 +0100252 src/armnn/layers/LogSoftmaxLayer.hpp
253 src/armnn/layers/LogSoftmaxLayer.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100254 src/armnn/layers/LstmLayer.cpp
255 src/armnn/layers/LstmLayer.hpp
Jim Flynn68db06f2020-10-06 10:14:50 +0100256 src/armnn/layers/MapLayer.cpp
257 src/armnn/layers/MapLayer.hpp
Nattapat Chaimanowong5a4304a2018-11-28 10:44:37 +0000258 src/armnn/layers/MaximumLayer.cpp
259 src/armnn/layers/MaximumLayer.hpp
narpra0132b90462018-09-13 11:07:48 +0100260 src/armnn/layers/MeanLayer.hpp
261 src/armnn/layers/MeanLayer.cpp
surmeh013537c2c2018-05-18 16:31:43 +0100262 src/armnn/layers/MemCopyLayer.hpp
263 src/armnn/layers/MemCopyLayer.cpp
Derek Lambertif674aa02019-08-01 15:56:25 +0100264 src/armnn/layers/MemImportLayer.hpp
265 src/armnn/layers/MemImportLayer.cpp
Nattapat Chaimanowong1f886302019-04-05 13:37:19 +0100266 src/armnn/layers/MergeLayer.hpp
267 src/armnn/layers/MergeLayer.cpp
kevmay0190539692018-11-29 08:40:19 +0000268 src/armnn/layers/MinimumLayer.cpp
269 src/armnn/layers/MinimumLayer.hpp
surmeh013537c2c2018-05-18 16:31:43 +0100270 src/armnn/layers/MultiplicationLayer.hpp
271 src/armnn/layers/MultiplicationLayer.cpp
272 src/armnn/layers/NormalizationLayer.hpp
273 src/armnn/layers/NormalizationLayer.cpp
274 src/armnn/layers/OutputLayer.hpp
275 src/armnn/layers/OutputLayer.cpp
Mohamed Nour Abouelseoud5662c202018-09-24 13:30:09 +0100276 src/armnn/layers/PadLayer.hpp
277 src/armnn/layers/PadLayer.cpp
surmeh013537c2c2018-05-18 16:31:43 +0100278 src/armnn/layers/PermuteLayer.hpp
279 src/armnn/layers/PermuteLayer.cpp
280 src/armnn/layers/Pooling2dLayer.hpp
281 src/armnn/layers/Pooling2dLayer.cpp
Tamás Nyíri7b885b32021-10-26 14:47:57 +0100282 src/armnn/layers/Pooling3dLayer.hpp
283 src/armnn/layers/Pooling3dLayer.cpp
Derek Lambertia9cca6a2019-03-25 15:41:58 +0000284 src/armnn/layers/QuantizeLayer.cpp
285 src/armnn/layers/QuantizeLayer.hpp
James Conroy586a9aa2020-03-20 08:49:33 +0000286 src/armnn/layers/QLstmLayer.hpp
287 src/armnn/layers/QLstmLayer.cpp
James Conroyee18dc82019-07-17 11:27:46 +0100288 src/armnn/layers/QuantizedLstmLayer.hpp
289 src/armnn/layers/QuantizedLstmLayer.cpp
Francis Murtaghe7a86a42018-08-29 12:42:10 +0100290 src/armnn/layers/DivisionLayer.cpp
291 src/armnn/layers/DivisionLayer.hpp
Matteo Martincigh49124022019-01-11 13:25:59 +0000292 src/armnn/layers/PreCompiledLayer.hpp
293 src/armnn/layers/PreCompiledLayer.cpp
Matteo Martincigh0e406ee2019-06-12 15:42:18 +0100294 src/armnn/layers/PreluLayer.hpp
295 src/armnn/layers/PreluLayer.cpp
Finn Williams2605b232020-06-10 15:53:46 +0100296 src/armnn/layers/RankLayer.hpp
297 src/armnn/layers/RankLayer.cpp
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000298 src/armnn/layers/ReduceLayer.hpp
299 src/armnn/layers/ReduceLayer.cpp
surmeh013537c2c2018-05-18 16:31:43 +0100300 src/armnn/layers/ReshapeLayer.hpp
301 src/armnn/layers/ReshapeLayer.cpp
Teresa Charlina9075df2019-06-27 15:41:57 +0100302 src/armnn/layers/ResizeLayer.hpp
303 src/armnn/layers/ResizeLayer.cpp
Keith Davis3ae3f972021-05-21 16:33:48 +0100304 src/armnn/layers/ShapeLayer.cpp
305 src/armnn/layers/ShapeLayer.hpp
Aron Virginas-Tar636ab402019-09-16 14:27:45 +0100306 src/armnn/layers/SliceLayer.cpp
307 src/armnn/layers/SliceLayer.hpp
surmeh013537c2c2018-05-18 16:31:43 +0100308 src/armnn/layers/SoftmaxLayer.hpp
309 src/armnn/layers/SoftmaxLayer.cpp
Matteo Martincigh0e406ee2019-06-12 15:42:18 +0100310 src/armnn/layers/SpaceToBatchNdLayer.hpp
311 src/armnn/layers/SpaceToBatchNdLayer.cpp
312 src/armnn/layers/SpaceToDepthLayer.hpp
313 src/armnn/layers/SpaceToDepthLayer.cpp
surmeh013537c2c2018-05-18 16:31:43 +0100314 src/armnn/layers/SplitterLayer.hpp
315 src/armnn/layers/SplitterLayer.cpp
Matthew Jackson2b8c1da2019-07-04 14:59:16 +0100316 src/armnn/layers/StackLayer.hpp
317 src/armnn/layers/StackLayer.cpp
Derek Lamberti013c3902019-10-21 10:46:16 +0100318 src/armnn/layers/StandInLayer.cpp
319 src/armnn/layers/StandInLayer.hpp
Conor Kennedy430b5d82018-11-14 15:28:28 +0000320 src/armnn/layers/StridedSliceLayer.cpp
321 src/armnn/layers/StridedSliceLayer.hpp
David Beckc2044fe2018-09-05 15:00:38 +0100322 src/armnn/layers/SubtractionLayer.cpp
323 src/armnn/layers/SubtractionLayer.hpp
Sadik Armaganeff363d2019-04-05 15:25:46 +0100324 src/armnn/layers/SwitchLayer.cpp
325 src/armnn/layers/SwitchLayer.hpp
Aron Virginas-Tar639fb042019-06-20 14:28:19 +0100326 src/armnn/layers/TransposeConvolution2dLayer.cpp
327 src/armnn/layers/TransposeConvolution2dLayer.hpp
Mike Kellyc9ea45a2020-02-28 18:11:58 +0000328 src/armnn/layers/TransposeLayer.hpp
329 src/armnn/layers/TransposeLayer.cpp
Narumol Prangnawarat8ed39ae2021-07-15 16:16:25 +0100330 src/armnn/layers/UnidirectionalSequenceLstmLayer.cpp
331 src/armnn/layers/UnidirectionalSequenceLstmLayer.hpp
Jim Flynn3a40ea52020-10-08 11:42:30 +0100332 src/armnn/layers/UnmapLayer.cpp
333 src/armnn/layers/UnmapLayer.hpp
Jim Flynn34430252022-03-04 15:03:58 +0000334 src/armnn/ArmNNProfilingServiceInitialiser.cpp
335 src/armnn/ArmNNProfilingServiceInitialiser.hpp
Keith Davise813d672021-04-22 10:10:34 +0100336 src/armnn/AsyncExecutionCallback.cpp
337 src/armnn/AsyncExecutionCallback.hpp
Matteo Martincighc601aa62019-10-29 15:03:22 +0000338 src/armnn/BackendRegistry.cpp
Matteo Martincigh49124022019-01-11 13:25:59 +0000339 src/armnn/BackendSettings.hpp
Ferran Balaguerf54c9462019-07-10 12:43:58 +0100340 src/armnn/BackendHelper.cpp
telsoa014fcda012018-03-09 14:13:49 +0000341 src/armnn/Descriptors.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100342 src/armnn/DeviceSpec.hpp
Rob Hughesa91479c2020-01-07 09:40:12 +0000343 src/armnn/DllExport.hpp
telsoa014fcda012018-03-09 14:13:49 +0000344 src/armnn/Exceptions.cpp
Teresa Charlin4de9f672019-04-10 13:59:49 +0100345 src/armnn/ExecutionFrame.cpp
346 src/armnn/ExecutionFrame.hpp
telsoa014fcda012018-03-09 14:13:49 +0000347 src/armnn/Graph.cpp
David Beckf98d21a2018-10-26 16:03:03 +0100348 src/armnn/Graph.hpp
349 src/armnn/IGraphObservable.hpp
Cathal Corbett34b429c2021-12-24 12:24:40 +0000350 src/armnn/ILayerSupport.cpp
David Beckf98d21a2018-10-26 16:03:03 +0100351 src/armnn/Instrument.hpp
352 src/armnn/InternalTypes.cpp
353 src/armnn/InternalTypes.hpp
Derek Lambertiff05cc52019-04-26 13:05:17 +0100354 src/armnn/ISubgraphViewConverter.hpp
David Beckf98d21a2018-10-26 16:03:03 +0100355 src/armnn/JsonPrinter.cpp
356 src/armnn/JsonPrinter.hpp
357 src/armnn/Layer.cpp
358 src/armnn/LayerFwd.hpp
359 src/armnn/Layer.hpp
360 src/armnn/LayersFwd.hpp
361 src/armnn/LayerSupportCommon.hpp
David Beckf98d21a2018-10-26 16:03:03 +0100362 src/armnn/LoadedNetwork.cpp
363 src/armnn/LoadedNetwork.hpp
Matthew Benthamd3a07832020-01-15 17:21:38 +0000364 src/armnn/Logging.cpp
telsoa014fcda012018-03-09 14:13:49 +0000365 src/armnn/Network.cpp
David Beckf98d21a2018-10-26 16:03:03 +0100366 src/armnn/Network.hpp
Aron Virginas-Tar5fdfe822018-11-21 13:14:42 +0000367 src/armnn/NetworkUtils.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100368 src/armnn/NetworkUtils.hpp
David Beckf98d21a2018-10-26 16:03:03 +0100369 src/armnn/Observable.cpp
370 src/armnn/Observable.hpp
371 src/armnn/Optimizer.cpp
372 src/armnn/Optimizer.hpp
Matteo Martincighe5b8eb92019-11-28 15:45:42 +0000373 src/armnn/OutputHandler.cpp
374 src/armnn/OutputHandler.hpp
David Beckf98d21a2018-10-26 16:03:03 +0100375 src/armnn/Profiling.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100376 src/armnn/ProfilingEvent.cpp
Keith Davis554fa092021-07-20 11:25:22 +0100377 src/armnn/ProfilingDetails.hpp
telsoa01c577f2c2018-08-31 09:22:23 +0100378 src/armnn/ProfilingEvent.hpp
David Beckf98d21a2018-10-26 16:03:03 +0100379 src/armnn/Profiling.hpp
380 src/armnn/Runtime.cpp
381 src/armnn/Runtime.hpp
Derek Lamberti8a4ca102019-02-08 17:54:20 +0000382 src/armnn/RangeTracker.cpp
383 src/armnn/RangeTracker.hpp
Aron Virginas-Tard4f0fea2019-04-09 14:08:06 +0100384 src/armnn/ResolveType.hpp
David Beckf98d21a2018-10-26 16:03:03 +0100385 src/armnn/SerializeLayerParameters.cpp
386 src/armnn/SerializeLayerParameters.hpp
Derek Lambertiff05cc52019-04-26 13:05:17 +0100387 src/armnn/SubgraphView.cpp
Derek Lambertiff05cc52019-04-26 13:05:17 +0100388 src/armnn/SubgraphViewSelector.cpp
389 src/armnn/SubgraphViewSelector.hpp
telsoa014fcda012018-03-09 14:13:49 +0000390 src/armnn/Tensor.cpp
Finn Williamsf364d532021-06-09 17:07:33 +0100391 src/armnn/Threadpool.cpp
Aron Virginas-Tard4f0fea2019-04-09 14:08:06 +0100392 src/armnn/TypesUtils.cpp
telsoa014fcda012018-03-09 14:13:49 +0000393 src/armnn/Utils.cpp
David Beckf98d21a2018-10-26 16:03:03 +0100394 src/armnn/WallClockTimer.cpp
395 src/armnn/WallClockTimer.hpp
Mike Kelly386ff1a2021-03-29 15:04:50 +0100396 src/armnn/WorkingMemDescriptor.hpp
397 src/armnn/WorkingMemHandle.cpp
398 src/armnn/WorkingMemHandle.hpp
Narumol Prangnawarat16f82f92020-09-14 16:12:44 +0100399 src/armnn/optimizations/AddBroadcastReshapeLayer.hpp
Nina Drozd861985f2019-04-18 14:48:51 +0100400 src/armnn/optimizations/AddDebug.hpp
telsoa014fcda012018-03-09 14:13:49 +0000401 src/armnn/optimizations/All.hpp
telsoa01c577f2c2018-08-31 09:22:23 +0100402 src/armnn/optimizations/ConvertConstants.hpp
Narumol Prangnawaratbc7ffb52020-03-20 15:01:01 +0000403 src/armnn/optimizations/ConvertFp32NetworkToBf16.hpp
Nina Drozd861985f2019-04-18 14:48:51 +0100404 src/armnn/optimizations/ConvertFp32NetworkToFp16.hpp
Diego Lopez Recasfe95d722021-03-19 12:40:16 +0000405 src/armnn/optimizations/FoldPadIntoLayer2d.hpp
telsoa014fcda012018-03-09 14:13:49 +0000406 src/armnn/optimizations/MovePermuteUp.hpp
Mike Kelly490b7be2020-03-03 12:39:09 +0000407 src/armnn/optimizations/MoveTransposeUp.hpp
telsoa014fcda012018-03-09 14:13:49 +0000408 src/armnn/optimizations/Optimization.hpp
409 src/armnn/optimizations/OptimizeConsecutiveReshapes.hpp
Nina Drozd861985f2019-04-18 14:48:51 +0100410 src/armnn/optimizations/OptimizeInverseConversions.hpp
telsoa014fcda012018-03-09 14:13:49 +0000411 src/armnn/optimizations/OptimizeInversePermutes.hpp
Rob Hughes3a7d3a72019-09-24 16:59:56 +0100412 src/armnn/optimizations/PermuteAndBatchToSpaceAsDepthToSpace.hpp
telsoa014fcda012018-03-09 14:13:49 +0000413 src/armnn/optimizations/PermuteAsReshape.hpp
414 src/armnn/optimizations/SquashEqualSiblings.hpp
Jan Eilers7e989832020-06-19 11:47:21 +0100415 third-party/cxxopts/cxxopts.hpp
Jim Flynnc9631102020-06-24 11:11:20 +0100416 third-party/ghc/filesystem.hpp
417 third-party/half/half.hpp
James Ward22a4e152020-09-25 11:43:21 +0100418 third-party/mapbox/optional.hpp
419 third-party/mapbox/recursive_wrapper.hpp
420 third-party/mapbox/variant.hpp
421 third-party/mapbox/variant_cast.hpp
422 third-party/mapbox/variant_io.hpp
423 third-party/mapbox/variant_visitor.hpp
telsoa014fcda012018-03-09 14:13:49 +0000424 )
425
telsoa014fcda012018-03-09 14:13:49 +0000426# Files used for Streamline-based profiling backend
427if(PROFILING_BACKEND_STREAMLINE)
428 list(APPEND armnn_sources
429 ${GATOR_ROOT}/annotate/streamline_annotate.h
430 ${GATOR_ROOT}/annotate/streamline_annotate.c)
431endif()
432
David Beck10b4dfd2018-09-19 12:03:20 +0100433# the backends under src/backends extend the list of
David Beck3cc9a622018-10-12 10:38:31 +0100434# object libs armnn to include in the build
David Beck10b4dfd2018-09-19 12:03:20 +0100435include(src/backends/backends.cmake)
David Beck3cc9a622018-10-12 10:38:31 +0100436foreach(lib ${armnnLibraries})
Rob Hughes721b82f2019-11-15 09:04:17 +0000437 message(STATUS "Adding object library dependency to armnn: ${lib}")
David Beck3cc9a622018-10-12 10:38:31 +0100438 list(APPEND armnn_sources $<TARGET_OBJECTS:${lib}>)
439endforeach()
440
Jim Flynn870b96c2022-03-25 21:24:56 +0000441if(BUILD_BARE_METAL)
442 add_library_ex(armnn STATIC ${armnn_sources})
443else()
444 add_library_ex(armnn SHARED ${armnn_sources})
445endif()
David Beck10b4dfd2018-09-19 12:03:20 +0100446
Rob Hughesa91479c2020-01-07 09:40:12 +0000447target_compile_definitions(armnn PRIVATE "ARMNN_COMPILING_DLL")
448
Keith Davisebbf1d42022-03-28 18:08:20 +0100449# Generate a map file for debug mode only
450if(CMAKE_BUILD_TYPE MATCHES debug)
451 set_property(TARGET armnn APPEND_STRING PROPERTY
452 LINK_FLAGS " -Wl,-Map=libarmnnMapFile.map")
453 message(STATUS "Linker will generate mapfile " )
454endif()
455
Derek Lambertieac4adb2020-08-25 13:05:59 +0100456target_include_directories(armnn
457 PUBLIC
458 $<INSTALL_INTERFACE:include>
459 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
460 PRIVATE
461 src/armnn
462 src/armnnUtils
463 src/backends
464 src/profiling
465 profiling/common/include
Jim Flynn3e9bc192022-03-23 23:01:26 +0000466 profiling/client/include
Derek Lambertieac4adb2020-08-25 13:05:59 +0100467)
David Beck3cc9a622018-10-12 10:38:31 +0100468
Jan Eilersba3ef182020-09-25 08:36:44 +0100469# Link fmt third-party library
470add_subdirectory(third-party/fmt)
Jim Flynn3e9bc192022-03-23 23:01:26 +0000471target_link_libraries(armnn PUBLIC fmt)
472
473target_link_libraries(armnn PUBLIC armnnUtils)
474target_link_libraries(armnn PUBLIC pipeCommon)
475target_link_libraries(armnn PUBLIC pipeClient)
476
477target_link_libraries(armnn PUBLIC ${CMAKE_DL_LIBS})
478if ("${CMAKE_SYSTEM_NAME}" STREQUAL Windows)
479 target_link_libraries(armnn PUBLIC Ws2_32.lib)
480endif()
481
Jan Eilersba3ef182020-09-25 08:36:44 +0100482
telsoa01c577f2c2018-08-31 09:22:23 +0100483if(BUILD_ONNX_PARSER)
Matthew Benthama7b79282019-06-03 13:00:50 +0100484 install(TARGETS armnnOnnxParser
Rob Hughes91e1d892019-08-23 10:11:58 +0100485 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Jim Flynn870b96c2022-03-25 21:24:56 +0000486 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
Rob Hughes91e1d892019-08-23 10:11:58 +0100487 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
telsoa01c577f2c2018-08-31 09:22:23 +0100488endif()
Ruomei Yandb7c3912019-03-08 17:50:25 +0000489
Matthew Benthama7b79282019-06-03 13:00:50 +0100490install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
telsoa014fcda012018-03-09 14:13:49 +0000491
telsoa014fcda012018-03-09 14:13:49 +0000492if(ARMCOMPUTENEON OR ARMCOMPUTECL)
Jim Flynn3e9bc192022-03-23 23:01:26 +0000493 target_link_libraries(armnn PUBLIC ${ARMCOMPUTE_LIBRARIES})
telsoa014fcda012018-03-09 14:13:49 +0000494endif()
telsoa014fcda012018-03-09 14:13:49 +0000495
Rob Hughes199c98e2019-11-13 11:41:36 +0000496if(PROFILING_BACKEND_STREAMLINE AND (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android)))
Jim Flynn3e9bc192022-03-23 23:01:26 +0000497 target_link_libraries(armnn PUBLIC ${CMAKE_THREAD_LIBS_INIT})
telsoa014fcda012018-03-09 14:13:49 +0000498endif()
499
Matteo Martincighbccc3452019-10-18 14:59:19 +0100500set_target_properties(armnn PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
501
telsoa014fcda012018-03-09 14:13:49 +0000502if(BUILD_UNIT_TESTS)
503 set(unittest_sources)
504 list(APPEND unittest_sources
Mike Kelly0d677db2021-06-27 22:39:21 +0100505 src/armnn/test/CloneTests.cpp
jimfly01aebf2e72019-02-05 09:20:11 +0000506 src/armnn/test/ConstTensorLayerVisitor.hpp
507 src/armnn/test/ConstTensorLayerVisitor.cpp
Sadik Armagana097d2a2021-11-24 15:47:28 +0000508 src/armnn/test/CreateWorkload.hpp
David Beckf98d21a2018-10-26 16:03:03 +0100509 src/armnn/test/EndToEndTest.cpp
Teresa Charlin4de9f672019-04-10 13:59:49 +0100510 src/armnn/test/ExecutionFrameTest.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100511 src/armnn/test/FloatingPointConverterTest.cpp
Matthew Benthamd78b891d2019-04-30 10:17:40 +0100512 src/armnn/test/FlowControl.cpp
David Beckf98d21a2018-10-26 16:03:03 +0100513 src/armnn/test/GraphTests.cpp
Sadik Armagana097d2a2021-11-24 15:47:28 +0000514 src/armnn/test/GraphUtils.hpp
telsoa01c577f2c2018-08-31 09:22:23 +0100515 src/armnn/test/InstrumentTests.cpp
Matteo Martincighbf0e7222019-06-20 17:17:45 +0100516 src/armnn/test/InferOutputTests.cpp
517 src/armnn/test/InferOutputTests.hpp
Éanna Ó Catháina4247d52019-05-08 14:00:45 +0100518 src/armnn/test/ModelAccuracyCheckerTest.cpp
David Beckf98d21a2018-10-26 16:03:03 +0100519 src/armnn/test/NetworkTests.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100520 src/armnn/test/ObservableTest.cpp
David Beckf98d21a2018-10-26 16:03:03 +0100521 src/armnn/test/OptimizerTests.cpp
Narumol Prangnawarat16f82f92020-09-14 16:12:44 +0100522 src/armnn/test/optimizations/AddBroadcastReshapeLayerTests.cpp
Narumol Prangnawaratbc7ffb52020-03-20 15:01:01 +0000523 src/armnn/test/optimizations/ConvertConstantsBFloatTests.cpp
Rob Hughes95e73d72019-09-24 09:34:53 +0100524 src/armnn/test/optimizations/ConvertConstantsFloatToHalfTests.cpp
525 src/armnn/test/optimizations/ConvertConstantsHalfToFloatTests.cpp
Teresa Charlin37c430e2021-05-24 16:22:15 +0100526 src/armnn/test/optimizations/FoldPadTests.cpp
Narumol Prangnawaratbc7ffb52020-03-20 15:01:01 +0000527 src/armnn/test/optimizations/Fp32NetworkToBf16ConverterTests.cpp
Rob Hughes95e73d72019-09-24 09:34:53 +0100528 src/armnn/test/optimizations/Fp32NetworkToFp16ConverterTests.cpp
Mike Kelly07810fc2020-11-12 10:58:48 +0000529 src/armnn/test/optimizations/FuseActivationTests.cpp
Teresa Charlin6fff4f42020-10-31 13:21:01 +0000530 src/armnn/test/optimizations/FuseBatchNormTests.cpp
Rob Hughes95e73d72019-09-24 09:34:53 +0100531 src/armnn/test/optimizations/InsertDebugLayerTests.cpp
532 src/armnn/test/optimizations/MovePermuteUpTests.cpp
Mike Kelly490b7be2020-03-03 12:39:09 +0000533 src/armnn/test/optimizations/MoveTransposeUpTests.cpp
Rob Hughes95e73d72019-09-24 09:34:53 +0100534 src/armnn/test/optimizations/OptimizeConsecutiveReshapesTests.cpp
535 src/armnn/test/optimizations/OptimizeInverseConversionsTests.cpp
536 src/armnn/test/optimizations/OptimizeInversePermutesTests.cpp
Rob Hughes3a7d3a72019-09-24 16:59:56 +0100537 src/armnn/test/optimizations/PermuteAndBatchToSpaceAsDepthToSpaceTests.cpp
Rob Hughes95e73d72019-09-24 09:34:53 +0100538 src/armnn/test/optimizations/PermuteAsReshapeTests.cpp
Matthew Sloyan33f89872021-06-30 10:20:17 +0100539 src/armnn/test/optimizations/RedirectMembersToConstantInputsTests.cpp
Matthew Sloyan5fc0fd62021-05-03 12:22:03 +0100540 src/armnn/test/optimizations/ReduceMultipleAxesTests.cpp
Rob Hughes95e73d72019-09-24 09:34:53 +0100541 src/armnn/test/optimizations/SquashEqualSiblingsTests.cpp
Mike Kelly490b7be2020-03-03 12:39:09 +0000542 src/armnn/test/optimizations/TransposeAsReshapeTests.cpp
David Beckf98d21a2018-10-26 16:03:03 +0100543 src/armnn/test/OptionalTest.cpp
Sadik Armagana097d2a2021-11-24 15:47:28 +0000544 src/armnn/test/PredicateResult.hpp
David Beckf98d21a2018-10-26 16:03:03 +0100545 src/armnn/test/ProfilerTests.cpp
546 src/armnn/test/ProfilingEventTest.cpp
Finn Williams87d0bda2020-07-03 10:12:03 +0100547 src/armnn/test/ShapeInferenceTests.cpp
Derek Lambertiff05cc52019-04-26 13:05:17 +0100548 src/armnn/test/SubgraphViewTests.cpp
Derek Lamberti84da38b2019-06-13 11:40:08 +0100549 src/armnn/test/TensorHandleStrategyTest.cpp
Sadik Armagana097d2a2021-11-24 15:47:28 +0000550 src/armnn/test/TensorHelpers.hpp
David Beckf98d21a2018-10-26 16:03:03 +0100551 src/armnn/test/TensorTest.cpp
FrancisMurtagh531ef942019-02-01 11:48:58 +0000552 src/armnn/test/TestInputOutputLayerVisitor.cpp
553 src/armnn/test/TestInputOutputLayerVisitor.hpp
FrancisMurtagh1306b192019-01-28 14:03:21 +0000554 src/armnn/test/TestLayerVisitor.cpp
555 src/armnn/test/TestLayerVisitor.hpp
FrancisMurtagh28d3d632019-01-29 12:15:23 +0000556 src/armnn/test/TestNameOnlyLayerVisitor.cpp
557 src/armnn/test/TestNameOnlyLayerVisitor.hpp
Sadik Armagana097d2a2021-11-24 15:47:28 +0000558 src/armnn/test/TestUtils.hpp
559 src/armnn/test/UnitTests.hpp
FrancisMurtaghf08876f2019-02-04 15:41:17 +0000560 src/armnn/test/TestNameAndDescriptorLayerVisitor.hpp
561 src/armnn/test/TestNameAndDescriptorLayerVisitor.cpp
Matthew Sloyan87b52962021-06-18 09:58:46 +0100562 src/armnn/test/UtilityTests.cpp
Ferran Balaguer51dd62f2019-01-11 19:29:18 +0000563 src/armnn/test/UtilsTests.cpp
Matthew Sloyanfbba3642020-10-15 13:53:27 +0100564 src/armnnUtils/test/FloatingPointComparisonTest.cpp
Ferran Balaguer51dd62f2019-01-11 19:29:18 +0000565 src/armnnUtils/test/ParserHelperTest.cpp
Matthew Sloyanfbba3642020-10-15 13:53:27 +0100566 src/armnnUtils/test/PrototxtConversionsTest.cpp
567 src/armnnUtils/test/QuantizeHelperTest.cpp
Narumol Prangnawarat02807852019-09-11 16:43:09 +0100568 src/armnnUtils/test/TensorUtilsTest.cpp
Finn Williams3e54d032020-10-22 16:53:35 +0100569 src/armnnUtils/test/TransformIteratorTest.cpp
Narumol Prangnawarat7be47ef2019-09-27 18:00:11 +0100570 src/profiling/test/BufferTests.cpp
Keith Davis3201eea2019-10-24 17:30:41 +0100571 src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
Jim Flynn4e755a52020-03-29 17:48:26 +0100572 src/profiling/test/PrintPacketHeaderHandler.cpp
573 src/profiling/test/PrintPacketHeaderHandler.hpp
Aron Virginas-Tardfa14772019-09-24 18:24:47 +0100574 src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
Narumol Prangnawarat15effd82019-10-22 14:17:11 +0100575 src/profiling/test/ProfilingGuidTest.cpp
Jim Flynn64063552020-02-14 10:18:08 +0000576 src/profiling/test/ProfilingMocks.hpp
Francis Murtagh1f7db452019-08-14 09:49:34 +0100577 src/profiling/test/ProfilingTests.cpp
Matteo Martincighd0613b52019-10-09 16:47:04 +0100578 src/profiling/test/ProfilingTests.hpp
Narumol Prangnawaratdf31cfe2019-11-22 11:26:06 +0000579 src/profiling/test/ProfilingTestUtils.cpp
580 src/profiling/test/ProfilingTestUtils.hpp
Jim Flynn01d02812020-04-29 21:12:13 +0100581 src/profiling/test/RequestCountersPacketHandler.cpp
582 src/profiling/test/RequestCountersPacketHandler.hpp
Ferran Balagueraf5c46b2019-08-30 15:49:15 +0100583 src/profiling/test/SendCounterPacketTests.cpp
Matteo Martincighd0613b52019-10-09 16:47:04 +0100584 src/profiling/test/SendCounterPacketTests.hpp
Jim Flynn4e755a52020-03-29 17:48:26 +0100585 src/profiling/test/TestTimelinePacketHandler.cpp
586 src/profiling/test/TestTimelinePacketHandler.hpp
587 src/profiling/test/TimelineModel.cpp
588 src/profiling/test/TimelineModel.hpp
Sadik Armagan7bbdf9d2019-10-24 10:26:05 +0100589 src/profiling/test/SendTimelinePacketTests.cpp
Matteo Martincigh0aed4f92019-10-01 14:25:34 +0100590 src/profiling/test/TimelinePacketTests.cpp
Matteo Martincigh830101c2019-10-22 11:07:45 +0100591 src/profiling/test/TimelineUtilityMethodsTests.cpp
Sadik Armagan1625efc2021-06-10 18:24:34 +0100592 third-party/doctest/doctest.h
Ferran Balaguer51dd62f2019-01-11 19:29:18 +0000593 )
telsoa014fcda012018-03-09 14:13:49 +0000594
Matteo Martincighdb16dd32019-08-27 16:41:11 +0100595 if(ARMNNREF)
Matteo Martincighe67edb22019-08-14 14:05:46 +0100596 list(APPEND unittest_sources
597 src/armnn/test/DebugCallbackTest.cpp
Matteo Martincighe67edb22019-08-14 14:05:46 +0100598 src/armnn/test/RuntimeTests.cpp
599 src/armnn/test/RuntimeTests.hpp
600 )
601 endif()
602
Matteo Martincighdb16dd32019-08-27 16:41:11 +0100603 if(BUILD_TF_LITE_PARSER AND ARMNNREF)
telsoa01c577f2c2018-08-31 09:22:23 +0100604 list(APPEND unittest_sources
Sadik Armagan479045b2018-10-01 11:51:37 +0100605 src/armnnTfLiteParser/test/Activations.cpp
Bruno Goncalvesd4ac6a42018-12-18 12:56:22 -0200606 src/armnnTfLiteParser/test/Addition.cpp
Matthew Sloyan28f177c2021-04-09 14:38:52 +0100607 src/armnnTfLiteParser/test/ArgMinMax.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100608 src/armnnTfLiteParser/test/AvgPool2D.cpp
Bruno Goncalvesdb947e22019-02-08 18:52:21 -0200609 src/armnnTfLiteParser/test/BatchToSpaceND.cpp
mathad01b392e982021-04-07 12:07:30 +0100610 src/armnnTfLiteParser/test/Cast.cpp
Bruno Goncalves2d0eb862021-07-11 14:10:15 -0300611 src/armnnTfLiteParser/test/Comparison.cpp
Sadik Armagan479045b2018-10-01 11:51:37 +0100612 src/armnnTfLiteParser/test/Concatenation.cpp
Bruno Goncalves3d7efe92018-12-27 14:21:43 -0200613 src/armnnTfLiteParser/test/Constant.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100614 src/armnnTfLiteParser/test/Conv2D.cpp
Matthew Sloyaneb5f8102021-10-05 17:31:42 +0100615 src/armnnTfLiteParser/test/Conv3D.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100616 src/armnnTfLiteParser/test/DepthwiseConvolution2D.cpp
Sadik Armagana2747482021-02-09 10:28:54 +0000617 src/armnnTfLiteParser/test/DepthToSpace.cpp
Finn Williamsed66d142019-12-06 09:55:55 +0000618 src/armnnTfLiteParser/test/Dequantize.cpp
keidav011b3e2ea2019-02-21 10:07:37 +0000619 src/armnnTfLiteParser/test/DetectionPostProcess.cpp
Darshan Patel42b3d7d2020-05-25 22:30:07 +0530620 src/armnnTfLiteParser/test/Div.cpp
Matthew Sloyaned7fce42021-04-15 20:46:24 +0100621 src/armnnTfLiteParser/test/ElementWiseUnary.cpp
Teresa Charlin3ab85482021-06-08 16:59:29 +0100622 src/armnnTfLiteParser/test/ExpandDims.cpp
Teresa Charlincdbd40b2022-02-25 13:21:55 +0000623 src/armnnTfLiteParser/test/FloorDiv.cpp
Sadik Armagan8853c1f2018-10-22 09:04:18 +0100624 src/armnnTfLiteParser/test/FullyConnected.cpp
Sadik Armagan26868492021-01-22 14:25:31 +0000625 src/armnnTfLiteParser/test/Gather.cpp
Matthew Jackson28c94572019-07-18 10:47:03 +0100626 src/armnnTfLiteParser/test/L2Normalization.cpp
Sadik Armagan12239e72020-05-27 11:06:17 +0100627 src/armnnTfLiteParser/test/LeakyRelu.cpp
Narumol Prangnawaratbbf71a62020-09-07 14:05:22 +0100628 src/armnnTfLiteParser/test/LoadScopeDynamicTensor.cpp
Mike Kelly31dce2b2021-09-01 21:22:37 +0100629 src/armnnTfLiteParser/test/LocalResponseNormalization.cpp
Bruno Goncalvesb8d805e2019-02-12 22:57:13 -0200630 src/armnnTfLiteParser/test/Maximum.cpp
Nattapat Chaimanowongb66504b2018-10-17 15:19:14 +0100631 src/armnnTfLiteParser/test/MaxPool2D.cpp
Bruno Goncalves2235cee2018-12-19 12:51:45 -0200632 src/armnnTfLiteParser/test/Mean.cpp
Bruno Goncalves8f6d7a72019-02-12 22:58:18 -0200633 src/armnnTfLiteParser/test/Minimum.cpp
Matthew Sloyanaf3a4ef2021-10-22 15:48:12 +0100634 src/armnnTfLiteParser/test/MirrorPad.cpp
Bruno Goncalvesf803f782018-12-18 13:40:30 -0200635 src/armnnTfLiteParser/test/Multiplication.cpp
Matthew Jacksonbcca1f42019-07-16 11:39:21 +0100636 src/armnnTfLiteParser/test/Pack.cpp
Bruno Goncalves6c2355b2018-12-19 12:52:01 -0200637 src/armnnTfLiteParser/test/Pad.cpp
Mike Kelly0d77ae12022-01-07 17:42:27 +0000638 src/armnnTfLiteParser/test/PadV2.cpp
Narumol Prangnawaratbfaee6b2021-05-24 18:50:24 +0100639 src/armnnTfLiteParser/test/Prelu.cpp
Sadik Armagana2747482021-02-09 10:28:54 +0000640 src/armnnTfLiteParser/test/Reduce.cpp
Sadik Armagan479045b2018-10-01 11:51:37 +0100641 src/armnnTfLiteParser/test/Reshape.cpp
Cathal Corbettd2f73232021-12-10 13:38:52 +0000642 src/armnnTfLiteParser/test/ReshapeDynamic.cpp
Bruno Goncalves3f58ddb2019-02-07 18:40:11 -0200643 src/armnnTfLiteParser/test/ResizeBilinear.cpp
Sadik Armagana3b31f02019-12-05 09:08:53 +0000644 src/armnnTfLiteParser/test/ResizeNearestNeighbor.cpp
Finn Williamsb49ed182021-06-29 15:50:08 +0100645 src/armnnTfLiteParser/test/Quantize.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100646 src/armnnTfLiteParser/test/Softmax.cpp
Bruno Goncalvesbaded142019-02-08 19:02:48 -0200647 src/armnnTfLiteParser/test/SpaceToBatchND.cpp
Keith Davis0176fd82021-06-01 17:36:32 +0100648 src/armnnTfLiteParser/test/Shape.cpp
josh minorba424d22019-11-13 10:55:17 -0600649 src/armnnTfLiteParser/test/Slice.cpp
Nina Drozd0324f482019-04-08 10:52:10 +0100650 src/armnnTfLiteParser/test/Split.cpp
Ryan OShea86704732020-05-26 11:41:04 +0100651 src/armnnTfLiteParser/test/SplitV.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100652 src/armnnTfLiteParser/test/Squeeze.cpp
Bruno Goncalves451d95b2019-02-12 22:59:22 -0200653 src/armnnTfLiteParser/test/StridedSlice.cpp
Nina Drozd0324f482019-04-08 10:52:10 +0100654 src/armnnTfLiteParser/test/Sub.cpp
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000655 src/armnnTfLiteParser/test/Sum.cpp
Matthew Jackson74bf7da2019-08-16 16:51:42 +0100656 src/armnnTfLiteParser/test/TransposeConv.cpp
Keith Davis4cd29a02019-09-09 14:49:20 +0100657 src/armnnTfLiteParser/test/Transpose.cpp
Nina Drozd200e3802019-04-15 09:47:39 +0100658 src/armnnTfLiteParser/test/Unpack.cpp
Aron Virginas-Tarc975f922019-10-23 17:38:17 +0100659 src/armnnTfLiteParser/test/Unsupported.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100660 src/armnnTfLiteParser/test/LoadModel.cpp
661 src/armnnTfLiteParser/test/GetBuffer.cpp
662 src/armnnTfLiteParser/test/OutputShapeOfSqueeze.cpp
663 src/armnnTfLiteParser/test/InputOutputTensorNames.cpp
664 src/armnnTfLiteParser/test/GetTensorIds.cpp
665 src/armnnTfLiteParser/test/GetSubgraphInputsOutputs.cpp
666 src/armnnTfLiteParser/test/GetInputsOutputs.cpp
Colm Donelan6350d272020-06-09 16:56:25 +0100667 src/armnnTfLiteParser/test/TfLiteParser.cpp
telsoa01c577f2c2018-08-31 09:22:23 +0100668 )
Rob Hughesa91479c2020-01-07 09:40:12 +0000669
670 # Generate SchemaText.cpp file which contains the TfLite schema text as a
Rob Hughesff3c4262019-12-20 17:43:16 +0000671 # static C-array of bytes. This is needed at runtime for TfLite parser tests.
672 add_custom_command(
673 OUTPUT SchemaText.cpp
674 COMMAND cp ${TF_LITE_SCHEMA_INCLUDE_PATH}/schema.fbs g_TfLiteSchemaText
675 COMMAND xxd -i g_TfLiteSchemaText SchemaText.cpp
676 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
Rob Hughesa91479c2020-01-07 09:40:12 +0000677 DEPENDS ${TF_LITE_SCHEMA_INCLUDE_PATH}/schema.fbs
Rob Hughesff3c4262019-12-20 17:43:16 +0000678 )
679 list(APPEND unittest_sources ${CMAKE_CURRENT_BINARY_DIR}/SchemaText.cpp)
telsoa01c577f2c2018-08-31 09:22:23 +0100680 endif()
681
Matteo Martincighdb16dd32019-08-27 16:41:11 +0100682 if(BUILD_ONNX_PARSER AND ARMNNREF)
Matteo Martincighe67edb22019-08-14 14:05:46 +0100683 list(APPEND unittest_sources
Ryan OSheaed27ee72020-04-22 16:37:29 +0100684 src/armnnOnnxParser/test/Addition.cpp
685 src/armnnOnnxParser/test/BatchNorm.cpp
Finn Williams7ee5d2c2020-03-27 11:11:50 +0000686 src/armnnOnnxParser/test/Clip.cpp
Narumol Prangnawaratbc3bb622021-09-24 16:08:34 +0100687 src/armnnOnnxParser/test/Concat.cpp
Matteo Martincighe67edb22019-08-14 14:05:46 +0100688 src/armnnOnnxParser/test/Const.cpp
Ryan OSheaed27ee72020-04-22 16:37:29 +0100689 src/armnnOnnxParser/test/Constructor.cpp
Matteo Martincighe67edb22019-08-14 14:05:46 +0100690 src/armnnOnnxParser/test/Conv2D.cpp
Ryan OSheaed27ee72020-04-22 16:37:29 +0100691 src/armnnOnnxParser/test/CreateNetwork.cpp
692 src/armnnOnnxParser/test/DepthConv.cpp
693 src/armnnOnnxParser/test/Flatten.cpp
Matteo Martincighe67edb22019-08-14 14:05:46 +0100694 src/armnnOnnxParser/test/FullyConnected.cpp
Narumol Prangnawaratf10b15a2021-09-17 21:08:57 +0100695 src/armnnOnnxParser/test/Gather.cpp
Narumol Prangnawarat1112b012021-09-30 12:10:50 +0100696 src/armnnOnnxParser/test/Gemm.cpp
Matteo Martincighe67edb22019-08-14 14:05:46 +0100697 src/armnnOnnxParser/test/GetInputsOutputs.cpp
Narumol Prangnawarat1b11f322021-10-13 11:44:50 +0100698 src/armnnOnnxParser/test/LoadScopeDynamicTensor.cpp
Narumol Prangnawaratfe6aa2f2021-09-23 16:11:17 +0100699 src/armnnOnnxParser/test/OnnxParserTestUtils.cpp
Narumol Prangnawaratf10b15a2021-09-17 21:08:57 +0100700 src/armnnOnnxParser/test/OnnxParserTestUtils.hpp
Ryan OSheaed27ee72020-04-22 16:37:29 +0100701 src/armnnOnnxParser/test/Pooling.cpp
702 src/armnnOnnxParser/test/ProtoxtFixture.cpp
703 src/armnnOnnxParser/test/Relu.cpp
704 src/armnnOnnxParser/test/Reshape.cpp
Narumol Prangnawaratcdc495e2021-09-16 18:13:39 +0100705 src/armnnOnnxParser/test/Shape.cpp
Narumol Prangnawaratfe6aa2f2021-09-23 16:11:17 +0100706 src/armnnOnnxParser/test/Unsqueeze.cpp
Matteo Martincighe67edb22019-08-14 14:05:46 +0100707 )
708 endif()
709
Matteo Martincighdb16dd32019-08-27 16:41:11 +0100710 if(BUILD_ARMNN_SERIALIZER AND ARMNNREF)
Kevin May43a799c2019-02-08 16:31:42 +0000711 enable_language(ASM)
712 list(APPEND unittest_sources
Ruomei Yandb7c3912019-03-08 17:50:25 +0000713 src/armnnSerializer/test/ActivationSerializationTests.cpp
Finn Williamsb454c5c2021-02-09 15:56:23 +0000714 src/armnnSerializer/test/ComparisonSerializationTests.cpp
715 src/armnnSerializer/test/LstmSerializationTests.cpp
Ruomei Yandb7c3912019-03-08 17:50:25 +0000716 src/armnnSerializer/test/SerializerTests.cpp
Finn Williamsb454c5c2021-02-09 15:56:23 +0000717 src/armnnSerializer/test/SerializerTestUtils.cpp
718 src/armnnSerializer/test/SerializerTestUtils.hpp
FinnWilliamsArm4ffcc8f2019-09-05 14:34:20 +0100719 src/armnnDeserializer/test/DeserializeAbs.cpp
Ruomei Yandb7c3912019-03-08 17:50:25 +0000720 src/armnnDeserializer/test/DeserializeActivation.cpp
721 src/armnnDeserializer/test/DeserializeAdd.cpp
Mike Kelly1f140f72021-04-06 12:25:55 +0100722 src/armnnDeserializer/test/DeserializeArgMinMax.cpp
Ruomei Yandb7c3912019-03-08 17:50:25 +0000723 src/armnnDeserializer/test/DeserializeBatchToSpaceNd.cpp
724 src/armnnDeserializer/test/DeserializeBatchNormalization.cpp
mathad01b392e982021-04-07 12:07:30 +0100725 src/armnnDeserializer/test/DeserializeCast.cpp
Simon Obute51f67772021-09-03 15:50:13 +0100726 src/armnnDeserializer/test/DeserializeChannelShuffle.cpp
Aron Virginas-Tar422f2fb2019-10-21 14:09:11 +0100727 src/armnnDeserializer/test/DeserializeComparison.cpp
Ruomei Yandb7c3912019-03-08 17:50:25 +0000728 src/armnnDeserializer/test/DeserializeConstant.cpp
729 src/armnnDeserializer/test/DeserializeConvolution2d.cpp
Matthew Sloyanb63a3112021-09-08 13:05:51 +0100730 src/armnnDeserializer/test/DeserializeConvolution3d.cpp
Aron Virginas-Tar11b2eca2019-09-24 11:01:51 +0100731 src/armnnDeserializer/test/DeserializeDepthToSpace.cpp
Jan Eilers53ef7952021-06-02 12:01:25 +0100732 src/armnnDeserializer/test/DeserializeDepthwiseConv2d.cpp
Ruomei Yandb7c3912019-03-08 17:50:25 +0000733 src/armnnDeserializer/test/DeserializeDivision.cpp
Keith Davis300ad562020-06-04 16:34:23 +0100734 src/armnnDeserializer/test/DeserializeFill.cpp
Ruomei Yandb7c3912019-03-08 17:50:25 +0000735 src/armnnDeserializer/test/DeserializeFloor.cpp
736 src/armnnDeserializer/test/DeserializeFullyConnected.cpp
737 src/armnnDeserializer/test/DeserializeGather.cpp
Aron Virginas-Tar92bbcae2019-10-09 10:36:34 +0100738 src/armnnDeserializer/test/DeserializeInstanceNormalization.cpp
Ferran Balaguer0dcffec2019-06-18 16:25:06 +0100739 src/armnnDeserializer/test/DeserializeL2Normalization.cpp
Aron Virginas-Tarc949ab52019-10-14 16:43:13 +0100740 src/armnnDeserializer/test/DeserializeLogSoftmax.cpp
Ruomei Yandb7c3912019-03-08 17:50:25 +0000741 src/armnnDeserializer/test/DeserializeMean.cpp
742 src/armnnDeserializer/test/DeserializeMultiplication.cpp
743 src/armnnDeserializer/test/DeserializeNormalization.cpp
744 src/armnnDeserializer/test/DeserializePad.cpp
745 src/armnnDeserializer/test/DeserializePermute.cpp
746 src/armnnDeserializer/test/DeserializePooling2d.cpp
Tamas Nyirid998a1c2021-11-05 14:55:33 +0000747 src/armnnDeserializer/test/DeserializePooling3d.cpp
Finn Williams2605b232020-06-10 15:53:46 +0100748 src/armnnDeserializer/test/DeserializeRank.cpp
Sadik Armagan0c3ea5b2021-02-03 09:29:30 +0000749 src/armnnDeserializer/test/DeserializeReduceSum.cpp
Ruomei Yandb7c3912019-03-08 17:50:25 +0000750 src/armnnDeserializer/test/DeserializeReshape.cpp
751 src/armnnDeserializer/test/DeserializeResizeBilinear.cpp
752 src/armnnDeserializer/test/DeserializeRsqrt.cpp
Keith Davis3ae3f972021-05-21 16:33:48 +0100753 src/armnnDeserializer/test/DeserializeShape.cpp
Aron Virginas-Tara2f4b4b2019-09-20 11:21:14 +0100754 src/armnnDeserializer/test/DeserializeSlice.cpp
Ruomei Yandb7c3912019-03-08 17:50:25 +0000755 src/armnnDeserializer/test/DeserializeSpaceToBatchNd.cpp
756 src/armnnDeserializer/test/DeserializeStridedSlice.cpp
757 src/armnnDeserializer/test/DeserializeSubtraction.cpp
758 src/armnnDeserializer/test/ParserFlatbuffersSerializeFixture.hpp
759 src/armnnDeserializer/test/SchemaSerialize.s
760 )
Derek Lamberti0028d1b2019-02-20 13:57:42 +0000761 set_source_files_properties(src/armnnDeserializer/test/SchemaSerialize.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
Kevin May43a799c2019-02-08 16:31:42 +0000762 endif()
763
Colm Donelana21620d2019-10-11 13:09:49 +0100764 if(BUILD_GATORD_MOCK)
765 list(APPEND unittest_sources
766 tests/profiling/gatordmock/tests/GatordMockTests.cpp
767 )
768 endif()
769
Sadik Armagan6f86b692020-03-09 11:04:32 +0000770 if(BUILD_TIMELINE_DECODER)
771 list(APPEND unittest_sources
Éanna Ó Catháin0de47122020-04-01 15:40:12 +0100772 src/timelineDecoder/tests/JSONTimelineDecoderTests.cpp
Jim Flynnbbfe6032020-07-20 16:57:44 +0100773 profiling/server/src/timelineDecoder/tests/TimelineTests.cpp
Sadik Armagan6f86b692020-03-09 11:04:32 +0000774 )
775 endif()
776
Finn Williams2ed809c2020-04-20 21:21:07 +0100777 if(BUILD_BASE_PIPE_SERVER)
778 list(APPEND unittest_sources
779 profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp
780 )
781 endif()
782
Matteo Martincigh4423ac72018-10-11 17:39:30 +0100783 foreach(lib ${armnnUnitTestLibraries})
Rob Hughes721b82f2019-11-15 09:04:17 +0000784 message(STATUS "Adding object library dependency to UnitTests: ${lib}")
Matteo Martincigh4423ac72018-10-11 17:39:30 +0100785 list(APPEND unittest_sources $<TARGET_OBJECTS:${lib}>)
786 endforeach()
787
788 add_executable(UnitTests ${unittest_sources})
telsoa014fcda012018-03-09 14:13:49 +0000789 target_include_directories(UnitTests PRIVATE src/armnn)
790 target_include_directories(UnitTests PRIVATE src/armnnUtils)
Sadik Armagana097d2a2021-11-24 15:47:28 +0000791 target_include_directories(UnitTests PRIVATE src/armnnTestUtils)
Aron Virginas-Tarc9cc8042018-11-01 16:15:57 +0000792 target_include_directories(UnitTests PRIVATE src/backends)
Matteo Martincigh6db5f202019-09-05 12:02:04 +0100793 target_include_directories(UnitTests PRIVATE src/profiling)
telsoa014fcda012018-03-09 14:13:49 +0000794
telsoa01c577f2c2018-08-31 09:22:23 +0100795 if(VALGRIND_FOUND)
796 if(HEAP_PROFILING OR LEAK_CHECKING)
Rob Hughes721b82f2019-11-15 09:04:17 +0000797 message(STATUS "Valgrind is disabled for heap profiling and leak checking builds.")
telsoa01c577f2c2018-08-31 09:22:23 +0100798 else()
799 # Valgrind works with gperftools version number <= 2.4
800 target_compile_definitions(UnitTests PRIVATE "WITH_VALGRIND=1")
801 endif()
telsoa014fcda012018-03-09 14:13:49 +0000802 endif()
803
telsoa014fcda012018-03-09 14:13:49 +0000804 target_link_libraries(UnitTests ${CMAKE_THREAD_LIBS_INIT})
telsoa014fcda012018-03-09 14:13:49 +0000805
Matteo Martincigh4423ac72018-10-11 17:39:30 +0100806 target_link_libraries(UnitTests armnn)
807 target_link_libraries(UnitTests armnnUtils)
Matthew Sloyan87b52962021-06-18 09:58:46 +0100808 target_link_libraries(UnitTests armnnTestUtils)
Matteo Martincigh4423ac72018-10-11 17:39:30 +0100809
Colm Donelana21620d2019-10-11 13:09:49 +0100810 if(BUILD_GATORD_MOCK)
811 target_link_libraries(UnitTests gatordMockService)
Sadik Armagan6f86b692020-03-09 11:04:32 +0000812 endif()
813
814 if(BUILD_TIMELINE_DECODER)
Finn Williams8a2b4682020-02-26 10:25:26 +0000815 target_link_libraries(UnitTests timelineDecoder)
Jim Flynnef2838b2020-07-30 11:47:02 +0100816 target_link_libraries(UnitTests timelineDecoderJson)
Colm Donelana21620d2019-10-11 13:09:49 +0100817 endif()
818
Ruomei Yandb7c3912019-03-08 17:50:25 +0000819 if(BUILD_TF_LITE_PARSER)
820 target_include_directories(UnitTests SYSTEM PRIVATE "${TF_LITE_SCHEMA_INCLUDE_PATH}")
821 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
822 target_link_libraries(UnitTests armnnTfLiteParser)
823 endif()
824
Matteo Martincighdb16dd32019-08-27 16:41:11 +0100825 if(BUILD_ARMNN_SERIALIZER AND ARMNNREF)
Mike Kelly8c1701a2019-02-11 17:01:27 +0000826 target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnSerializer)
Ruomei Yandb7c3912019-03-08 17:50:25 +0000827 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
Kevin May43a799c2019-02-08 16:31:42 +0000828 target_link_libraries(UnitTests armnnSerializer)
829 endif()
830
telsoa01c577f2c2018-08-31 09:22:23 +0100831 if(BUILD_ONNX_PARSER)
832 target_link_libraries(UnitTests armnnOnnxParser)
833 endif()
834
Finn Williams2ed809c2020-04-20 21:21:07 +0100835 if(BUILD_BASE_PIPE_SERVER)
836 target_link_libraries(UnitTests armnnBasePipeServer)
837 endif()
838
telsoa014fcda012018-03-09 14:13:49 +0000839 addDllCopyCommands(UnitTests)
840endif()
Nattapat Chaimanowong4fbae332019-02-14 15:28:02 +0000841
Nikhil Raj5d955cf2021-04-19 16:59:48 +0100842if (BUILD_ARMNN_SERIALIZER AND (BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER) AND ARMNNREF)
Nattapat Chaimanowong4fbae332019-02-14 15:28:02 +0000843 set(ArmnnConverter_sources
844 src/armnnConverter/ArmnnConverter.cpp)
845
846 add_executable_ex(ArmnnConverter ${ArmnnConverter_sources})
847 target_include_directories(ArmnnConverter PRIVATE src/armnn)
848 target_include_directories(ArmnnConverter PRIVATE src/armnnUtils)
849
Sadik Armagan232cfc22019-03-13 18:33:10 +0000850 if(BUILD_ONNX_PARSER)
851 target_link_libraries(ArmnnConverter armnnOnnxParser)
852 endif()
853
Sadik Armagan232cfc22019-03-13 18:33:10 +0000854 if(BUILD_TF_LITE_PARSER)
855 target_link_libraries(ArmnnConverter armnnTfLiteParser)
856 endif()
857
Nattapat Chaimanowong4fbae332019-02-14 15:28:02 +0000858 target_link_libraries(ArmnnConverter armnnSerializer)
859
860 target_link_libraries(ArmnnConverter armnn)
861 target_link_libraries(ArmnnConverter ${CMAKE_THREAD_LIBS_INIT})
Nattapat Chaimanowong4fbae332019-02-14 15:28:02 +0000862 addDllCopyCommands(ArmnnConverter)
Francis Murtagh88cec322021-05-13 14:27:25 +0100863
864 install(TARGETS ArmnnConverter
865 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
Derek Lambertieac4adb2020-08-25 13:05:59 +0100866endif()
Colm Donelan366023f2019-09-05 10:03:56 +0100867
Finn Williams2ed809c2020-04-20 21:21:07 +0100868if(BUILD_BASE_PIPE_SERVER)
869 add_subdirectory(profiling/server/src/basePipeServer)
870endif()
871
Jim Flynnc1798782020-04-23 17:56:37 +0100872if(BUILD_TIMELINE_DECODER)
Jim Flynnbbfe6032020-07-20 16:57:44 +0100873 add_subdirectory(profiling/server/src/timelineDecoder)
874 add_subdirectory(profiling/common/src)
Jim Flynn3e9bc192022-03-23 23:01:26 +0000875 add_subdirectory(profiling/client/src)
Finn Williams8a2b4682020-02-26 10:25:26 +0000876 add_subdirectory(src/timelineDecoder)
Jim Flynnc1798782020-04-23 17:56:37 +0100877endif()
Finn Williams8a2b4682020-02-26 10:25:26 +0000878
Finn Williams2ed809c2020-04-20 21:21:07 +0100879if(BUILD_GATORD_MOCK AND NOT BUILD_BASE_PIPE_SERVER)
880 message(ERROR, "In order to build GatordMock you must set BUILD_BASE_PIPE_SERVER = YES")
881endif()
882
883if(BUILD_GATORD_MOCK AND NOT BUILD_TIMELINE_DECODER)
884 message(ERROR, "In order to build GatordMock you must set BUILD_TIMELINE_DECODER = YES")
885endif()
886
Jim Flynnc1798782020-04-23 17:56:37 +0100887if(BUILD_GATORD_MOCK)
Colm Donelan366023f2019-09-05 10:03:56 +0100888 set(gatord_mock_sources)
889 list(APPEND gatord_mock_sources
Colm Donelana21620d2019-10-11 13:09:49 +0100890 tests/profiling/gatordmock/CommandFileParser.hpp
891 tests/profiling/gatordmock/CommandFileParser.cpp
892 tests/profiling/gatordmock/CommandLineProcessor.hpp
893 tests/profiling/gatordmock/CommandLineProcessor.cpp
894 tests/profiling/gatordmock/GatordMockService.hpp
895 tests/profiling/gatordmock/GatordMockService.cpp
Colm Donelana21620d2019-10-11 13:09:49 +0100896 tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.cpp
897 tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp
Colm Donelanb682d842019-10-16 12:24:20 +0100898 tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.cpp
899 tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp
Matteo Martincighcdfb9412019-11-08 11:23:06 +0000900 tests/profiling/gatordmock/StreamMetadataCommandHandler.cpp
901 tests/profiling/gatordmock/StreamMetadataCommandHandler.hpp
Finn Williamsd7fcafa2020-04-23 17:55:18 +0100902 tests/profiling/gatordmock/StubCommandHandler.hpp
Colm Donelan366023f2019-09-05 10:03:56 +0100903 )
904
Colm Donelana21620d2019-10-11 13:09:49 +0100905 add_library_ex(gatordMockService STATIC ${gatord_mock_sources})
Finn Williams0c8cb992020-05-07 10:38:15 +0100906
907 target_include_directories(gatordMockService PRIVATE profiling/common/include
Jim Flynn27761832022-03-20 21:52:17 +0000908 profiling/client/include
Finn Williams0c8cb992020-05-07 10:38:15 +0100909 profiling/server/src/basePipeServer
910 src/armnnUtils
911 src/profiling
912 src/timelineDecoder)
913
914 if(BUILD_UNIT_TESTS)
915 target_include_directories(UnitTests PRIVATE tests/profiling/gatordmock)
916 target_include_directories(UnitTests PRIVATE src/backends/backendsCommon/test)
917 endif()
Colm Donelan366023f2019-09-05 10:03:56 +0100918
Rob Hughes5edefa02020-01-10 09:15:30 +0000919 add_executable_ex(GatordMock tests/profiling/gatordmock/GatordMockMain.cpp)
Finn Williams0c8cb992020-05-07 10:38:15 +0100920
921 target_include_directories(GatordMock PRIVATE profiling/common/include
Jim Flynn27761832022-03-20 21:52:17 +0000922 profiling/client/include
Finn Williams0c8cb992020-05-07 10:38:15 +0100923 profiling/server/src/basePipeServer
Rob Hughesbc873d22020-05-20 13:11:37 +0100924 src/armnnUtils
Finn Williams0c8cb992020-05-07 10:38:15 +0100925 src/profiling
926 src/timelineDecoder)
Colm Donelana21620d2019-10-11 13:09:49 +0100927
Jim Flynn3e9bc192022-03-23 23:01:26 +0000928 target_link_libraries(GatordMock PUBLIC
Finn Williams0c8cb992020-05-07 10:38:15 +0100929 armnn
930 armnnBasePipeServer
931 timelineDecoder
Colm Donelan9a5ce4a2020-10-29 11:39:14 +0000932 gatordMockService)
Colm Donelan366023f2019-09-05 10:03:56 +0100933
Rob Hughes199c98e2019-11-13 11:41:36 +0000934 if(Threads_FOUND AND (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android)))
Jim Flynn3e9bc192022-03-23 23:01:26 +0000935 target_link_libraries(GatordMock PUBLIC ${CMAKE_THREAD_LIBS_INIT})
Rob Hughes199c98e2019-11-13 11:41:36 +0000936 endif()
937
Matteo Martincigh994b5342019-10-11 17:19:56 +0100938endif()
Pavel Macenauer59e057f2020-04-15 14:17:26 +0000939
Derek Lambertieac4adb2020-08-25 13:05:59 +0100940####################################################
941# export targets
942set(armnn_export_targets)
943list(APPEND armnn_export_targets
944 armnn
945 armnnUtils
946)
947
948install(
949 TARGETS ${armnn_export_targets}
950 EXPORT armnn-targets
951 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
952 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
953)
954
955####################################################
956## Set export alias
957set_target_properties(armnn
958 PROPERTIES
959 EXPORT_NAME Armnn
960)
961
962## Export target scrips
963install(
964 EXPORT armnn-targets
965 FILE ArmnnTargets.cmake
966 NAMESPACE Armnn::
Keith Mokc5c40fe2021-01-08 15:25:14 -0800967 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
Derek Lambertieac4adb2020-08-25 13:05:59 +0100968)
969
970####################################################
971## Create ArmnnConfig.cmake
972include(CMakePackageConfigHelpers)
973set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR})
974
975message(STATUS "CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}" )
976message(STATUS "CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}" )
977configure_package_config_file(
978 ${CMAKE_CURRENT_LIST_DIR}/cmake/ArmnnConfig.cmake.in
979 ${CMAKE_CURRENT_BINARY_DIR}/ArmnnConfig.cmake
Keith Mokc5c40fe2021-01-08 15:25:14 -0800980 INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
Derek Lambertieac4adb2020-08-25 13:05:59 +0100981)
982
983####################################################
984## Install Armnn config file
985install(
986 FILES
987 ${CMAKE_CURRENT_BINARY_DIR}/ArmnnConfig.cmake
Keith Mokc5c40fe2021-01-08 15:25:14 -0800988 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
Derek Lambertieac4adb2020-08-25 13:05:59 +0100989)
990
991####################################################
992## Export from build tree
993export(
994 EXPORT armnn-targets
995 FILE ${CMAKE_CURRENT_BINARY_DIR}/ArmnnTargets.cmake
996 NAMESPACE Armnn::
997)
998
Sadik Armagan5d03e312020-11-17 16:43:56 +0000999add_library(Armnn::Armnn ALIAS armnn)
1000add_library(Armnn::armnnUtils ALIAS armnnUtils)
1001
Derek Lambertieac4adb2020-08-25 13:05:59 +01001002####################################################
1003## Build Python bindings
Pavel Macenauer59e057f2020-04-15 14:17:26 +00001004if (BUILD_PYTHON_WHL OR BUILD_PYTHON_SRC)
1005 add_subdirectory(python/pyarmnn)
Keith Mokc712cf62020-12-21 14:28:47 -08001006endif()