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)
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/EncodeVersion.hpp
421 src/profiling/Packet.cpp
422 src/profiling/Packet.hpp
423 third-party/half/half.hpp
426 # Files used for Streamline-based profiling backend
427 if(PROFILING_BACKEND_STREAMLINE)
428 list(APPEND armnn_sources
429 ${GATOR_ROOT}/annotate/streamline_annotate.h
430 ${GATOR_ROOT}/annotate/streamline_annotate.c)
433 # the backends under src/backends extend the list of
434 # object libs armnn to include in the build
435 include(src/backends/backends.cmake)
436 foreach(lib ${armnnLibraries})
437 message("Adding object library dependency to armnn: ${lib}")
438 list(APPEND armnn_sources $<TARGET_OBJECTS:${lib}>)
441 add_library_ex(armnn SHARED ${armnn_sources})
443 target_include_directories(armnn PRIVATE src/armnn)
444 target_include_directories(armnn PRIVATE src/armnnUtils)
445 target_include_directories(armnn PRIVATE src/backends)
447 target_link_libraries(armnn armnnUtils)
449 target_link_libraries(armnn ${CMAKE_DL_LIBS})
451 install(TARGETS armnn
452 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
453 if(BUILD_CAFFE_PARSER)
454 install(TARGETS armnnCaffeParser
455 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
457 if(BUILD_ONNX_PARSER)
458 install(TARGETS armnnOnnxParser
459 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
462 install(TARGETS armnnTfParser
463 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
466 install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
468 target_link_libraries(armnn ${Boost_LOG_LIBRARY} ${Boost_THREAD_LIBRARY}
469 ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
471 if(ARMCOMPUTENEON OR ARMCOMPUTECL)
472 target_link_libraries(armnn ${ARMCOMPUTE_LIBRARIES})
475 target_link_libraries(armnn ${OPENCL_LIBRARIES})
478 if(PROFILING_BACKEND_STREAMLINE)
479 target_link_libraries(armnn pthread)
483 set(unittest_sources)
484 list(APPEND unittest_sources
485 src/armnn/test/ConstTensorLayerVisitor.hpp
486 src/armnn/test/ConstTensorLayerVisitor.cpp
487 src/armnn/test/CreateWorkload.hpp
488 src/armnn/test/CsvReaderTest.cpp
489 src/armnn/test/DebugCallbackTest.cpp
490 src/armnn/test/EndToEndTest.cpp
491 src/armnn/test/ExecutionFrameTest.cpp
492 src/armnn/test/FloatingPointConverterTest.cpp
493 src/armnn/test/FlowControl.cpp
494 src/armnn/test/GraphTests.cpp
495 src/armnn/test/GraphUtils.cpp
496 src/armnn/test/GraphUtils.hpp
497 src/armnn/test/InstrumentTests.cpp
498 src/armnn/test/InferOutputTests.cpp
499 src/armnn/test/InferOutputTests.hpp
500 src/armnn/test/ModelAccuracyCheckerTest.cpp
501 src/armnn/test/NetworkTests.cpp
502 src/armnn/test/ObservableTest.cpp
503 src/armnn/test/OptimizerTests.cpp
504 src/armnn/test/OptionalTest.cpp
505 src/armnn/test/ProfilerTests.cpp
506 src/armnn/test/ProfilingEventTest.cpp
507 src/armnn/test/QuantizerTest.cpp
508 src/armnn/test/RuntimeTests.cpp
509 src/armnn/test/RuntimeTests.hpp
510 src/armnn/test/SubgraphViewTests.cpp
511 src/armnn/test/TensorHandleStrategyTest.cpp
512 src/armnn/test/TensorHelpers.hpp
513 src/armnn/test/TensorTest.cpp
514 src/armnn/test/TestInputOutputLayerVisitor.cpp
515 src/armnn/test/TestInputOutputLayerVisitor.hpp
516 src/armnn/test/TestLayerVisitor.cpp
517 src/armnn/test/TestLayerVisitor.hpp
518 src/armnn/test/TestNameOnlyLayerVisitor.cpp
519 src/armnn/test/TestNameOnlyLayerVisitor.hpp
520 src/armnn/test/TestNameAndDescriptorLayerVisitor.hpp
521 src/armnn/test/TestNameAndDescriptorLayerVisitor.cpp
522 src/armnn/test/TestUtils.cpp
523 src/armnn/test/TestUtils.hpp
524 src/armnn/test/UnitTests.cpp
525 src/armnn/test/UnitTests.hpp
526 src/armnn/test/UtilsTests.cpp
527 src/armnnUtils/test/PrototxtConversionsTest.cpp
528 src/armnnUtils/test/ParserHelperTest.cpp
529 src/profiling/test/ProfilingTests.cpp
533 list(APPEND unittest_sources
534 src/armnnTfParser/test/Activations.cpp
535 src/armnnTfParser/test/Addition.cpp
536 src/armnnTfParser/test/AddN.cpp
537 src/armnnTfParser/test/Assert.cpp
538 src/armnnTfParser/test/BiasAdd.cpp
539 src/armnnTfParser/test/BroadcastForAdd.cpp
540 src/armnnTfParser/test/Convolution2d.cpp
541 src/armnnTfParser/test/Concat.cpp
542 src/armnnTfParser/test/ConcatOfConcats.cpp
543 src/armnnTfParser/test/DepthwiseConvolution2d.cpp
544 src/armnnTfParser/test/Equal.cpp
545 src/armnnTfParser/test/ExpandDims.cpp
546 src/armnnTfParser/test/FusedBatchNorm.cpp
547 src/armnnTfParser/test/Gather.cpp
548 src/armnnTfParser/test/Greater.cpp
549 src/armnnTfParser/test/Identity.cpp
550 src/armnnTfParser/test/LocalResponseNormalization.cpp
551 src/armnnTfParser/test/Maximum.cpp
552 src/armnnTfParser/test/MaximumForLeakyRelu.cpp
553 src/armnnTfParser/test/Mean.cpp
554 src/armnnTfParser/test/Minimum.cpp
555 src/armnnTfParser/test/Multiplication.cpp
556 src/armnnTfParser/test/Pad.cpp
557 src/armnnTfParser/test/MultiOutput.cpp
558 src/armnnTfParser/test/PassThru.cpp
559 src/armnnTfParser/test/Pooling.cpp
560 src/armnnTfParser/test/RealDiv.cpp
561 src/armnnTfParser/test/Reshape.cpp
562 src/armnnTfParser/test/ResizeBilinear.cpp
563 src/armnnTfParser/test/Rsqrt.cpp
564 src/armnnTfParser/test/Shape.cpp
565 src/armnnTfParser/test/Softmax.cpp
566 src/armnnTfParser/test/TestDependencies.cpp
567 src/armnnTfParser/test/FullyConnected.cpp
568 src/armnnTfParser/test/Constant.cpp
569 src/armnnTfParser/test/TestMultiInputsOutputs.cpp
570 src/armnnTfParser/test/Split.cpp
571 src/armnnTfParser/test/Squeeze.cpp
572 src/armnnTfParser/test/Sub.cpp
576 if(BUILD_TF_LITE_PARSER)
578 list(APPEND unittest_sources
579 src/armnnTfLiteParser/test/ParserFlatbuffersFixture.hpp
580 src/armnnTfLiteParser/test/Activations.cpp
581 src/armnnTfLiteParser/test/Addition.cpp
582 src/armnnTfLiteParser/test/AvgPool2D.cpp
583 src/armnnTfLiteParser/test/BatchToSpaceND.cpp
584 src/armnnTfLiteParser/test/Concatenation.cpp
585 src/armnnTfLiteParser/test/Constant.cpp
586 src/armnnTfLiteParser/test/Conv2D.cpp
587 src/armnnTfLiteParser/test/DepthwiseConvolution2D.cpp
588 src/armnnTfLiteParser/test/DetectionPostProcess.cpp
589 src/armnnTfLiteParser/test/FullyConnected.cpp
590 src/armnnTfLiteParser/test/L2Normalization.cpp
591 src/armnnTfLiteParser/test/Maximum.cpp
592 src/armnnTfLiteParser/test/MaxPool2D.cpp
593 src/armnnTfLiteParser/test/Mean.cpp
594 src/armnnTfLiteParser/test/Minimum.cpp
595 src/armnnTfLiteParser/test/Multiplication.cpp
596 src/armnnTfLiteParser/test/Pack.cpp
597 src/armnnTfLiteParser/test/Pad.cpp
598 src/armnnTfLiteParser/test/Reshape.cpp
599 src/armnnTfLiteParser/test/ResizeBilinear.cpp
600 src/armnnTfLiteParser/test/Softmax.cpp
601 src/armnnTfLiteParser/test/SpaceToBatchND.cpp
602 src/armnnTfLiteParser/test/Split.cpp
603 src/armnnTfLiteParser/test/Squeeze.cpp
604 src/armnnTfLiteParser/test/StridedSlice.cpp
605 src/armnnTfLiteParser/test/Sub.cpp
606 src/armnnTfLiteParser/test/TransposeConv.cpp
607 src/armnnTfLiteParser/test/Unpack.cpp
608 src/armnnTfLiteParser/test/LoadModel.cpp
609 src/armnnTfLiteParser/test/GetBuffer.cpp
610 src/armnnTfLiteParser/test/OutputShapeOfSqueeze.cpp
611 src/armnnTfLiteParser/test/InputOutputTensorNames.cpp
612 src/armnnTfLiteParser/test/GetTensorIds.cpp
613 src/armnnTfLiteParser/test/GetSubgraphInputsOutputs.cpp
614 src/armnnTfLiteParser/test/GetInputsOutputs.cpp
615 src/armnnTfLiteParser/test/Schema.s
617 set_source_files_properties(src/armnnTfLiteParser/test/Schema.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
620 if(BUILD_CAFFE_PARSER)
621 list(APPEND unittest_sources
622 src/armnnCaffeParser/test/TestAdd.cpp
623 src/armnnCaffeParser/test/TestConcat.cpp
624 src/armnnCaffeParser/test/TestConvolution.cpp
625 src/armnnCaffeParser/test/TestDropout.cpp
626 src/armnnCaffeParser/test/TestInputs.cpp
627 src/armnnCaffeParser/test/TestMul.cpp
628 src/armnnCaffeParser/test/TestPooling2d.cpp
629 src/armnnCaffeParser/test/TestInPlace.cpp
630 src/armnnCaffeParser/test/TestMultiInputsOutputs.cpp
631 src/armnnCaffeParser/test/TestSplit.cpp
635 if(BUILD_ARMNN_QUANTIZER)
636 list(APPEND unittest_sources
637 src/armnnQuantizer/test/QuantizationDataSetTests.cpp
641 if(BUILD_ARMNN_SERIALIZER)
643 list(APPEND unittest_sources
644 src/armnnSerializer/test/ActivationSerializationTests.cpp
645 src/armnnSerializer/test/SerializerTests.cpp
646 src/armnnDeserializer/test/DeserializeActivation.cpp
647 src/armnnDeserializer/test/DeserializeAdd.cpp
648 src/armnnDeserializer/test/DeserializeBatchToSpaceNd.cpp
649 src/armnnDeserializer/test/DeserializeBatchNormalization.cpp
650 src/armnnDeserializer/test/DeserializeConstant.cpp
651 src/armnnDeserializer/test/DeserializeConvolution2d.cpp
652 src/armnnDeserializer/test/DeserializeDivision.cpp
653 src/armnnDeserializer/test/DeserializeEqual.cpp
654 src/armnnDeserializer/test/DeserializeFloor.cpp
655 src/armnnDeserializer/test/DeserializeFullyConnected.cpp
656 src/armnnDeserializer/test/DeserializeGather.cpp
657 src/armnnDeserializer/test/DeserializeGreater.cpp
658 src/armnnDeserializer/test/DeserializeL2Normalization.cpp
659 src/armnnDeserializer/test/DeserializeMean.cpp
660 src/armnnDeserializer/test/DeserializeMultiplication.cpp
661 src/armnnDeserializer/test/DeserializeNormalization.cpp
662 src/armnnDeserializer/test/DeserializePad.cpp
663 src/armnnDeserializer/test/DeserializePermute.cpp
664 src/armnnDeserializer/test/DeserializePooling2d.cpp
665 src/armnnDeserializer/test/DeserializeReshape.cpp
666 src/armnnDeserializer/test/DeserializeResizeBilinear.cpp
667 src/armnnDeserializer/test/DeserializeRsqrt.cpp
668 src/armnnDeserializer/test/DeserializeSpaceToBatchNd.cpp
669 src/armnnDeserializer/test/DeserializeStridedSlice.cpp
670 src/armnnDeserializer/test/DeserializeSubtraction.cpp
671 src/armnnDeserializer/test/ParserFlatbuffersSerializeFixture.hpp
672 src/armnnDeserializer/test/SchemaSerialize.s
674 set_source_files_properties(src/armnnDeserializer/test/SchemaSerialize.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
677 if(BUILD_ONNX_PARSER)
678 list(APPEND unittest_sources
679 src/armnnOnnxParser/test/Constructor.cpp
680 src/armnnOnnxParser/test/CreateNetwork.cpp
681 src/armnnOnnxParser/test/ProtoxtFixture.cpp
682 src/armnnOnnxParser/test/Const.cpp
683 src/armnnOnnxParser/test/Pooling.cpp
684 src/armnnOnnxParser/test/Reshape.cpp
685 src/armnnOnnxParser/test/Relu.cpp
686 src/armnnOnnxParser/test/Conv2D.cpp
687 src/armnnOnnxParser/test/Addition.cpp
688 src/armnnOnnxParser/test/FullyConnected.cpp
689 src/armnnOnnxParser/test/GetInputsOutputs.cpp
690 src/armnnOnnxParser/test/BatchNorm.cpp
691 src/armnnOnnxParser/test/DepthConv.cpp
695 foreach(lib ${armnnUnitTestLibraries})
696 message("Adding object library dependency to UnitTests: ${lib}")
697 list(APPEND unittest_sources $<TARGET_OBJECTS:${lib}>)
700 add_executable(UnitTests ${unittest_sources})
701 target_include_directories(UnitTests PRIVATE src/armnn)
702 target_include_directories(UnitTests PRIVATE src/armnnUtils)
703 target_include_directories(UnitTests PRIVATE src/backends)
706 if(HEAP_PROFILING OR LEAK_CHECKING)
707 message("Valgrind is disabled for heap profiling and leak checking builds.")
709 # Valgrind works with gperftools version number <= 2.4
710 target_compile_definitions(UnitTests PRIVATE "WITH_VALGRIND=1")
714 target_link_libraries(UnitTests ${CMAKE_THREAD_LIBS_INIT})
715 target_link_libraries(UnitTests ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
717 target_link_libraries(UnitTests armnn)
718 target_link_libraries(UnitTests armnnUtils)
721 target_link_libraries(UnitTests armnnTfParser)
724 if(BUILD_TF_LITE_PARSER)
725 target_include_directories(UnitTests SYSTEM PRIVATE "${TF_LITE_SCHEMA_INCLUDE_PATH}")
726 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
727 target_link_libraries(UnitTests armnnTfLiteParser)
730 if(BUILD_CAFFE_PARSER)
731 target_link_libraries(UnitTests armnnCaffeParser)
734 if(BUILD_ARMNN_SERIALIZER)
735 target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnSerializer)
736 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
737 target_link_libraries(UnitTests armnnSerializer)
740 if(BUILD_ARMNN_QUANTIZER)
741 target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnQuantizer)
742 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
743 target_link_libraries(UnitTests armnnQuantizer armnnSerializer)
746 if(BUILD_ONNX_PARSER)
747 target_link_libraries(UnitTests armnnOnnxParser)
750 addDllCopyCommands(UnitTests)
753 if (BUILD_ARMNN_SERIALIZER AND (BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER OR BUILD_CAFFE_PARSER))
754 set(ArmnnConverter_sources
755 src/armnnConverter/ArmnnConverter.cpp)
757 add_executable_ex(ArmnnConverter ${ArmnnConverter_sources})
758 target_include_directories(ArmnnConverter PRIVATE src/armnn)
759 target_include_directories(ArmnnConverter PRIVATE src/armnnUtils)
761 if(BUILD_CAFFE_PARSER)
762 target_link_libraries(ArmnnConverter armnnCaffeParser)
765 if(BUILD_ONNX_PARSER)
766 target_link_libraries(ArmnnConverter armnnOnnxParser)
770 target_link_libraries(ArmnnConverter armnnTfParser)
773 if(BUILD_TF_LITE_PARSER)
774 target_link_libraries(ArmnnConverter armnnTfLiteParser)
777 target_link_libraries(ArmnnConverter armnnSerializer)
779 target_link_libraries(ArmnnConverter armnn)
780 target_link_libraries(ArmnnConverter ${CMAKE_THREAD_LIBS_INIT})
781 target_link_libraries(ArmnnConverter
782 ${Boost_SYSTEM_LIBRARY}
783 ${Boost_FILESYSTEM_LIBRARY}
784 ${Boost_PROGRAM_OPTIONS_LIBRARY})
785 addDllCopyCommands(ArmnnConverter)