2 # Copyright © 2017 Arm Ltd. All rights reserved.
3 # SPDX-License-Identifier: MIT
5 cmake_minimum_required (VERSION 3.0.2) # 3.0.2 required for return() statement used in AddDllCopyCommands.cmake
8 set(additional_cmake_files)
9 list(APPEND additional_cmake_files
11 cmake/GlobalConfig.cmake
12 cmake/AddDllCopyCommands.cmake)
14 foreach(cmake_file ${additional_cmake_files})
15 include(${cmake_file})
18 if (DYNAMIC_BACKEND_PATHS)
19 # It's expected to have the format: DYNAMIC_BACKEND_PATHS="PATH_1:PATH_2...:PATH_N"
20 add_definitions('-DDYNAMIC_BACKEND_PATHS="${DYNAMIC_BACKEND_PATHS}"')
23 include(GNUInstallDirs)
25 add_subdirectory(samples)
26 add_subdirectory(src/armnnTfLiteParser)
27 add_subdirectory(src/armnnSerializer)
30 add_subdirectory(tests)
33 # Include the additional cmake files in their own target so that they will appear nicely in IDEs
34 add_custom_target(AdditionalCMakeFiles SOURCES ${additional_cmake_files})
36 set(armnnUtils_sources)
37 list(APPEND armnnUtils_sources
38 src/armnnUtils/GraphTopologicalSort.hpp
39 src/armnnUtils/Half.hpp
40 src/armnnUtils/Logging.hpp
41 src/armnnUtils/Logging.cpp
42 src/armnnUtils/Permute.hpp
43 src/armnnUtils/Permute.cpp
44 src/armnnUtils/DataLayoutIndexed.cpp
45 src/armnnUtils/DataLayoutIndexed.hpp
46 src/armnnUtils/DotSerializer.cpp
47 src/armnnUtils/DotSerializer.hpp
48 src/armnnUtils/HeapProfiling.cpp
49 src/armnnUtils/HeapProfiling.hpp
50 src/armnnUtils/LeakChecking.cpp
51 src/armnnUtils/LeakChecking.hpp
52 src/armnnUtils/ModelAccuracyChecker.cpp
53 src/armnnUtils/ModelAccuracyChecker.hpp
54 src/armnnUtils/CsvReader.cpp
55 src/armnnUtils/CsvReader.hpp
56 src/armnnUtils/FloatingPointConverter.cpp
57 src/armnnUtils/FloatingPointConverter.hpp
58 src/armnnUtils/VerificationHelpers.hpp
59 src/armnnUtils/VerificationHelpers.cpp
60 src/armnnUtils/ParserHelper.hpp
61 src/armnnUtils/ParserHelper.cpp
62 src/armnnUtils/ParserPrototxtFixture.hpp
63 src/armnnUtils/PrototxtConversions.hpp
64 src/armnnUtils/PrototxtConversions.cpp
65 src/armnnUtils/TensorIOUtils.hpp
66 src/armnnUtils/TensorUtils.hpp
67 src/armnnUtils/TensorUtils.cpp
70 add_library_ex(armnnUtils STATIC ${armnnUtils_sources})
71 target_include_directories(armnnUtils PRIVATE src/backends)
73 if(BUILD_CAFFE_PARSER)
74 # ArmNN Parser source files required for all build options
75 set(armnn_caffe_parser_sources)
76 list(APPEND armnn_caffe_parser_sources
77 include/armnnCaffeParser/ICaffeParser.hpp
78 src/armnnCaffeParser/RecordByRecordCaffeParser.hpp
79 src/armnnCaffeParser/RecordByRecordCaffeParser.cpp
80 src/armnnCaffeParser/CaffeParser.hpp
81 src/armnnCaffeParser/CaffeParser.cpp
82 ${CAFFE_GENERATED_SOURCES}/caffe/proto/caffe.pb.cc
84 # The generated Caffe protobuf .cc file is not warning clean and we can't fix them.
85 if(COMPILER_IS_GNU_LIKE)
86 set_source_files_properties(${CAFFE_GENERATED_SOURCES}/caffe/proto/caffe.pb.cc PROPERTIES COMPILE_FLAGS "-Wno-conversion -Wno-sign-conversion")
89 add_library_ex(armnnCaffeParser SHARED ${armnn_caffe_parser_sources})
90 set_target_properties(armnnCaffeParser PROPERTIES COMPILE_FLAGS "${CAFFE_PARSER_ADDITIONAL_COMPILE_FLAGS}")
92 target_include_directories(armnnCaffeParser PRIVATE src/armnnUtils)
94 target_link_libraries(armnnCaffeParser ${Boost_LOG_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY})
96 target_link_libraries(armnnCaffeParser armnn)
97 target_link_libraries(armnnCaffeParser ${PROTOBUF_LIBRARIES})
101 if(BUILD_ONNX_PARSER)
102 set(armnn_onnx_parser_sources)
103 list(APPEND armnn_onnx_parser_sources
104 include/armnnOnnxParser/IOnnxParser.hpp
105 src/armnnOnnxParser/OnnxParser.hpp
106 src/armnnOnnxParser/OnnxParser.cpp
107 ${ONNX_GENERATED_SOURCES}/onnx/onnx.pb.cc
109 # The generated onnx protobuf .cc files are not warning clean and we can't fix them.
110 if(COMPILER_IS_GNU_LIKE)
111 set_source_files_properties(${ONNX_GENERATED_SOURCES}/onnx/onnx.pb.cc PROPERTIES COMPILE_FLAGS "-Wno-conversion -Wno-sign-conversion")
114 add_library_ex(armnnOnnxParser SHARED ${armnn_onnx_parser_sources})
116 target_include_directories(armnnOnnxParser PRIVATE src/armnnUtils)
118 target_link_libraries(armnnOnnxParser armnn)
121 target_link_libraries(armnnOnnxParser ${PROTOBUF_LIBRARIES})
125 set(armnn_tf_parser_sources)
126 list(APPEND armnn_tf_parser_sources
127 include/armnnTfParser/ITfParser.hpp
128 src/armnnTfParser/TfParser.hpp
129 src/armnnTfParser/TfParser.cpp
132 # The generated tensorflow protobuf .cc files are not warning clean and we can't fix them.
133 if(COMPILER_IS_GNU_LIKE)
134 set_source_files_properties(${TF_PROTOBUFS} PROPERTIES COMPILE_FLAGS "-Wno-conversion -Wno-sign-conversion")
137 add_library_ex(armnnTfParser SHARED ${armnn_tf_parser_sources})
139 target_include_directories(armnnTfParser PRIVATE src/armnnUtils)
141 target_link_libraries(armnnTfParser armnn)
143 # Protobuf (use the specific version tensorflow wants)
144 target_link_libraries(armnnTfParser ${PROTOBUF_LIBRARIES})
147 if(BUILD_ARMNN_QUANTIZER AND ARMNNREF)
148 if(NOT BUILD_ARMNN_SERIALIZER)
149 message(ERROR, "In order to build the ArmNN Quantization Tool you must set BUILD_ARMNN_SERIALIZER = YES")
152 set(armnn_quantizer_sources)
153 list(APPEND armnn_quantizer_sources
154 src/armnnQuantizer/QuantizationDataSet.hpp
155 src/armnnQuantizer/QuantizationDataSet.cpp
156 src/armnnQuantizer/QuantizationInput.hpp
157 src/armnnQuantizer/QuantizationInput.cpp
158 src/armnnQuantizer/CommandLineProcessor.hpp
159 src/armnnQuantizer/CommandLineProcessor.cpp
162 add_library_ex(armnnQuantizer SHARED ${armnn_quantizer_sources})
164 target_include_directories(armnnQuantizer PRIVATE include/armnnDeserializer)
165 target_include_directories(armnnQuantizer PRIVATE src/armnnUtils)
166 target_include_directories(armnnQuantizer PRIVATE src/armnn)
168 include_directories(SYSTEM "${FLATBUFFERS_INCLUDE_PATH}")
169 set_target_properties(armnnQuantizer PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
171 target_link_libraries(armnnQuantizer
173 ${Boost_SYSTEM_LIBRARY}
174 ${Boost_PROGRAM_OPTIONS_LIBRARY}
175 ${Boost_FILESYSTEM_LIBRARY}
177 ${Boost_THREAD_LIBRARY} )
179 add_executable_ex(ArmnnQuantizer
180 src/armnnQuantizer/ArmNNQuantizerMain.cpp)
182 target_include_directories(ArmnnQuantizer PRIVATE include/armnnDeserializer)
183 target_include_directories(ArmnnQuantizer PRIVATE src/armnn)
185 target_link_libraries(ArmnnQuantizer
186 ${Boost_SYSTEM_LIBRARY}
187 ${Boost_PROGRAM_OPTIONS_LIBRARY}
188 ${Boost_FILESYSTEM_LIBRARY}
190 ${Boost_THREAD_LIBRARY} )
192 target_link_libraries(ArmnnQuantizer
197 ${FLATBUFFERS_LIBRARY})
199 if(Threads_FOUND AND (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android)))
200 target_link_libraries(ArmnnQuantizer pthread)
206 list(APPEND armnn_sources
207 include/armnn/ArmNN.hpp
208 include/armnn/BackendId.hpp
209 include/armnn/Descriptors.hpp
210 include/armnn/DescriptorsFwd.hpp
211 include/armnn/Exceptions.hpp
212 include/armnn/ILayerSupport.hpp
213 include/armnn/ILayerVisitor.hpp
214 include/armnn/INetwork.hpp
215 include/armnn/IProfiler.hpp
216 include/armnn/IRuntime.hpp
217 include/armnn/LayerSupport.hpp
218 include/armnn/LayerVisitorBase.hpp
219 include/armnn/LstmParams.hpp
220 include/armnn/MemorySources.hpp
221 include/armnn/NetworkFwd.hpp
222 include/armnn/Optional.hpp
223 include/armnn/QuantizedLstmParams.hpp
224 include/armnn/Tensor.hpp
225 include/armnn/TensorFwd.hpp
226 include/armnn/Types.hpp
227 include/armnn/TypesUtils.hpp
228 include/armnn/Utils.hpp
229 include/armnn/Version.hpp
230 src/armnn/layers/LayerCloneBase.hpp
231 src/armnn/layers/LayerWithParameters.hpp
232 src/armnn/layers/ActivationLayer.hpp
233 src/armnn/layers/ActivationLayer.cpp
234 src/armnn/layers/AdditionLayer.hpp
235 src/armnn/layers/AdditionLayer.cpp
236 src/armnn/layers/BatchNormalizationLayer.hpp
237 src/armnn/layers/BatchNormalizationLayer.cpp
238 src/armnn/layers/BatchToSpaceNdLayer.hpp
239 src/armnn/layers/BatchToSpaceNdLayer.cpp
240 src/armnn/layers/ConcatLayer.hpp
241 src/armnn/layers/ConcatLayer.cpp
242 src/armnn/layers/ConstantLayer.hpp
243 src/armnn/layers/ConstantLayer.cpp
244 src/armnn/layers/Convolution2dLayer.hpp
245 src/armnn/layers/Convolution2dLayer.cpp
246 src/armnn/layers/ConvertFp16ToFp32Layer.hpp
247 src/armnn/layers/ConvertFp16ToFp32Layer.cpp
248 src/armnn/layers/ConvertFp32ToFp16Layer.hpp
249 src/armnn/layers/ConvertFp32ToFp16Layer.cpp
250 src/armnn/layers/DebugLayer.hpp
251 src/armnn/layers/DebugLayer.cpp
252 src/armnn/layers/DepthwiseConvolution2dLayer.hpp
253 src/armnn/layers/DepthwiseConvolution2dLayer.cpp
254 src/armnn/layers/DequantizeLayer.hpp
255 src/armnn/layers/DequantizeLayer.cpp
256 src/armnn/layers/DetectionPostProcessLayer.hpp
257 src/armnn/layers/DetectionPostProcessLayer.cpp
258 src/armnn/layers/ElementwiseBaseLayer.hpp
259 src/armnn/layers/ElementwiseBaseLayer.cpp
260 src/armnn/layers/EqualLayer.hpp
261 src/armnn/layers/EqualLayer.cpp
262 src/armnn/layers/FakeQuantizationLayer.hpp
263 src/armnn/layers/FakeQuantizationLayer.cpp
264 src/armnn/layers/FloorLayer.hpp
265 src/armnn/layers/FloorLayer.cpp
266 src/armnn/layers/FullyConnectedLayer.hpp
267 src/armnn/layers/FullyConnectedLayer.cpp
268 src/armnn/layers/GatherLayer.cpp
269 src/armnn/layers/GatherLayer.hpp
270 src/armnn/layers/GreaterLayer.cpp
271 src/armnn/layers/GreaterLayer.hpp
272 src/armnn/layers/InputLayer.hpp
273 src/armnn/layers/InputLayer.cpp
274 src/armnn/layers/L2NormalizationLayer.hpp
275 src/armnn/layers/L2NormalizationLayer.cpp
276 src/armnn/layers/LstmLayer.cpp
277 src/armnn/layers/LstmLayer.hpp
278 src/armnn/layers/MaximumLayer.cpp
279 src/armnn/layers/MaximumLayer.hpp
280 src/armnn/layers/MeanLayer.hpp
281 src/armnn/layers/MeanLayer.cpp
282 src/armnn/layers/MemCopyLayer.hpp
283 src/armnn/layers/MemCopyLayer.cpp
284 src/armnn/layers/MemImportLayer.hpp
285 src/armnn/layers/MemImportLayer.cpp
286 src/armnn/layers/MergeLayer.hpp
287 src/armnn/layers/MergeLayer.cpp
288 src/armnn/layers/MinimumLayer.cpp
289 src/armnn/layers/MinimumLayer.hpp
290 src/armnn/layers/MultiplicationLayer.hpp
291 src/armnn/layers/MultiplicationLayer.cpp
292 src/armnn/layers/NormalizationLayer.hpp
293 src/armnn/layers/NormalizationLayer.cpp
294 src/armnn/layers/OutputLayer.hpp
295 src/armnn/layers/OutputLayer.cpp
296 src/armnn/layers/PadLayer.hpp
297 src/armnn/layers/PadLayer.cpp
298 src/armnn/layers/PermuteLayer.hpp
299 src/armnn/layers/PermuteLayer.cpp
300 src/armnn/layers/Pooling2dLayer.hpp
301 src/armnn/layers/Pooling2dLayer.cpp
302 src/armnn/layers/QuantizeLayer.cpp
303 src/armnn/layers/QuantizeLayer.hpp
304 src/armnn/layers/QuantizedLstmLayer.hpp
305 src/armnn/layers/QuantizedLstmLayer.cpp
306 src/armnn/layers/DivisionLayer.cpp
307 src/armnn/layers/DivisionLayer.hpp
308 src/armnn/layers/PreCompiledLayer.hpp
309 src/armnn/layers/PreCompiledLayer.cpp
310 src/armnn/layers/PreluLayer.hpp
311 src/armnn/layers/PreluLayer.cpp
312 src/armnn/layers/ReshapeLayer.hpp
313 src/armnn/layers/ReshapeLayer.cpp
314 src/armnn/layers/ResizeLayer.hpp
315 src/armnn/layers/ResizeLayer.cpp
316 src/armnn/layers/RsqrtLayer.cpp
317 src/armnn/layers/RsqrtLayer.hpp
318 src/armnn/layers/SoftmaxLayer.hpp
319 src/armnn/layers/SoftmaxLayer.cpp
320 src/armnn/layers/SpaceToBatchNdLayer.hpp
321 src/armnn/layers/SpaceToBatchNdLayer.cpp
322 src/armnn/layers/SpaceToDepthLayer.hpp
323 src/armnn/layers/SpaceToDepthLayer.cpp
324 src/armnn/layers/SplitterLayer.hpp
325 src/armnn/layers/SplitterLayer.cpp
326 src/armnn/layers/StackLayer.hpp
327 src/armnn/layers/StackLayer.cpp
328 src/armnn/layers/StridedSliceLayer.cpp
329 src/armnn/layers/StridedSliceLayer.hpp
330 src/armnn/layers/SubtractionLayer.cpp
331 src/armnn/layers/SubtractionLayer.hpp
332 src/armnn/layers/SwitchLayer.cpp
333 src/armnn/layers/SwitchLayer.hpp
334 src/armnn/layers/TransposeConvolution2dLayer.cpp
335 src/armnn/layers/TransposeConvolution2dLayer.hpp
336 src/armnn/BackendSettings.hpp
337 src/armnn/BackendHelper.cpp
338 src/armnn/CompatibleTypes.hpp
339 src/armnn/Descriptors.cpp
340 src/armnn/DeviceSpec.hpp
341 src/armnn/DynamicQuantizationVisitor.cpp
342 src/armnn/DynamicQuantizationVisitor.hpp
343 src/armnn/Exceptions.cpp
344 src/armnn/ExecutionFrame.cpp
345 src/armnn/ExecutionFrame.hpp
348 src/armnn/IGraphObservable.hpp
349 src/armnn/Instrument.hpp
350 src/armnn/InternalTypes.cpp
351 src/armnn/InternalTypes.hpp
352 src/armnn/ISubgraphViewConverter.hpp
353 src/armnn/JsonPrinter.cpp
354 src/armnn/JsonPrinter.hpp
356 src/armnn/LayerFwd.hpp
358 src/armnn/LayersFwd.hpp
359 src/armnn/LayerSupportCommon.hpp
360 src/armnn/LayerSupport.cpp
361 src/armnn/LoadedNetwork.cpp
362 src/armnn/LoadedNetwork.hpp
363 src/armnn/Network.cpp
364 src/armnn/Network.hpp
365 src/armnn/NetworkQuantizationScheme.hpp
366 src/armnn/NetworkQuantizer.cpp
367 src/armnn/NetworkQuantizer.hpp
368 src/armnn/NetworkQuantizerUtils.cpp
369 src/armnn/NetworkQuantizerUtils.hpp
370 src/armnn/NetworkUtils.cpp
371 src/armnn/NetworkUtils.hpp
372 src/armnn/Observable.cpp
373 src/armnn/Observable.hpp
374 src/armnn/Optimizer.cpp
375 src/armnn/Optimizer.hpp
376 src/armnn/OverrideInputRangeVisitor.cpp
377 src/armnn/OverrideInputRangeVisitor.hpp
378 src/armnn/Profiling.cpp
379 src/armnn/ProfilingEvent.cpp
380 src/armnn/ProfilingEvent.hpp
381 src/armnn/Profiling.hpp
382 src/armnn/QuantizerVisitor.cpp
383 src/armnn/QuantizerVisitor.hpp
384 src/armnn/Runtime.cpp
385 src/armnn/Runtime.hpp
386 src/armnn/RangeTracker.cpp
387 src/armnn/RangeTracker.hpp
388 src/armnn/ResolveType.hpp
389 src/armnn/SerializeLayerParameters.cpp
390 src/armnn/SerializeLayerParameters.hpp
391 src/armnn/StaticRangeVisitor.cpp
392 src/armnn/StaticRangeVisitor.hpp
393 src/armnn/SubgraphView.cpp
394 src/armnn/SubgraphView.hpp
395 src/armnn/SubgraphViewSelector.cpp
396 src/armnn/SubgraphViewSelector.hpp
398 src/armnn/TypesUtils.cpp
400 src/armnn/WallClockTimer.cpp
401 src/armnn/WallClockTimer.hpp
402 src/armnn/optimizations/AddDebug.hpp
403 src/armnn/optimizations/All.hpp
404 src/armnn/optimizations/ConvertConstants.hpp
405 src/armnn/optimizations/ConvertFp32NetworkToFp16.hpp
406 src/armnn/optimizations/FoldPadIntoConvolution2d.hpp
407 src/armnn/optimizations/MovePermuteUp.hpp
408 src/armnn/optimizations/Optimization.hpp
409 src/armnn/optimizations/OptimizeConsecutiveReshapes.hpp
410 src/armnn/optimizations/OptimizeInverseConversions.hpp
411 src/armnn/optimizations/OptimizeInversePermutes.hpp
412 src/armnn/optimizations/PermuteAsReshape.hpp
413 src/armnn/optimizations/SquashEqualSiblings.hpp
414 src/profiling/CommandHandlerFunctor.cpp
415 src/profiling/CommandHandlerFunctor.hpp
416 src/profiling/CommandHandlerKey.cpp
417 src/profiling/CommandHandlerKey.hpp
418 src/profiling/CommandHandlerRegistry.cpp
419 src/profiling/CommandHandlerRegistry.hpp
420 src/profiling/CounterDirectory.cpp
421 src/profiling/CounterDirectory.hpp
422 src/profiling/EncodeVersion.hpp
423 src/profiling/IProfilingConnection.hpp
424 src/profiling/Packet.cpp
425 src/profiling/Packet.hpp
426 src/profiling/PacketVersionResolver.cpp
427 src/profiling/PacketVersionResolver.hpp
428 src/profiling/ProfilingConnectionFactory.cpp
429 src/profiling/ProfilingConnectionFactory.hpp
430 src/profiling/IBufferWrapper.hpp
431 src/profiling/ISendCounterPacket.hpp
432 src/profiling/SendCounterPacket.hpp
433 src/profiling/SendCounterPacket.cpp
434 src/profiling/ProfilingUtils.hpp
435 src/profiling/ProfilingUtils.cpp
436 third-party/half/half.hpp
439 # Files used for Streamline-based profiling backend
440 if(PROFILING_BACKEND_STREAMLINE)
441 list(APPEND armnn_sources
442 ${GATOR_ROOT}/annotate/streamline_annotate.h
443 ${GATOR_ROOT}/annotate/streamline_annotate.c)
446 # the backends under src/backends extend the list of
447 # object libs armnn to include in the build
448 include(src/backends/backends.cmake)
449 foreach(lib ${armnnLibraries})
450 message("Adding object library dependency to armnn: ${lib}")
451 list(APPEND armnn_sources $<TARGET_OBJECTS:${lib}>)
454 add_library_ex(armnn SHARED ${armnn_sources})
456 target_include_directories(armnn PRIVATE src/armnn)
457 target_include_directories(armnn PRIVATE src/armnnUtils)
458 target_include_directories(armnn PRIVATE src/backends)
460 target_link_libraries(armnn armnnUtils)
462 target_link_libraries(armnn ${CMAKE_DL_LIBS})
464 install(TARGETS armnn
465 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
466 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
467 if(BUILD_CAFFE_PARSER)
468 install(TARGETS armnnCaffeParser
469 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
470 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
472 if(BUILD_ONNX_PARSER)
473 install(TARGETS armnnOnnxParser
474 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
475 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
478 install(TARGETS armnnTfParser
479 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
480 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
483 install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
485 target_link_libraries(armnn ${Boost_LOG_LIBRARY} ${Boost_THREAD_LIBRARY}
486 ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
488 if(ARMCOMPUTENEON OR ARMCOMPUTECL)
489 target_link_libraries(armnn ${ARMCOMPUTE_LIBRARIES})
492 target_link_libraries(armnn ${OPENCL_LIBRARIES})
495 if(PROFILING_BACKEND_STREAMLINE)
496 target_link_libraries(armnn pthread)
500 set(unittest_sources)
501 list(APPEND unittest_sources
502 src/armnn/test/ConstTensorLayerVisitor.hpp
503 src/armnn/test/ConstTensorLayerVisitor.cpp
504 src/armnn/test/CreateWorkload.hpp
505 src/armnn/test/CsvReaderTest.cpp
506 src/armnn/test/EndToEndTest.cpp
507 src/armnn/test/ExecutionFrameTest.cpp
508 src/armnn/test/FloatingPointConverterTest.cpp
509 src/armnn/test/FlowControl.cpp
510 src/armnn/test/GraphTests.cpp
511 src/armnn/test/GraphUtils.cpp
512 src/armnn/test/GraphUtils.hpp
513 src/armnn/test/InstrumentTests.cpp
514 src/armnn/test/InferOutputTests.cpp
515 src/armnn/test/InferOutputTests.hpp
516 src/armnn/test/ModelAccuracyCheckerTest.cpp
517 src/armnn/test/NetworkTests.cpp
518 src/armnn/test/ObservableTest.cpp
519 src/armnn/test/OptimizerTests.cpp
520 src/armnn/test/OptionalTest.cpp
521 src/armnn/test/ProfilerTests.cpp
522 src/armnn/test/ProfilingEventTest.cpp
523 src/armnn/test/SubgraphViewTests.cpp
524 src/armnn/test/TensorHandleStrategyTest.cpp
525 src/armnn/test/TensorHelpers.hpp
526 src/armnn/test/TensorTest.cpp
527 src/armnn/test/TestInputOutputLayerVisitor.cpp
528 src/armnn/test/TestInputOutputLayerVisitor.hpp
529 src/armnn/test/TestLayerVisitor.cpp
530 src/armnn/test/TestLayerVisitor.hpp
531 src/armnn/test/TestNameOnlyLayerVisitor.cpp
532 src/armnn/test/TestNameOnlyLayerVisitor.hpp
533 src/armnn/test/TestNameAndDescriptorLayerVisitor.hpp
534 src/armnn/test/TestNameAndDescriptorLayerVisitor.cpp
535 src/armnn/test/TestUtils.cpp
536 src/armnn/test/TestUtils.hpp
537 src/armnn/test/UnitTests.cpp
538 src/armnn/test/UnitTests.hpp
539 src/armnn/test/UtilsTests.cpp
540 src/armnnUtils/test/PrototxtConversionsTest.cpp
541 src/armnnUtils/test/ParserHelperTest.cpp
542 src/profiling/test/ProfilingTests.cpp
543 src/profiling/test/SendCounterPacketTests.cpp
547 list(APPEND unittest_sources
548 src/armnn/test/DebugCallbackTest.cpp
549 src/armnn/test/QuantizerTest.cpp
550 src/armnn/test/RuntimeTests.cpp
551 src/armnn/test/RuntimeTests.hpp
555 if(BUILD_TF_PARSER AND ARMNNREF)
556 list(APPEND unittest_sources
557 src/armnnTfParser/test/Activations.cpp
558 src/armnnTfParser/test/Addition.cpp
559 src/armnnTfParser/test/AddN.cpp
560 src/armnnTfParser/test/Assert.cpp
561 src/armnnTfParser/test/BiasAdd.cpp
562 src/armnnTfParser/test/BroadcastForAdd.cpp
563 src/armnnTfParser/test/Convolution2d.cpp
564 src/armnnTfParser/test/Concat.cpp
565 src/armnnTfParser/test/ConcatOfConcats.cpp
566 src/armnnTfParser/test/DepthwiseConvolution2d.cpp
567 src/armnnTfParser/test/Equal.cpp
568 src/armnnTfParser/test/ExpandDims.cpp
569 src/armnnTfParser/test/FusedBatchNorm.cpp
570 src/armnnTfParser/test/Gather.cpp
571 src/armnnTfParser/test/Greater.cpp
572 src/armnnTfParser/test/Identity.cpp
573 src/armnnTfParser/test/LocalResponseNormalization.cpp
574 src/armnnTfParser/test/Maximum.cpp
575 src/armnnTfParser/test/MaximumForLeakyRelu.cpp
576 src/armnnTfParser/test/Mean.cpp
577 src/armnnTfParser/test/Minimum.cpp
578 src/armnnTfParser/test/Multiplication.cpp
579 src/armnnTfParser/test/Pad.cpp
580 src/armnnTfParser/test/MultiOutput.cpp
581 src/armnnTfParser/test/PassThru.cpp
582 src/armnnTfParser/test/Pooling.cpp
583 src/armnnTfParser/test/RealDiv.cpp
584 src/armnnTfParser/test/Reshape.cpp
585 src/armnnTfParser/test/ResizeBilinear.cpp
586 src/armnnTfParser/test/Rsqrt.cpp
587 src/armnnTfParser/test/Shape.cpp
588 src/armnnTfParser/test/Softmax.cpp
589 src/armnnTfParser/test/TestDependencies.cpp
590 src/armnnTfParser/test/FullyConnected.cpp
591 src/armnnTfParser/test/Constant.cpp
592 src/armnnTfParser/test/TestMultiInputsOutputs.cpp
593 src/armnnTfParser/test/Split.cpp
594 src/armnnTfParser/test/Squeeze.cpp
595 src/armnnTfParser/test/Sub.cpp
600 if(BUILD_TF_LITE_PARSER AND ARMNNREF)
602 list(APPEND unittest_sources
603 src/armnnTfLiteParser/test/Activations.cpp
604 src/armnnTfLiteParser/test/Addition.cpp
605 src/armnnTfLiteParser/test/AvgPool2D.cpp
606 src/armnnTfLiteParser/test/BatchToSpaceND.cpp
607 src/armnnTfLiteParser/test/Concatenation.cpp
608 src/armnnTfLiteParser/test/Constant.cpp
609 src/armnnTfLiteParser/test/Conv2D.cpp
610 src/armnnTfLiteParser/test/DepthwiseConvolution2D.cpp
611 src/armnnTfLiteParser/test/DetectionPostProcess.cpp
612 src/armnnTfLiteParser/test/FullyConnected.cpp
613 src/armnnTfLiteParser/test/L2Normalization.cpp
614 src/armnnTfLiteParser/test/Maximum.cpp
615 src/armnnTfLiteParser/test/MaxPool2D.cpp
616 src/armnnTfLiteParser/test/Mean.cpp
617 src/armnnTfLiteParser/test/Minimum.cpp
618 src/armnnTfLiteParser/test/Multiplication.cpp
619 src/armnnTfLiteParser/test/Pack.cpp
620 src/armnnTfLiteParser/test/Pad.cpp
621 src/armnnTfLiteParser/test/Reshape.cpp
622 src/armnnTfLiteParser/test/ResizeBilinear.cpp
623 src/armnnTfLiteParser/test/Softmax.cpp
624 src/armnnTfLiteParser/test/SpaceToBatchND.cpp
625 src/armnnTfLiteParser/test/Split.cpp
626 src/armnnTfLiteParser/test/Squeeze.cpp
627 src/armnnTfLiteParser/test/StridedSlice.cpp
628 src/armnnTfLiteParser/test/Sub.cpp
629 src/armnnTfLiteParser/test/TransposeConv.cpp
630 src/armnnTfLiteParser/test/Unpack.cpp
631 src/armnnTfLiteParser/test/LoadModel.cpp
632 src/armnnTfLiteParser/test/GetBuffer.cpp
633 src/armnnTfLiteParser/test/OutputShapeOfSqueeze.cpp
634 src/armnnTfLiteParser/test/InputOutputTensorNames.cpp
635 src/armnnTfLiteParser/test/GetTensorIds.cpp
636 src/armnnTfLiteParser/test/GetSubgraphInputsOutputs.cpp
637 src/armnnTfLiteParser/test/GetInputsOutputs.cpp
638 src/armnnTfLiteParser/test/Schema.s
640 set_source_files_properties(src/armnnTfLiteParser/test/Schema.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
644 if(BUILD_CAFFE_PARSER AND ARMNNREF)
645 list(APPEND unittest_sources
646 src/armnnCaffeParser/test/TestAdd.cpp
647 src/armnnCaffeParser/test/TestConcat.cpp
648 src/armnnCaffeParser/test/TestConvolution.cpp
649 src/armnnCaffeParser/test/TestDropout.cpp
650 src/armnnCaffeParser/test/TestInputs.cpp
651 src/armnnCaffeParser/test/TestMul.cpp
652 src/armnnCaffeParser/test/TestPooling2d.cpp
653 src/armnnCaffeParser/test/TestInPlace.cpp
654 src/armnnCaffeParser/test/TestMultiInputsOutputs.cpp
655 src/armnnCaffeParser/test/TestSplit.cpp
659 if(BUILD_ONNX_PARSER AND ARMNNREF)
660 list(APPEND unittest_sources
661 src/armnnOnnxParser/test/Constructor.cpp
662 src/armnnOnnxParser/test/CreateNetwork.cpp
663 src/armnnOnnxParser/test/ProtoxtFixture.cpp
664 src/armnnOnnxParser/test/Const.cpp
665 src/armnnOnnxParser/test/Pooling.cpp
666 src/armnnOnnxParser/test/Reshape.cpp
667 src/armnnOnnxParser/test/Relu.cpp
668 src/armnnOnnxParser/test/Conv2D.cpp
669 src/armnnOnnxParser/test/Addition.cpp
670 src/armnnOnnxParser/test/FullyConnected.cpp
671 src/armnnOnnxParser/test/GetInputsOutputs.cpp
672 src/armnnOnnxParser/test/BatchNorm.cpp
673 src/armnnOnnxParser/test/DepthConv.cpp
677 if(BUILD_ARMNN_QUANTIZER AND ARMNNREF)
678 list(APPEND unittest_sources
679 src/armnnQuantizer/test/QuantizationDataSetTests.cpp
683 if(BUILD_ARMNN_SERIALIZER AND ARMNNREF)
685 list(APPEND unittest_sources
686 src/armnnSerializer/test/ActivationSerializationTests.cpp
687 src/armnnSerializer/test/SerializerTests.cpp
688 src/armnnDeserializer/test/DeserializeActivation.cpp
689 src/armnnDeserializer/test/DeserializeAdd.cpp
690 src/armnnDeserializer/test/DeserializeBatchToSpaceNd.cpp
691 src/armnnDeserializer/test/DeserializeBatchNormalization.cpp
692 src/armnnDeserializer/test/DeserializeConstant.cpp
693 src/armnnDeserializer/test/DeserializeConvolution2d.cpp
694 src/armnnDeserializer/test/DeserializeDivision.cpp
695 src/armnnDeserializer/test/DeserializeEqual.cpp
696 src/armnnDeserializer/test/DeserializeFloor.cpp
697 src/armnnDeserializer/test/DeserializeFullyConnected.cpp
698 src/armnnDeserializer/test/DeserializeGather.cpp
699 src/armnnDeserializer/test/DeserializeGreater.cpp
700 src/armnnDeserializer/test/DeserializeL2Normalization.cpp
701 src/armnnDeserializer/test/DeserializeMean.cpp
702 src/armnnDeserializer/test/DeserializeMultiplication.cpp
703 src/armnnDeserializer/test/DeserializeNormalization.cpp
704 src/armnnDeserializer/test/DeserializePad.cpp
705 src/armnnDeserializer/test/DeserializePermute.cpp
706 src/armnnDeserializer/test/DeserializePooling2d.cpp
707 src/armnnDeserializer/test/DeserializeReshape.cpp
708 src/armnnDeserializer/test/DeserializeResizeBilinear.cpp
709 src/armnnDeserializer/test/DeserializeRsqrt.cpp
710 src/armnnDeserializer/test/DeserializeSpaceToBatchNd.cpp
711 src/armnnDeserializer/test/DeserializeStridedSlice.cpp
712 src/armnnDeserializer/test/DeserializeSubtraction.cpp
713 src/armnnDeserializer/test/ParserFlatbuffersSerializeFixture.hpp
714 src/armnnDeserializer/test/SchemaSerialize.s
716 set_source_files_properties(src/armnnDeserializer/test/SchemaSerialize.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
719 foreach(lib ${armnnUnitTestLibraries})
720 message("Adding object library dependency to UnitTests: ${lib}")
721 list(APPEND unittest_sources $<TARGET_OBJECTS:${lib}>)
724 add_executable(UnitTests ${unittest_sources})
725 target_include_directories(UnitTests PRIVATE src/armnn)
726 target_include_directories(UnitTests PRIVATE src/armnnUtils)
727 target_include_directories(UnitTests PRIVATE src/backends)
730 if(HEAP_PROFILING OR LEAK_CHECKING)
731 message("Valgrind is disabled for heap profiling and leak checking builds.")
733 # Valgrind works with gperftools version number <= 2.4
734 target_compile_definitions(UnitTests PRIVATE "WITH_VALGRIND=1")
738 target_link_libraries(UnitTests ${CMAKE_THREAD_LIBS_INIT})
739 target_link_libraries(UnitTests ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
741 target_link_libraries(UnitTests armnn)
742 target_link_libraries(UnitTests armnnUtils)
745 target_link_libraries(UnitTests armnnTfParser)
748 if(BUILD_TF_LITE_PARSER)
749 target_include_directories(UnitTests SYSTEM PRIVATE "${TF_LITE_SCHEMA_INCLUDE_PATH}")
750 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
751 target_link_libraries(UnitTests armnnTfLiteParser)
754 if(BUILD_CAFFE_PARSER)
755 target_link_libraries(UnitTests armnnCaffeParser)
758 if(BUILD_ARMNN_SERIALIZER AND ARMNNREF)
759 target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnSerializer)
760 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
761 target_link_libraries(UnitTests armnnSerializer)
764 if(BUILD_ARMNN_QUANTIZER AND ARMNNREF)
765 target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnQuantizer)
766 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
767 target_link_libraries(UnitTests armnnQuantizer armnnSerializer)
770 if(BUILD_ONNX_PARSER)
771 target_link_libraries(UnitTests armnnOnnxParser)
774 addDllCopyCommands(UnitTests)
777 if (BUILD_ARMNN_SERIALIZER AND (BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER OR BUILD_CAFFE_PARSER) AND ARMNNREF)
778 set(ArmnnConverter_sources
779 src/armnnConverter/ArmnnConverter.cpp)
781 add_executable_ex(ArmnnConverter ${ArmnnConverter_sources})
782 target_include_directories(ArmnnConverter PRIVATE src/armnn)
783 target_include_directories(ArmnnConverter PRIVATE src/armnnUtils)
785 if(BUILD_CAFFE_PARSER)
786 target_link_libraries(ArmnnConverter armnnCaffeParser)
789 if(BUILD_ONNX_PARSER)
790 target_link_libraries(ArmnnConverter armnnOnnxParser)
794 target_link_libraries(ArmnnConverter armnnTfParser)
797 if(BUILD_TF_LITE_PARSER)
798 target_link_libraries(ArmnnConverter armnnTfLiteParser)
801 target_link_libraries(ArmnnConverter armnnSerializer)
803 target_link_libraries(ArmnnConverter armnn)
804 target_link_libraries(ArmnnConverter ${CMAKE_THREAD_LIBS_INIT})
805 target_link_libraries(ArmnnConverter
806 ${Boost_SYSTEM_LIBRARY}
807 ${Boost_FILESYSTEM_LIBRARY}
808 ${Boost_PROGRAM_OPTIONS_LIBRARY})
809 addDllCopyCommands(ArmnnConverter)