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/BackendHelper.hpp
209 include/armnn/BackendId.hpp
210 include/armnn/Conversion.hpp
211 include/armnn/Deprecated.hpp
212 include/armnn/Descriptors.hpp
213 include/armnn/DescriptorsFwd.hpp
214 include/armnn/Exceptions.hpp
215 include/armnn/ILayerSupport.hpp
216 include/armnn/ILayerVisitor.hpp
217 include/armnn/INetwork.hpp
218 include/armnn/IProfiler.hpp
219 include/armnn/IRuntime.hpp
220 include/armnn/LayerSupport.hpp
221 include/armnn/LayerVisitorBase.hpp
222 include/armnn/LstmParams.hpp
223 include/armnn/MemorySources.hpp
224 include/armnn/NetworkFwd.hpp
225 include/armnn/Optional.hpp
226 include/armnn/QuantizedLstmParams.hpp
227 include/armnn/Tensor.hpp
228 include/armnn/TensorFwd.hpp
229 include/armnn/Types.hpp
230 include/armnn/TypesUtils.hpp
231 include/armnn/Utils.hpp
232 include/armnn/Version.hpp
233 src/armnn/layers/LayerCloneBase.hpp
234 src/armnn/layers/LayerWithParameters.hpp
235 src/armnn/layers/AbsLayer.hpp
236 src/armnn/layers/AbsLayer.cpp
237 src/armnn/layers/ActivationLayer.hpp
238 src/armnn/layers/ActivationLayer.cpp
239 src/armnn/layers/AdditionLayer.hpp
240 src/armnn/layers/AdditionLayer.cpp
241 src/armnn/layers/ArgMinMaxLayer.hpp
242 src/armnn/layers/ArgMinMaxLayer.cpp
243 src/armnn/layers/BatchNormalizationLayer.hpp
244 src/armnn/layers/BatchNormalizationLayer.cpp
245 src/armnn/layers/BatchToSpaceNdLayer.hpp
246 src/armnn/layers/BatchToSpaceNdLayer.cpp
247 src/armnn/layers/ConcatLayer.hpp
248 src/armnn/layers/ConcatLayer.cpp
249 src/armnn/layers/ConstantLayer.hpp
250 src/armnn/layers/ConstantLayer.cpp
251 src/armnn/layers/Convolution2dLayer.hpp
252 src/armnn/layers/Convolution2dLayer.cpp
253 src/armnn/layers/ConvertFp16ToFp32Layer.hpp
254 src/armnn/layers/ConvertFp16ToFp32Layer.cpp
255 src/armnn/layers/ConvertFp32ToFp16Layer.hpp
256 src/armnn/layers/ConvertFp32ToFp16Layer.cpp
257 src/armnn/layers/DebugLayer.hpp
258 src/armnn/layers/DebugLayer.cpp
259 src/armnn/layers/DepthToSpaceLayer.hpp
260 src/armnn/layers/DepthToSpaceLayer.cpp
261 src/armnn/layers/DepthwiseConvolution2dLayer.hpp
262 src/armnn/layers/DepthwiseConvolution2dLayer.cpp
263 src/armnn/layers/DequantizeLayer.hpp
264 src/armnn/layers/DequantizeLayer.cpp
265 src/armnn/layers/DetectionPostProcessLayer.hpp
266 src/armnn/layers/DetectionPostProcessLayer.cpp
267 src/armnn/layers/ElementwiseBaseLayer.hpp
268 src/armnn/layers/ElementwiseBaseLayer.cpp
269 src/armnn/layers/EqualLayer.hpp
270 src/armnn/layers/EqualLayer.cpp
271 src/armnn/layers/FakeQuantizationLayer.hpp
272 src/armnn/layers/FakeQuantizationLayer.cpp
273 src/armnn/layers/FloorLayer.hpp
274 src/armnn/layers/FloorLayer.cpp
275 src/armnn/layers/FullyConnectedLayer.hpp
276 src/armnn/layers/FullyConnectedLayer.cpp
277 src/armnn/layers/GatherLayer.cpp
278 src/armnn/layers/GatherLayer.hpp
279 src/armnn/layers/GreaterLayer.cpp
280 src/armnn/layers/GreaterLayer.hpp
281 src/armnn/layers/InputLayer.hpp
282 src/armnn/layers/InputLayer.cpp
283 src/armnn/layers/InstanceNormalizationLayer.hpp
284 src/armnn/layers/InstanceNormalizationLayer.cpp
285 src/armnn/layers/L2NormalizationLayer.hpp
286 src/armnn/layers/L2NormalizationLayer.cpp
287 src/armnn/layers/LstmLayer.cpp
288 src/armnn/layers/LstmLayer.hpp
289 src/armnn/layers/MaximumLayer.cpp
290 src/armnn/layers/MaximumLayer.hpp
291 src/armnn/layers/MeanLayer.hpp
292 src/armnn/layers/MeanLayer.cpp
293 src/armnn/layers/MemCopyLayer.hpp
294 src/armnn/layers/MemCopyLayer.cpp
295 src/armnn/layers/MemImportLayer.hpp
296 src/armnn/layers/MemImportLayer.cpp
297 src/armnn/layers/MergeLayer.hpp
298 src/armnn/layers/MergeLayer.cpp
299 src/armnn/layers/MinimumLayer.cpp
300 src/armnn/layers/MinimumLayer.hpp
301 src/armnn/layers/MultiplicationLayer.hpp
302 src/armnn/layers/MultiplicationLayer.cpp
303 src/armnn/layers/NormalizationLayer.hpp
304 src/armnn/layers/NormalizationLayer.cpp
305 src/armnn/layers/OutputLayer.hpp
306 src/armnn/layers/OutputLayer.cpp
307 src/armnn/layers/PadLayer.hpp
308 src/armnn/layers/PadLayer.cpp
309 src/armnn/layers/PermuteLayer.hpp
310 src/armnn/layers/PermuteLayer.cpp
311 src/armnn/layers/Pooling2dLayer.hpp
312 src/armnn/layers/Pooling2dLayer.cpp
313 src/armnn/layers/QuantizeLayer.cpp
314 src/armnn/layers/QuantizeLayer.hpp
315 src/armnn/layers/QuantizedLstmLayer.hpp
316 src/armnn/layers/QuantizedLstmLayer.cpp
317 src/armnn/layers/DivisionLayer.cpp
318 src/armnn/layers/DivisionLayer.hpp
319 src/armnn/layers/PreCompiledLayer.hpp
320 src/armnn/layers/PreCompiledLayer.cpp
321 src/armnn/layers/PreluLayer.hpp
322 src/armnn/layers/PreluLayer.cpp
323 src/armnn/layers/ReshapeLayer.hpp
324 src/armnn/layers/ReshapeLayer.cpp
325 src/armnn/layers/ResizeLayer.hpp
326 src/armnn/layers/ResizeLayer.cpp
327 src/armnn/layers/RsqrtLayer.cpp
328 src/armnn/layers/RsqrtLayer.hpp
329 src/armnn/layers/SliceLayer.cpp
330 src/armnn/layers/SliceLayer.hpp
331 src/armnn/layers/SoftmaxLayer.hpp
332 src/armnn/layers/SoftmaxLayer.cpp
333 src/armnn/layers/SpaceToBatchNdLayer.hpp
334 src/armnn/layers/SpaceToBatchNdLayer.cpp
335 src/armnn/layers/SpaceToDepthLayer.hpp
336 src/armnn/layers/SpaceToDepthLayer.cpp
337 src/armnn/layers/SplitterLayer.hpp
338 src/armnn/layers/SplitterLayer.cpp
339 src/armnn/layers/StackLayer.hpp
340 src/armnn/layers/StackLayer.cpp
341 src/armnn/layers/StridedSliceLayer.cpp
342 src/armnn/layers/StridedSliceLayer.hpp
343 src/armnn/layers/SubtractionLayer.cpp
344 src/armnn/layers/SubtractionLayer.hpp
345 src/armnn/layers/SwitchLayer.cpp
346 src/armnn/layers/SwitchLayer.hpp
347 src/armnn/layers/TransposeConvolution2dLayer.cpp
348 src/armnn/layers/TransposeConvolution2dLayer.hpp
349 src/armnn/BackendSettings.hpp
350 src/armnn/BackendHelper.cpp
351 src/armnn/CompatibleTypes.hpp
352 src/armnn/Descriptors.cpp
353 src/armnn/DeviceSpec.hpp
354 src/armnn/DynamicQuantizationVisitor.cpp
355 src/armnn/DynamicQuantizationVisitor.hpp
356 src/armnn/Exceptions.cpp
357 src/armnn/ExecutionFrame.cpp
358 src/armnn/ExecutionFrame.hpp
361 src/armnn/IGraphObservable.hpp
362 src/armnn/Instrument.hpp
363 src/armnn/InternalTypes.cpp
364 src/armnn/InternalTypes.hpp
365 src/armnn/ISubgraphViewConverter.hpp
366 src/armnn/JsonPrinter.cpp
367 src/armnn/JsonPrinter.hpp
369 src/armnn/LayerFwd.hpp
371 src/armnn/LayersFwd.hpp
372 src/armnn/LayerSupportCommon.hpp
373 src/armnn/LayerSupport.cpp
374 src/armnn/LoadedNetwork.cpp
375 src/armnn/LoadedNetwork.hpp
376 src/armnn/Network.cpp
377 src/armnn/Network.hpp
378 src/armnn/NetworkQuantizationScheme.hpp
379 src/armnn/NetworkQuantizer.cpp
380 src/armnn/NetworkQuantizer.hpp
381 src/armnn/NetworkQuantizerUtils.cpp
382 src/armnn/NetworkQuantizerUtils.hpp
383 src/armnn/NetworkUtils.cpp
384 src/armnn/NetworkUtils.hpp
385 src/armnn/Observable.cpp
386 src/armnn/Observable.hpp
387 src/armnn/Optimizer.cpp
388 src/armnn/Optimizer.hpp
389 src/armnn/OverrideInputRangeVisitor.cpp
390 src/armnn/OverrideInputRangeVisitor.hpp
391 src/armnn/Profiling.cpp
392 src/armnn/ProfilingEvent.cpp
393 src/armnn/ProfilingEvent.hpp
394 src/armnn/Profiling.hpp
395 src/armnn/QuantizerVisitor.cpp
396 src/armnn/QuantizerVisitor.hpp
397 src/armnn/Runtime.cpp
398 src/armnn/Runtime.hpp
399 src/armnn/RangeTracker.cpp
400 src/armnn/RangeTracker.hpp
401 src/armnn/ResolveType.hpp
402 src/armnn/SerializeLayerParameters.cpp
403 src/armnn/SerializeLayerParameters.hpp
404 src/armnn/StaticRangeVisitor.cpp
405 src/armnn/StaticRangeVisitor.hpp
406 src/armnn/SubgraphView.cpp
407 src/armnn/SubgraphView.hpp
408 src/armnn/SubgraphViewSelector.cpp
409 src/armnn/SubgraphViewSelector.hpp
411 src/armnn/TypesUtils.cpp
413 src/armnn/WallClockTimer.cpp
414 src/armnn/WallClockTimer.hpp
415 src/armnn/optimizations/AddDebug.hpp
416 src/armnn/optimizations/All.hpp
417 src/armnn/optimizations/ConvertConstants.hpp
418 src/armnn/optimizations/ConvertFp32NetworkToFp16.hpp
419 src/armnn/optimizations/FoldPadIntoConvolution2d.hpp
420 src/armnn/optimizations/MovePermuteUp.hpp
421 src/armnn/optimizations/Optimization.hpp
422 src/armnn/optimizations/OptimizeConsecutiveReshapes.hpp
423 src/armnn/optimizations/OptimizeInverseConversions.hpp
424 src/armnn/optimizations/OptimizeInversePermutes.hpp
425 src/armnn/optimizations/PermuteAndBatchToSpaceAsDepthToSpace.hpp
426 src/armnn/optimizations/PermuteAndBatchToSpaceAsDepthToSpace.cpp
427 src/armnn/optimizations/PermuteAsReshape.hpp
428 src/armnn/optimizations/SquashEqualSiblings.hpp
429 src/profiling/BufferManager.cpp
430 src/profiling/BufferManager.hpp
431 src/profiling/CommandHandler.cpp
432 src/profiling/CommandHandler.hpp
433 src/profiling/CommandHandlerFunctor.cpp
434 src/profiling/CommandHandlerFunctor.hpp
435 src/profiling/CommandHandlerKey.cpp
436 src/profiling/CommandHandlerKey.hpp
437 src/profiling/CommandHandlerRegistry.cpp
438 src/profiling/CommandHandlerRegistry.hpp
439 src/profiling/ConnectionAcknowledgedCommandHandler.cpp
440 src/profiling/ConnectionAcknowledgedCommandHandler.hpp
441 src/profiling/CounterDirectory.cpp
442 src/profiling/CounterDirectory.hpp
443 src/profiling/EncodeVersion.hpp
444 src/profiling/Holder.cpp
445 src/profiling/Holder.hpp
446 src/profiling/IBufferManager.hpp
447 src/profiling/ICounterDirectory.hpp
448 src/profiling/ICounterValues.hpp
449 src/profiling/ISendCounterPacket.hpp
450 src/profiling/IPacketBuffer.hpp
451 src/profiling/IPeriodicCounterCapture.hpp
452 src/profiling/IProfilingConnection.hpp
453 src/profiling/Packet.cpp
454 src/profiling/Packet.hpp
455 src/profiling/PacketBuffer.cpp
456 src/profiling/PacketBuffer.hpp
457 src/profiling/PacketVersionResolver.cpp
458 src/profiling/PacketVersionResolver.hpp
459 src/profiling/PeriodicCounterCapture.hpp
460 src/profiling/PeriodicCounterCapture.cpp
461 src/profiling/PeriodicCounterSelectionCommandHandler.cpp
462 src/profiling/PeriodicCounterSelectionCommandHandler.hpp
463 src/profiling/ProfilingConnectionDumpToFileDecorator.cpp
464 src/profiling/ProfilingConnectionDumpToFileDecorator.hpp
465 src/profiling/ProfilingConnectionFactory.cpp
466 src/profiling/ProfilingConnectionFactory.hpp
467 src/profiling/ProfilingService.cpp
468 src/profiling/ProfilingService.hpp
469 src/profiling/ProfilingStateMachine.cpp
470 src/profiling/ProfilingStateMachine.hpp
471 src/profiling/ProfilingUtils.cpp
472 src/profiling/ProfilingUtils.hpp
473 src/profiling/RequestCounterDirectoryCommandHandler.cpp
474 src/profiling/RequestCounterDirectoryCommandHandler.hpp
475 src/profiling/SendCounterPacket.cpp
476 src/profiling/SendCounterPacket.hpp
477 src/profiling/SocketProfilingConnection.cpp
478 src/profiling/SocketProfilingConnection.hpp
479 third-party/half/half.hpp
482 # Files used for Streamline-based profiling backend
483 if(PROFILING_BACKEND_STREAMLINE)
484 list(APPEND armnn_sources
485 ${GATOR_ROOT}/annotate/streamline_annotate.h
486 ${GATOR_ROOT}/annotate/streamline_annotate.c)
489 # the backends under src/backends extend the list of
490 # object libs armnn to include in the build
491 include(src/backends/backends.cmake)
492 foreach(lib ${armnnLibraries})
493 message("Adding object library dependency to armnn: ${lib}")
494 list(APPEND armnn_sources $<TARGET_OBJECTS:${lib}>)
497 add_library_ex(armnn SHARED ${armnn_sources})
499 target_include_directories(armnn PRIVATE src/armnn)
500 target_include_directories(armnn PRIVATE src/armnnUtils)
501 target_include_directories(armnn PRIVATE src/backends)
502 target_include_directories(armnn PRIVATE src/profiling)
504 target_link_libraries(armnn armnnUtils)
506 target_link_libraries(armnn ${CMAKE_DL_LIBS})
508 install(TARGETS armnn
509 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
510 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
511 if(BUILD_CAFFE_PARSER)
512 install(TARGETS armnnCaffeParser
513 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
514 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
516 if(BUILD_ONNX_PARSER)
517 install(TARGETS armnnOnnxParser
518 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
519 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
522 install(TARGETS armnnTfParser
523 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
524 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
527 install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
529 target_link_libraries(armnn ${Boost_LOG_LIBRARY} ${Boost_THREAD_LIBRARY}
530 ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
532 if(ARMCOMPUTENEON OR ARMCOMPUTECL)
533 target_link_libraries(armnn ${ARMCOMPUTE_LIBRARIES})
536 target_link_libraries(armnn ${OPENCL_LIBRARIES})
539 if(PROFILING_BACKEND_STREAMLINE)
540 target_link_libraries(armnn pthread)
544 set(unittest_sources)
545 list(APPEND unittest_sources
546 src/armnn/test/ConstTensorLayerVisitor.hpp
547 src/armnn/test/ConstTensorLayerVisitor.cpp
548 src/armnn/test/CreateWorkload.hpp
549 src/armnn/test/CsvReaderTest.cpp
550 src/armnn/test/EndToEndTest.cpp
551 src/armnn/test/ExecutionFrameTest.cpp
552 src/armnn/test/FloatingPointConverterTest.cpp
553 src/armnn/test/FlowControl.cpp
554 src/armnn/test/GraphTests.cpp
555 src/armnn/test/GraphUtils.cpp
556 src/armnn/test/GraphUtils.hpp
557 src/armnn/test/InstrumentTests.cpp
558 src/armnn/test/InferOutputTests.cpp
559 src/armnn/test/InferOutputTests.hpp
560 src/armnn/test/ModelAccuracyCheckerTest.cpp
561 src/armnn/test/NetworkTests.cpp
562 src/armnn/test/ObservableTest.cpp
563 src/armnn/test/OptimizerTests.cpp
564 src/armnn/test/optimizations/ConvertConstantsFloatToHalfTests.cpp
565 src/armnn/test/optimizations/ConvertConstantsHalfToFloatTests.cpp
566 src/armnn/test/optimizations/Fp32NetworkToFp16ConverterTests.cpp
567 src/armnn/test/optimizations/InsertDebugLayerTests.cpp
568 src/armnn/test/optimizations/MovePermuteUpTests.cpp
569 src/armnn/test/optimizations/OptimizeConsecutiveReshapesTests.cpp
570 src/armnn/test/optimizations/OptimizeInverseConversionsTests.cpp
571 src/armnn/test/optimizations/OptimizeInversePermutesTests.cpp
572 src/armnn/test/optimizations/PermuteAndBatchToSpaceAsDepthToSpaceTests.cpp
573 src/armnn/test/optimizations/PermuteAsReshapeTests.cpp
574 src/armnn/test/optimizations/SquashEqualSiblingsTests.cpp
575 src/armnn/test/OptionalTest.cpp
576 src/armnn/test/ProfilerTests.cpp
577 src/armnn/test/ProfilingEventTest.cpp
578 src/armnn/test/SubgraphViewTests.cpp
579 src/armnn/test/TensorHandleStrategyTest.cpp
580 src/armnn/test/TensorHelpers.hpp
581 src/armnn/test/TensorTest.cpp
582 src/armnn/test/TestInputOutputLayerVisitor.cpp
583 src/armnn/test/TestInputOutputLayerVisitor.hpp
584 src/armnn/test/TestLayerVisitor.cpp
585 src/armnn/test/TestLayerVisitor.hpp
586 src/armnn/test/TestNameOnlyLayerVisitor.cpp
587 src/armnn/test/TestNameOnlyLayerVisitor.hpp
588 src/armnn/test/TestNameAndDescriptorLayerVisitor.hpp
589 src/armnn/test/TestNameAndDescriptorLayerVisitor.cpp
590 src/armnn/test/TestUtils.cpp
591 src/armnn/test/TestUtils.hpp
592 src/armnn/test/UnitTests.cpp
593 src/armnn/test/UnitTests.hpp
594 src/armnn/test/UtilsTests.cpp
595 src/armnnUtils/test/PrototxtConversionsTest.cpp
596 src/armnnUtils/test/ParserHelperTest.cpp
597 src/armnnUtils/test/TensorUtilsTest.cpp
598 src/profiling/test/BufferTests.cpp
599 src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
600 src/profiling/test/ProfilingTests.cpp
601 src/profiling/test/SendCounterPacketTests.cpp
602 src/profiling/test/TimelinePacketTests.cpp
606 list(APPEND unittest_sources
607 src/armnn/test/DebugCallbackTest.cpp
608 src/armnn/test/QuantizerTest.cpp
609 src/armnn/test/RuntimeTests.cpp
610 src/armnn/test/RuntimeTests.hpp
614 if(BUILD_TF_PARSER AND ARMNNREF)
615 list(APPEND unittest_sources
616 src/armnnTfParser/test/Activations.cpp
617 src/armnnTfParser/test/Addition.cpp
618 src/armnnTfParser/test/AddN.cpp
619 src/armnnTfParser/test/Assert.cpp
620 src/armnnTfParser/test/BiasAdd.cpp
621 src/armnnTfParser/test/BroadcastForAdd.cpp
622 src/armnnTfParser/test/Convolution2d.cpp
623 src/armnnTfParser/test/Concat.cpp
624 src/armnnTfParser/test/ConcatOfConcats.cpp
625 src/armnnTfParser/test/DepthwiseConvolution2d.cpp
626 src/armnnTfParser/test/Equal.cpp
627 src/armnnTfParser/test/ExpandDims.cpp
628 src/armnnTfParser/test/FusedBatchNorm.cpp
629 src/armnnTfParser/test/Gather.cpp
630 src/armnnTfParser/test/Greater.cpp
631 src/armnnTfParser/test/Identity.cpp
632 src/armnnTfParser/test/LocalResponseNormalization.cpp
633 src/armnnTfParser/test/Maximum.cpp
634 src/armnnTfParser/test/MaximumForLeakyRelu.cpp
635 src/armnnTfParser/test/Mean.cpp
636 src/armnnTfParser/test/Minimum.cpp
637 src/armnnTfParser/test/Multiplication.cpp
638 src/armnnTfParser/test/Pad.cpp
639 src/armnnTfParser/test/MultiOutput.cpp
640 src/armnnTfParser/test/PassThru.cpp
641 src/armnnTfParser/test/Pooling.cpp
642 src/armnnTfParser/test/RealDiv.cpp
643 src/armnnTfParser/test/Reshape.cpp
644 src/armnnTfParser/test/ResizeBilinear.cpp
645 src/armnnTfParser/test/Rsqrt.cpp
646 src/armnnTfParser/test/Shape.cpp
647 src/armnnTfParser/test/Softmax.cpp
648 src/armnnTfParser/test/TestDependencies.cpp
649 src/armnnTfParser/test/FullyConnected.cpp
650 src/armnnTfParser/test/Constant.cpp
651 src/armnnTfParser/test/TestMultiInputsOutputs.cpp
652 src/armnnTfParser/test/Split.cpp
653 src/armnnTfParser/test/Squeeze.cpp
654 src/armnnTfParser/test/Sub.cpp
659 if(BUILD_TF_LITE_PARSER AND ARMNNREF)
661 list(APPEND unittest_sources
662 src/armnnTfLiteParser/test/Activations.cpp
663 src/armnnTfLiteParser/test/Addition.cpp
664 src/armnnTfLiteParser/test/AvgPool2D.cpp
665 src/armnnTfLiteParser/test/BatchToSpaceND.cpp
666 src/armnnTfLiteParser/test/Concatenation.cpp
667 src/armnnTfLiteParser/test/Constant.cpp
668 src/armnnTfLiteParser/test/Conv2D.cpp
669 src/armnnTfLiteParser/test/DepthwiseConvolution2D.cpp
670 src/armnnTfLiteParser/test/DetectionPostProcess.cpp
671 src/armnnTfLiteParser/test/FullyConnected.cpp
672 src/armnnTfLiteParser/test/L2Normalization.cpp
673 src/armnnTfLiteParser/test/Maximum.cpp
674 src/armnnTfLiteParser/test/MaxPool2D.cpp
675 src/armnnTfLiteParser/test/Mean.cpp
676 src/armnnTfLiteParser/test/Minimum.cpp
677 src/armnnTfLiteParser/test/Multiplication.cpp
678 src/armnnTfLiteParser/test/Pack.cpp
679 src/armnnTfLiteParser/test/Pad.cpp
680 src/armnnTfLiteParser/test/Reshape.cpp
681 src/armnnTfLiteParser/test/ResizeBilinear.cpp
682 src/armnnTfLiteParser/test/Softmax.cpp
683 src/armnnTfLiteParser/test/SpaceToBatchND.cpp
684 src/armnnTfLiteParser/test/Split.cpp
685 src/armnnTfLiteParser/test/Squeeze.cpp
686 src/armnnTfLiteParser/test/StridedSlice.cpp
687 src/armnnTfLiteParser/test/Sub.cpp
688 src/armnnTfLiteParser/test/TransposeConv.cpp
689 src/armnnTfLiteParser/test/Transpose.cpp
690 src/armnnTfLiteParser/test/Unpack.cpp
691 src/armnnTfLiteParser/test/LoadModel.cpp
692 src/armnnTfLiteParser/test/GetBuffer.cpp
693 src/armnnTfLiteParser/test/OutputShapeOfSqueeze.cpp
694 src/armnnTfLiteParser/test/InputOutputTensorNames.cpp
695 src/armnnTfLiteParser/test/GetTensorIds.cpp
696 src/armnnTfLiteParser/test/GetSubgraphInputsOutputs.cpp
697 src/armnnTfLiteParser/test/GetInputsOutputs.cpp
698 src/armnnTfLiteParser/test/Schema.s
700 set_source_files_properties(src/armnnTfLiteParser/test/Schema.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
704 if(BUILD_CAFFE_PARSER AND ARMNNREF)
705 list(APPEND unittest_sources
706 src/armnnCaffeParser/test/TestAdd.cpp
707 src/armnnCaffeParser/test/TestConcat.cpp
708 src/armnnCaffeParser/test/TestConvolution.cpp
709 src/armnnCaffeParser/test/TestDropout.cpp
710 src/armnnCaffeParser/test/TestInputs.cpp
711 src/armnnCaffeParser/test/TestMul.cpp
712 src/armnnCaffeParser/test/TestPooling2d.cpp
713 src/armnnCaffeParser/test/TestInPlace.cpp
714 src/armnnCaffeParser/test/TestMultiInputsOutputs.cpp
715 src/armnnCaffeParser/test/TestSplit.cpp
719 if(BUILD_ONNX_PARSER AND ARMNNREF)
720 list(APPEND unittest_sources
721 src/armnnOnnxParser/test/Constructor.cpp
722 src/armnnOnnxParser/test/CreateNetwork.cpp
723 src/armnnOnnxParser/test/ProtoxtFixture.cpp
724 src/armnnOnnxParser/test/Const.cpp
725 src/armnnOnnxParser/test/Pooling.cpp
726 src/armnnOnnxParser/test/Reshape.cpp
727 src/armnnOnnxParser/test/Relu.cpp
728 src/armnnOnnxParser/test/Conv2D.cpp
729 src/armnnOnnxParser/test/Addition.cpp
730 src/armnnOnnxParser/test/FullyConnected.cpp
731 src/armnnOnnxParser/test/GetInputsOutputs.cpp
732 src/armnnOnnxParser/test/BatchNorm.cpp
733 src/armnnOnnxParser/test/DepthConv.cpp
737 if(BUILD_ARMNN_QUANTIZER AND ARMNNREF)
738 list(APPEND unittest_sources
739 src/armnnQuantizer/test/QuantizationDataSetTests.cpp
743 if(BUILD_ARMNN_SERIALIZER AND ARMNNREF)
745 list(APPEND unittest_sources
746 src/armnnSerializer/test/ActivationSerializationTests.cpp
747 src/armnnSerializer/test/SerializerTests.cpp
748 src/armnnDeserializer/test/DeserializeAbs.cpp
749 src/armnnDeserializer/test/DeserializeActivation.cpp
750 src/armnnDeserializer/test/DeserializeAdd.cpp
751 src/armnnDeserializer/test/DeserializeBatchToSpaceNd.cpp
752 src/armnnDeserializer/test/DeserializeBatchNormalization.cpp
753 src/armnnDeserializer/test/DeserializeConstant.cpp
754 src/armnnDeserializer/test/DeserializeConvolution2d.cpp
755 src/armnnDeserializer/test/DeserializeDepthToSpace.cpp
756 src/armnnDeserializer/test/DeserializeDivision.cpp
757 src/armnnDeserializer/test/DeserializeEqual.cpp
758 src/armnnDeserializer/test/DeserializeFloor.cpp
759 src/armnnDeserializer/test/DeserializeFullyConnected.cpp
760 src/armnnDeserializer/test/DeserializeGather.cpp
761 src/armnnDeserializer/test/DeserializeGreater.cpp
762 src/armnnDeserializer/test/DeserializeL2Normalization.cpp
763 src/armnnDeserializer/test/DeserializeMean.cpp
764 src/armnnDeserializer/test/DeserializeMultiplication.cpp
765 src/armnnDeserializer/test/DeserializeNormalization.cpp
766 src/armnnDeserializer/test/DeserializePad.cpp
767 src/armnnDeserializer/test/DeserializePermute.cpp
768 src/armnnDeserializer/test/DeserializePooling2d.cpp
769 src/armnnDeserializer/test/DeserializeReshape.cpp
770 src/armnnDeserializer/test/DeserializeResizeBilinear.cpp
771 src/armnnDeserializer/test/DeserializeRsqrt.cpp
772 src/armnnDeserializer/test/DeserializeSlice.cpp
773 src/armnnDeserializer/test/DeserializeSpaceToBatchNd.cpp
774 src/armnnDeserializer/test/DeserializeStridedSlice.cpp
775 src/armnnDeserializer/test/DeserializeSubtraction.cpp
776 src/armnnDeserializer/test/ParserFlatbuffersSerializeFixture.hpp
777 src/armnnDeserializer/test/SchemaSerialize.s
779 set_source_files_properties(src/armnnDeserializer/test/SchemaSerialize.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
782 foreach(lib ${armnnUnitTestLibraries})
783 message("Adding object library dependency to UnitTests: ${lib}")
784 list(APPEND unittest_sources $<TARGET_OBJECTS:${lib}>)
787 add_executable(UnitTests ${unittest_sources})
788 target_include_directories(UnitTests PRIVATE src/armnn)
789 target_include_directories(UnitTests PRIVATE src/armnnUtils)
790 target_include_directories(UnitTests PRIVATE src/backends)
791 target_include_directories(UnitTests PRIVATE src/profiling)
794 if(HEAP_PROFILING OR LEAK_CHECKING)
795 message("Valgrind is disabled for heap profiling and leak checking builds.")
797 # Valgrind works with gperftools version number <= 2.4
798 target_compile_definitions(UnitTests PRIVATE "WITH_VALGRIND=1")
802 target_link_libraries(UnitTests ${CMAKE_THREAD_LIBS_INIT})
803 target_link_libraries(UnitTests ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
805 target_link_libraries(UnitTests armnn)
806 target_link_libraries(UnitTests armnnUtils)
809 target_link_libraries(UnitTests armnnTfParser)
812 if(BUILD_TF_LITE_PARSER)
813 target_include_directories(UnitTests SYSTEM PRIVATE "${TF_LITE_SCHEMA_INCLUDE_PATH}")
814 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
815 target_link_libraries(UnitTests armnnTfLiteParser)
818 if(BUILD_CAFFE_PARSER)
819 target_link_libraries(UnitTests armnnCaffeParser)
822 if(BUILD_ARMNN_SERIALIZER AND ARMNNREF)
823 target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnSerializer)
824 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
825 target_link_libraries(UnitTests armnnSerializer)
828 if(BUILD_ARMNN_QUANTIZER AND ARMNNREF)
829 target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnQuantizer)
830 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
831 target_link_libraries(UnitTests armnnQuantizer armnnSerializer)
834 if(BUILD_ONNX_PARSER)
835 target_link_libraries(UnitTests armnnOnnxParser)
838 addDllCopyCommands(UnitTests)
841 if (BUILD_ARMNN_SERIALIZER AND (BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER OR BUILD_CAFFE_PARSER) AND ARMNNREF)
842 set(ArmnnConverter_sources
843 src/armnnConverter/ArmnnConverter.cpp)
845 add_executable_ex(ArmnnConverter ${ArmnnConverter_sources})
846 target_include_directories(ArmnnConverter PRIVATE src/armnn)
847 target_include_directories(ArmnnConverter PRIVATE src/armnnUtils)
849 if(BUILD_CAFFE_PARSER)
850 target_link_libraries(ArmnnConverter armnnCaffeParser)
853 if(BUILD_ONNX_PARSER)
854 target_link_libraries(ArmnnConverter armnnOnnxParser)
858 target_link_libraries(ArmnnConverter armnnTfParser)
861 if(BUILD_TF_LITE_PARSER)
862 target_link_libraries(ArmnnConverter armnnTfLiteParser)
865 target_link_libraries(ArmnnConverter armnnSerializer)
867 target_link_libraries(ArmnnConverter armnn)
868 target_link_libraries(ArmnnConverter ${CMAKE_THREAD_LIBS_INIT})
869 target_link_libraries(ArmnnConverter
870 ${Boost_SYSTEM_LIBRARY}
871 ${Boost_FILESYSTEM_LIBRARY}
872 ${Boost_PROGRAM_OPTIONS_LIBRARY})
873 addDllCopyCommands(ArmnnConverter)
876 if(BUILD_GATORD_MOCK)
877 set(gatord_mock_sources)
878 list(APPEND gatord_mock_sources
879 tests/profiling/GatordMockMain.cpp
880 tests/profiling/CommandLineProcessor.hpp
881 tests/profiling/CommandLineProcessor.cpp
882 tests/profiling/GatordMockService.hpp
883 tests/profiling/GatordMockService.cpp
886 include_directories( ${Boost_INCLUDE_DIRS} )
888 add_executable_ex(GartordMock ${gatord_mock_sources})
890 target_link_libraries(GartordMock
891 ${Boost_PROGRAM_OPTIONS_LIBRARY}