Update ACL pin to b70770ee65ccce71a74e73df55fcaeac3cb9d0d7
[platform/upstream/armnn.git] / CMakeLists.txt
1 #
2 # Copyright © 2017 Arm Ltd. All rights reserved.
3 # SPDX-License-Identifier: MIT
4 #
5 cmake_minimum_required (VERSION 3.0.2) # 3.0.2 required for return() statement used in AddDllCopyCommands.cmake
6 project(armnn)
7
8 set(additional_cmake_files)
9 list(APPEND additional_cmake_files
10     cmake/ArmnnVersion.cmake
11     cmake/Utils.cmake
12     cmake/GlobalConfig.cmake
13     cmake/AddDllCopyCommands.cmake)
14
15 foreach(cmake_file ${additional_cmake_files})
16     include(${cmake_file})
17 endforeach()
18
19 if (DYNAMIC_BACKEND_PATHS)
20     # It's expected to have the format: DYNAMIC_BACKEND_PATHS="PATH_1:PATH_2...:PATH_N"
21     add_definitions('-DDYNAMIC_BACKEND_PATHS="${DYNAMIC_BACKEND_PATHS}"')
22 endif()
23
24 include(GNUInstallDirs)
25
26 add_subdirectory(samples)
27 add_subdirectory(src/armnnTfLiteParser)
28 add_subdirectory(src/armnnSerializer)
29
30 if (BUILD_TESTS)
31     add_subdirectory(tests)
32 endif()
33
34 # Include the additional cmake files in their own target so that they will appear nicely in IDEs
35 add_custom_target(AdditionalCMakeFiles SOURCES ${additional_cmake_files})
36
37 set(armnnUtils_sources)
38 list(APPEND armnnUtils_sources
39     include/armnnUtils/DataLayoutIndexed.hpp
40     include/armnnUtils/Permute.hpp
41     include/armnnUtils/FloatingPointConverter.hpp
42     include/armnnUtils/TensorUtils.hpp
43     include/armnnUtils/Transpose.hpp
44     src/armnnUtils/BFloat16.hpp
45     src/armnnUtils/Filesystem.hpp
46     src/armnnUtils/Filesystem.cpp
47     src/armnnUtils/Processes.hpp
48     src/armnnUtils/Processes.cpp
49     src/armnnUtils/GraphTopologicalSort.hpp
50     src/armnnUtils/Half.hpp
51     src/armnnUtils/Permute.cpp
52     src/armnnUtils/DataLayoutIndexed.cpp
53     src/armnnUtils/DotSerializer.cpp
54     src/armnnUtils/DotSerializer.hpp
55     src/armnnUtils/HeapProfiling.cpp
56     src/armnnUtils/HeapProfiling.hpp
57     src/armnnUtils/LeakChecking.cpp
58     src/armnnUtils/LeakChecking.hpp
59     src/armnnUtils/ModelAccuracyChecker.cpp
60     src/armnnUtils/ModelAccuracyChecker.hpp
61     src/armnnUtils/CsvReader.cpp
62     src/armnnUtils/CsvReader.hpp
63     src/armnnUtils/FloatingPointConverter.cpp
64     src/armnnUtils/VerificationHelpers.hpp
65     src/armnnUtils/VerificationHelpers.cpp
66     src/armnnUtils/ParserHelper.hpp
67     src/armnnUtils/ParserHelper.cpp
68     src/armnnUtils/ParserPrototxtFixture.hpp
69     src/armnnUtils/PrototxtConversions.hpp
70     src/armnnUtils/PrototxtConversions.cpp
71     src/armnnUtils/QuantizeHelper.hpp
72     src/armnnUtils/TensorIOUtils.hpp
73     src/armnnUtils/TensorUtils.cpp
74     src/armnnUtils/Transpose.cpp
75     src/armnnUtils/NetworkSockets.hpp
76     src/armnnUtils/NetworkSockets.cpp
77     )
78
79 add_library_ex(armnnUtils STATIC ${armnnUtils_sources})
80 target_include_directories(armnnUtils PRIVATE src/backends)
81
82 if(BUILD_CAFFE_PARSER)
83     # ArmNN Parser source files required for all build options
84     set(armnn_caffe_parser_sources)
85     list(APPEND armnn_caffe_parser_sources
86         include/armnnCaffeParser/ICaffeParser.hpp
87         src/armnnCaffeParser/RecordByRecordCaffeParser.hpp
88         src/armnnCaffeParser/RecordByRecordCaffeParser.cpp
89         src/armnnCaffeParser/CaffeParser.hpp
90         src/armnnCaffeParser/CaffeParser.cpp
91         ${CAFFE_GENERATED_SOURCES}/caffe/proto/caffe.pb.cc
92         )
93     # The generated Caffe protobuf .cc file is not warning clean and we can't fix them.
94     if(COMPILER_IS_GNU_LIKE)
95         set_source_files_properties(${CAFFE_GENERATED_SOURCES}/caffe/proto/caffe.pb.cc PROPERTIES COMPILE_FLAGS "-Wno-unused-variable -Wno-unused-parameter -Wno-conversion -Wno-sign-conversion")
96     endif()
97
98     add_library_ex(armnnCaffeParser SHARED ${armnn_caffe_parser_sources})
99     set_target_properties(armnnCaffeParser PROPERTIES COMPILE_FLAGS "${CAFFE_PARSER_ADDITIONAL_COMPILE_FLAGS}")
100
101     target_include_directories(armnnCaffeParser PRIVATE src/armnnUtils)
102
103     target_link_libraries(armnnCaffeParser ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY})
104
105     target_link_libraries(armnnCaffeParser armnn)
106     target_link_libraries(armnnCaffeParser ${PROTOBUF_LIBRARIES})
107     set_target_properties(armnnCaffeParser PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
108
109 endif()
110
111 if(BUILD_ONNX_PARSER)
112     set(armnn_onnx_parser_sources)
113     list(APPEND armnn_onnx_parser_sources
114         include/armnnOnnxParser/IOnnxParser.hpp
115         src/armnnOnnxParser/OnnxParser.hpp
116         src/armnnOnnxParser/OnnxParser.cpp
117         ${ONNX_GENERATED_SOURCES}/onnx/onnx.pb.cc
118         )
119     # The generated onnx protobuf .cc files are not warning clean and we can't fix them.
120     if(COMPILER_IS_GNU_LIKE)
121         set_source_files_properties(${ONNX_GENERATED_SOURCES}/onnx/onnx.pb.cc PROPERTIES COMPILE_FLAGS "-Wno-conversion -Wno-sign-conversion")
122     endif()
123
124     add_library_ex(armnnOnnxParser SHARED ${armnn_onnx_parser_sources})
125
126     target_include_directories(armnnOnnxParser PRIVATE src/armnnUtils)
127
128     target_link_libraries(armnnOnnxParser armnn)
129
130     # Protobuf
131     target_link_libraries(armnnOnnxParser ${PROTOBUF_LIBRARIES})
132     set_target_properties(armnnOnnxParser PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
133 endif()
134
135 if(BUILD_TF_PARSER)
136     set(armnn_tf_parser_sources)
137     list(APPEND armnn_tf_parser_sources
138         include/armnnTfParser/ITfParser.hpp
139         src/armnnTfParser/TfParser.hpp
140         src/armnnTfParser/TfParser.cpp
141         ${TF_PROTOBUFS}
142         )
143     # The generated tensorflow protobuf .cc files are not warning clean and we can't fix them.
144     if(COMPILER_IS_GNU_LIKE)
145         set_source_files_properties(${TF_PROTOBUFS} PROPERTIES COMPILE_FLAGS "-Wno-unused-variable -Wno-unused-parameter -Wno-conversion -Wno-sign-conversion")
146     endif()
147
148     add_library_ex(armnnTfParser SHARED ${armnn_tf_parser_sources})
149
150     target_include_directories(armnnTfParser PRIVATE src/armnnUtils)
151
152     target_link_libraries(armnnTfParser armnn)
153
154     # Protobuf (use the specific version tensorflow wants)
155     target_link_libraries(armnnTfParser ${PROTOBUF_LIBRARIES})
156     set_target_properties(armnnTfParser PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
157 endif()
158
159 if(BUILD_ARMNN_QUANTIZER AND ARMNNREF)
160     if(NOT BUILD_ARMNN_SERIALIZER)
161         message(ERROR, "In order to build the ArmNN Quantization Tool you must set BUILD_ARMNN_SERIALIZER = YES")
162     endif()
163
164     set(armnn_quantizer_sources)
165     list(APPEND armnn_quantizer_sources
166         src/armnnQuantizer/QuantizationDataSet.hpp
167         src/armnnQuantizer/QuantizationDataSet.cpp
168         src/armnnQuantizer/QuantizationInput.hpp
169         src/armnnQuantizer/QuantizationInput.cpp
170         src/armnnQuantizer/CommandLineProcessor.hpp
171         src/armnnQuantizer/CommandLineProcessor.cpp
172         )
173
174     add_library_ex(armnnQuantizer SHARED ${armnn_quantizer_sources})
175
176     target_include_directories(armnnQuantizer PRIVATE include/armnnDeserializer)
177     target_include_directories(armnnQuantizer PRIVATE src/armnnUtils)
178     target_include_directories(armnnQuantizer PRIVATE src/armnn)
179
180     include_directories(SYSTEM "${FLATBUFFERS_INCLUDE_PATH}")
181     set_target_properties(armnnQuantizer PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
182
183     target_link_libraries(armnnQuantizer
184             armnn
185             ${Boost_SYSTEM_LIBRARY}
186             ${Boost_PROGRAM_OPTIONS_LIBRARY}
187             ${Boost_FILESYSTEM_LIBRARY}
188             ${Boost_THREAD_LIBRARY} )
189
190     add_executable_ex(ArmnnQuantizer
191         src/armnnQuantizer/ArmNNQuantizerMain.cpp)
192
193     target_include_directories(ArmnnQuantizer PRIVATE include/armnnDeserializer)
194     target_include_directories(ArmnnQuantizer PRIVATE src/armnn)
195
196     target_link_libraries(ArmnnQuantizer
197             ${Boost_SYSTEM_LIBRARY}
198             ${Boost_PROGRAM_OPTIONS_LIBRARY}
199             ${Boost_FILESYSTEM_LIBRARY}
200             ${Boost_THREAD_LIBRARY} )
201
202     target_link_libraries(ArmnnQuantizer
203             armnnQuantizer
204             armnnSerializer
205             armnn
206             armnnUtils
207             ${FLATBUFFERS_LIBRARY})
208
209     if(Threads_FOUND AND (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android)))
210         target_link_libraries(ArmnnQuantizer pthread)
211     endif()
212
213     set_target_properties(armnnQuantizer PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
214
215 endif()
216
217
218 list(APPEND armnn_sources
219     include/armnn/ArmNN.hpp
220     include/armnn/BackendHelper.hpp
221     include/armnn/BackendId.hpp
222     include/armnn/BackendOptions.hpp
223     include/armnn/BackendRegistry.hpp
224     include/armnn/Conversion.hpp
225     include/armnn/Deprecated.hpp
226     include/armnn/Descriptors.hpp
227     include/armnn/DescriptorsFwd.hpp
228     include/armnn/Exceptions.hpp
229     include/armnn/ILayerSupport.hpp
230     include/armnn/ILayerVisitor.hpp
231     include/armnn/INetwork.hpp
232     include/armnn/IProfiler.hpp
233     include/armnn/IRuntime.hpp
234     include/armnn/LayerSupport.hpp
235     include/armnn/LayerVisitorBase.hpp
236     include/armnn/Logging.hpp
237     include/armnn/LstmParams.hpp
238     include/armnn/MemorySources.hpp
239     include/armnn/NetworkFwd.hpp
240     include/armnn/Optional.hpp
241     include/armnn/QuantizedLstmParams.hpp
242     include/armnn/Tensor.hpp
243     include/armnn/TensorFwd.hpp
244     include/armnn/Types.hpp
245     include/armnn/TypesUtils.hpp
246     include/armnn/Utils.hpp
247     include/armnn/Version.hpp
248     include/armnn/profiling/IProfilingGuidGenerator.hpp
249     include/armnn/profiling/ISendTimelinePacket.hpp
250     include/armnn/utility/Assert.hpp
251     include/armnn/utility/IgnoreUnused.hpp
252     include/armnn/utility/NumericCast.hpp
253     include/armnn/utility/PolymorphicDowncast.hpp
254     include/armnn/utility/StringUtils.hpp
255     profiling/common/include/SocketConnectionException.hpp
256     src/armnn/layers/LayerCloneBase.hpp
257     src/armnn/layers/LayerWithParameters.hpp
258     src/armnn/layers/ActivationLayer.hpp
259     src/armnn/layers/ActivationLayer.cpp
260     src/armnn/layers/AdditionLayer.hpp
261     src/armnn/layers/AdditionLayer.cpp
262     src/armnn/layers/ArgMinMaxLayer.hpp
263     src/armnn/layers/ArgMinMaxLayer.cpp
264     src/armnn/layers/BatchNormalizationLayer.hpp
265     src/armnn/layers/BatchNormalizationLayer.cpp
266     src/armnn/layers/BatchToSpaceNdLayer.hpp
267     src/armnn/layers/BatchToSpaceNdLayer.cpp
268     src/armnn/layers/ComparisonLayer.hpp
269     src/armnn/layers/ComparisonLayer.cpp
270     src/armnn/layers/ConcatLayer.hpp
271     src/armnn/layers/ConcatLayer.cpp
272     src/armnn/layers/ConstantLayer.hpp
273     src/armnn/layers/ConstantLayer.cpp
274     src/armnn/layers/Convolution2dLayer.hpp
275     src/armnn/layers/Convolution2dLayer.cpp
276     src/armnn/layers/ConvertBf16ToFp32Layer.cpp
277     src/armnn/layers/ConvertBf16ToFp32Layer.hpp
278     src/armnn/layers/ConvertFp16ToFp32Layer.hpp
279     src/armnn/layers/ConvertFp16ToFp32Layer.cpp
280     src/armnn/layers/ConvertFp32ToBf16Layer.hpp
281     src/armnn/layers/ConvertFp32ToBf16Layer.cpp
282     src/armnn/layers/ConvertFp32ToFp16Layer.hpp
283     src/armnn/layers/ConvertFp32ToFp16Layer.cpp
284     src/armnn/layers/DebugLayer.hpp
285     src/armnn/layers/DebugLayer.cpp
286     src/armnn/layers/DepthToSpaceLayer.hpp
287     src/armnn/layers/DepthToSpaceLayer.cpp
288     src/armnn/layers/DepthwiseConvolution2dLayer.hpp
289     src/armnn/layers/DepthwiseConvolution2dLayer.cpp
290     src/armnn/layers/DequantizeLayer.hpp
291     src/armnn/layers/DequantizeLayer.cpp
292     src/armnn/layers/DetectionPostProcessLayer.hpp
293     src/armnn/layers/DetectionPostProcessLayer.cpp
294     src/armnn/layers/ElementwiseBaseLayer.hpp
295     src/armnn/layers/ElementwiseBaseLayer.cpp
296     src/armnn/layers/ElementwiseUnaryLayer.hpp
297     src/armnn/layers/ElementwiseUnaryLayer.cpp
298     src/armnn/layers/FakeQuantizationLayer.hpp
299     src/armnn/layers/FakeQuantizationLayer.cpp
300     src/armnn/layers/FloorLayer.hpp
301     src/armnn/layers/FloorLayer.cpp
302     src/armnn/layers/FullyConnectedLayer.hpp
303     src/armnn/layers/FullyConnectedLayer.cpp
304     src/armnn/layers/GatherLayer.cpp
305     src/armnn/layers/GatherLayer.hpp
306     src/armnn/layers/InputLayer.hpp
307     src/armnn/layers/InputLayer.cpp
308     src/armnn/layers/InstanceNormalizationLayer.hpp
309     src/armnn/layers/InstanceNormalizationLayer.cpp
310     src/armnn/layers/L2NormalizationLayer.hpp
311     src/armnn/layers/L2NormalizationLayer.cpp
312     src/armnn/layers/LogSoftmaxLayer.hpp
313     src/armnn/layers/LogSoftmaxLayer.cpp
314     src/armnn/layers/LstmLayer.cpp
315     src/armnn/layers/LstmLayer.hpp
316     src/armnn/layers/MaximumLayer.cpp
317     src/armnn/layers/MaximumLayer.hpp
318     src/armnn/layers/MeanLayer.hpp
319     src/armnn/layers/MeanLayer.cpp
320     src/armnn/layers/MemCopyLayer.hpp
321     src/armnn/layers/MemCopyLayer.cpp
322     src/armnn/layers/MemImportLayer.hpp
323     src/armnn/layers/MemImportLayer.cpp
324     src/armnn/layers/MergeLayer.hpp
325     src/armnn/layers/MergeLayer.cpp
326     src/armnn/layers/MinimumLayer.cpp
327     src/armnn/layers/MinimumLayer.hpp
328     src/armnn/layers/MultiplicationLayer.hpp
329     src/armnn/layers/MultiplicationLayer.cpp
330     src/armnn/layers/NormalizationLayer.hpp
331     src/armnn/layers/NormalizationLayer.cpp
332     src/armnn/layers/OutputLayer.hpp
333     src/armnn/layers/OutputLayer.cpp
334     src/armnn/layers/PadLayer.hpp
335     src/armnn/layers/PadLayer.cpp
336     src/armnn/layers/PermuteLayer.hpp
337     src/armnn/layers/PermuteLayer.cpp
338     src/armnn/layers/Pooling2dLayer.hpp
339     src/armnn/layers/Pooling2dLayer.cpp
340     src/armnn/layers/QuantizeLayer.cpp
341     src/armnn/layers/QuantizeLayer.hpp
342     src/armnn/layers/QLstmLayer.hpp
343     src/armnn/layers/QLstmLayer.cpp
344     src/armnn/layers/QuantizedLstmLayer.hpp
345     src/armnn/layers/QuantizedLstmLayer.cpp
346     src/armnn/layers/DivisionLayer.cpp
347     src/armnn/layers/DivisionLayer.hpp
348     src/armnn/layers/PreCompiledLayer.hpp
349     src/armnn/layers/PreCompiledLayer.cpp
350     src/armnn/layers/PreluLayer.hpp
351     src/armnn/layers/PreluLayer.cpp
352     src/armnn/layers/ReshapeLayer.hpp
353     src/armnn/layers/ReshapeLayer.cpp
354     src/armnn/layers/ResizeLayer.hpp
355     src/armnn/layers/ResizeLayer.cpp
356     src/armnn/layers/SliceLayer.cpp
357     src/armnn/layers/SliceLayer.hpp
358     src/armnn/layers/SoftmaxLayer.hpp
359     src/armnn/layers/SoftmaxLayer.cpp
360     src/armnn/layers/SpaceToBatchNdLayer.hpp
361     src/armnn/layers/SpaceToBatchNdLayer.cpp
362     src/armnn/layers/SpaceToDepthLayer.hpp
363     src/armnn/layers/SpaceToDepthLayer.cpp
364     src/armnn/layers/SplitterLayer.hpp
365     src/armnn/layers/SplitterLayer.cpp
366     src/armnn/layers/StackLayer.hpp
367     src/armnn/layers/StackLayer.cpp
368     src/armnn/layers/StandInLayer.cpp
369     src/armnn/layers/StandInLayer.hpp
370     src/armnn/layers/StridedSliceLayer.cpp
371     src/armnn/layers/StridedSliceLayer.hpp
372     src/armnn/layers/SubtractionLayer.cpp
373     src/armnn/layers/SubtractionLayer.hpp
374     src/armnn/layers/SwitchLayer.cpp
375     src/armnn/layers/SwitchLayer.hpp
376     src/armnn/layers/TransposeConvolution2dLayer.cpp
377     src/armnn/layers/TransposeConvolution2dLayer.hpp
378     src/armnn/layers/TransposeLayer.hpp
379     src/armnn/layers/TransposeLayer.cpp
380     src/armnn/BackendRegistry.cpp
381     src/armnn/BackendSettings.hpp
382     src/armnn/BackendHelper.cpp
383     src/armnn/CompatibleTypes.hpp
384     src/armnn/Descriptors.cpp
385     src/armnn/DeviceSpec.hpp
386     src/armnn/DllExport.hpp
387     src/armnn/DynamicQuantizationVisitor.cpp
388     src/armnn/DynamicQuantizationVisitor.hpp
389     src/armnn/Exceptions.cpp
390     src/armnn/ExecutionFrame.cpp
391     src/armnn/ExecutionFrame.hpp
392     src/armnn/Graph.cpp
393     src/armnn/Graph.hpp
394     src/armnn/IGraphObservable.hpp
395     src/armnn/Instrument.hpp
396     src/armnn/InternalTypes.cpp
397     src/armnn/InternalTypes.hpp
398     src/armnn/ISubgraphViewConverter.hpp
399     src/armnn/JsonPrinter.cpp
400     src/armnn/JsonPrinter.hpp
401     src/armnn/Layer.cpp
402     src/armnn/LayerFwd.hpp
403     src/armnn/Layer.hpp
404     src/armnn/LayersFwd.hpp
405     src/armnn/LayerSupportCommon.hpp
406     src/armnn/LayerSupport.cpp
407     src/armnn/LoadedNetwork.cpp
408     src/armnn/LoadedNetwork.hpp
409     src/armnn/Logging.cpp
410     src/armnn/Network.cpp
411     src/armnn/Network.hpp
412     src/armnn/NetworkQuantizationScheme.hpp
413     src/armnn/NetworkQuantizer.cpp
414     src/armnn/NetworkQuantizer.hpp
415     src/armnn/NetworkQuantizerUtils.cpp
416     src/armnn/NetworkQuantizerUtils.hpp
417     src/armnn/NetworkUtils.cpp
418     src/armnn/NetworkUtils.hpp
419     src/armnn/Observable.cpp
420     src/armnn/Observable.hpp
421     src/armnn/Optimizer.cpp
422     src/armnn/Optimizer.hpp
423     src/armnn/OutputHandler.cpp
424     src/armnn/OutputHandler.hpp
425     src/armnn/OverrideInputRangeVisitor.cpp
426     src/armnn/OverrideInputRangeVisitor.hpp
427     src/armnn/Profiling.cpp
428     src/armnn/ProfilingEvent.cpp
429     src/armnn/ProfilingEvent.hpp
430     src/armnn/Profiling.hpp
431     src/armnn/QuantizerVisitor.cpp
432     src/armnn/QuantizerVisitor.hpp
433     src/armnn/Runtime.cpp
434     src/armnn/Runtime.hpp
435     src/armnn/RangeTracker.cpp
436     src/armnn/RangeTracker.hpp
437     src/armnn/ResolveType.hpp
438     src/armnn/SerializeLayerParameters.cpp
439     src/armnn/SerializeLayerParameters.hpp
440     src/armnn/StaticRangeVisitor.cpp
441     src/armnn/StaticRangeVisitor.hpp
442     src/armnn/SubgraphView.cpp
443     src/armnn/SubgraphView.hpp
444     src/armnn/SubgraphViewSelector.cpp
445     src/armnn/SubgraphViewSelector.hpp
446     src/armnn/Tensor.cpp
447     src/armnn/TypesUtils.cpp
448     src/armnn/Utils.cpp
449     src/armnn/WallClockTimer.cpp
450     src/armnn/WallClockTimer.hpp
451     src/armnn/optimizations/AddDebug.hpp
452     src/armnn/optimizations/All.hpp
453     src/armnn/optimizations/ConvertConstants.hpp
454     src/armnn/optimizations/ConvertFp32NetworkToBf16.hpp
455     src/armnn/optimizations/ConvertFp32NetworkToFp16.hpp
456     src/armnn/optimizations/FoldPadIntoConvolution2d.hpp
457     src/armnn/optimizations/MovePermuteUp.hpp
458     src/armnn/optimizations/MoveTransposeUp.hpp
459     src/armnn/optimizations/Optimization.hpp
460     src/armnn/optimizations/OptimizeConsecutiveReshapes.hpp
461     src/armnn/optimizations/OptimizeInverseConversions.hpp
462     src/armnn/optimizations/OptimizeInversePermutes.hpp
463     src/armnn/optimizations/PermuteAndBatchToSpaceAsDepthToSpace.hpp
464     src/armnn/optimizations/PermuteAsReshape.hpp
465     src/armnn/optimizations/SquashEqualSiblings.hpp
466     src/profiling/ActivateTimelineReportingCommandHandler.cpp
467     src/profiling/ActivateTimelineReportingCommandHandler.hpp
468     src/profiling/BufferManager.cpp
469     src/profiling/BufferManager.hpp
470     src/profiling/CommandHandler.cpp
471     src/profiling/CommandHandler.hpp
472     src/profiling/CommandHandlerFunctor.cpp
473     src/profiling/CommandHandlerFunctor.hpp
474     src/profiling/CommandHandlerKey.cpp
475     src/profiling/CommandHandlerKey.hpp
476     src/profiling/CommandHandlerRegistry.cpp
477     src/profiling/CommandHandlerRegistry.hpp
478     src/profiling/ConnectionAcknowledgedCommandHandler.cpp
479     src/profiling/ConnectionAcknowledgedCommandHandler.hpp
480     src/profiling/CounterDirectory.cpp
481     src/profiling/CounterDirectory.hpp
482     src/profiling/CounterIdMap.cpp
483     src/profiling/CounterIdMap.hpp
484     src/profiling/DeactivateTimelineReportingCommandHandler.cpp
485     src/profiling/DeactivateTimelineReportingCommandHandler.hpp
486     src/profiling/DirectoryCaptureCommandHandler.cpp
487     src/profiling/DirectoryCaptureCommandHandler.hpp
488     src/profiling/EncodeVersion.hpp
489     src/profiling/FileOnlyProfilingConnection.cpp
490     src/profiling/FileOnlyProfilingConnection.hpp
491     src/profiling/Holder.cpp
492     src/profiling/Holder.hpp
493     src/profiling/IBufferManager.hpp
494     src/profiling/IConsumer.hpp
495     src/profiling/ICounterDirectory.hpp
496     src/profiling/ICounterRegistry.hpp
497     src/profiling/ICounterValues.hpp
498     src/profiling/INotifyBackends.hpp
499     src/profiling/IReportStructure.hpp
500     src/profiling/ISendCounterPacket.hpp
501     src/profiling/ISendThread.hpp
502     src/profiling/IPacketBuffer.hpp
503     src/profiling/IPeriodicCounterCapture.hpp
504     src/profiling/IProfilingConnection.hpp
505     src/profiling/IProfilingConnectionFactory.hpp
506     src/profiling/LabelsAndEventClasses.cpp
507     src/profiling/LabelsAndEventClasses.hpp
508     src/profiling/Packet.hpp
509     src/profiling/PacketBuffer.cpp
510     src/profiling/PacketBuffer.hpp
511     src/profiling/PacketVersionResolver.cpp
512     src/profiling/PacketVersionResolver.hpp
513     src/profiling/PeriodicCounterCapture.hpp
514     src/profiling/PeriodicCounterCapture.cpp
515     src/profiling/PeriodicCounterSelectionCommandHandler.cpp
516     src/profiling/PeriodicCounterSelectionCommandHandler.hpp
517     src/profiling/PerJobCounterSelectionCommandHandler.cpp
518     src/profiling/PerJobCounterSelectionCommandHandler.hpp
519     src/profiling/ProfilingConnectionDumpToFileDecorator.cpp
520     src/profiling/ProfilingConnectionDumpToFileDecorator.hpp
521     src/profiling/ProfilingConnectionFactory.cpp
522     src/profiling/ProfilingConnectionFactory.hpp
523     src/profiling/ProfilingGuidGenerator.hpp
524     src/profiling/ProfilingService.cpp
525     src/profiling/ProfilingService.hpp
526     src/profiling/ProfilingStateMachine.cpp
527     src/profiling/ProfilingStateMachine.hpp
528     src/profiling/ProfilingUtils.cpp
529     src/profiling/ProfilingUtils.hpp
530     src/profiling/RegisterBackendCounters.cpp
531     src/profiling/RegisterBackendCounters.hpp
532     src/profiling/RequestCounterDirectoryCommandHandler.cpp
533     src/profiling/RequestCounterDirectoryCommandHandler.hpp
534     src/profiling/SendCounterPacket.cpp
535     src/profiling/SendCounterPacket.hpp
536     src/profiling/SendThread.cpp
537     src/profiling/SendThread.hpp
538     src/profiling/SendTimelinePacket.cpp
539     src/profiling/SendTimelinePacket.hpp
540     src/profiling/SocketProfilingConnection.cpp
541     src/profiling/SocketProfilingConnection.hpp
542     src/profiling/TimelinePacketWriterFactory.cpp
543     src/profiling/TimelinePacketWriterFactory.hpp
544     src/profiling/TimelineUtilityMethods.cpp
545     src/profiling/TimelineUtilityMethods.hpp
546     src/profiling/backends/BackendProfiling.cpp
547     src/profiling/backends/BackendProfiling.hpp
548     third-party/half/half.hpp
549     )
550
551 # Files used for Streamline-based profiling backend
552 if(PROFILING_BACKEND_STREAMLINE)
553     list(APPEND armnn_sources
554         ${GATOR_ROOT}/annotate/streamline_annotate.h
555         ${GATOR_ROOT}/annotate/streamline_annotate.c)
556 endif()
557
558 # the backends under src/backends extend the list of
559 # object libs armnn to include in the build
560 include(src/backends/backends.cmake)
561 foreach(lib ${armnnLibraries})
562     message(STATUS "Adding object library dependency to armnn: ${lib}")
563     list(APPEND armnn_sources $<TARGET_OBJECTS:${lib}>)
564 endforeach()
565
566 add_library_ex(armnn SHARED ${armnn_sources})
567
568 target_compile_definitions(armnn PRIVATE "ARMNN_COMPILING_DLL")
569
570 target_include_directories(armnn PRIVATE src/armnn)
571 target_include_directories(armnn PRIVATE src/armnnUtils)
572 target_include_directories(armnn PRIVATE src/backends)
573 target_include_directories(armnn PRIVATE src/profiling)
574
575 target_link_libraries(armnn armnnUtils)
576
577 target_link_libraries(armnn ${CMAKE_DL_LIBS})
578 if ("${CMAKE_SYSTEM_NAME}" STREQUAL Windows) 
579     target_link_libraries(armnn Ws2_32.lib)
580 endif()
581
582 install(TARGETS armnn
583         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
584         RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
585 if(BUILD_CAFFE_PARSER)
586     install(TARGETS armnnCaffeParser
587             LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
588             RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
589 endif()
590 if(BUILD_ONNX_PARSER)
591     install(TARGETS armnnOnnxParser
592             LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
593             RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
594 endif()
595 if(BUILD_TF_PARSER)
596     install(TARGETS armnnTfParser
597             LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
598             RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
599 endif()
600
601 install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
602
603 target_link_libraries(armnn ${Boost_THREAD_LIBRARY}
604                             ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
605
606 if(ARMCOMPUTENEON OR ARMCOMPUTECL)
607     target_link_libraries(armnn ${ARMCOMPUTE_LIBRARIES})
608 endif()
609
610 if(PROFILING_BACKEND_STREAMLINE AND (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android)))
611     target_link_libraries(armnn pthread)
612 endif()
613
614 set_target_properties(armnn PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
615
616 if(BUILD_UNIT_TESTS)
617     set(unittest_sources)
618     list(APPEND unittest_sources
619         src/armnn/test/ConstTensorLayerVisitor.hpp
620         src/armnn/test/ConstTensorLayerVisitor.cpp
621         src/armnn/test/CreateWorkload.hpp
622         src/armnn/test/CsvReaderTest.cpp
623         src/armnn/test/EndToEndTest.cpp
624         src/armnn/test/ExecutionFrameTest.cpp
625         src/armnn/test/FloatingPointConverterTest.cpp
626         src/armnn/test/FlowControl.cpp
627         src/armnn/test/GraphTests.cpp
628         src/armnn/test/GraphUtils.cpp
629         src/armnn/test/GraphUtils.hpp
630         src/armnn/test/InstrumentTests.cpp
631         src/armnn/test/InferOutputTests.cpp
632         src/armnn/test/InferOutputTests.hpp
633         src/armnn/test/ModelAccuracyCheckerTest.cpp
634         src/armnn/test/NetworkTests.cpp
635         src/armnn/test/ObservableTest.cpp
636         src/armnn/test/OptimizerTests.cpp
637         src/armnn/test/optimizations/ConvertConstantsBFloatTests.cpp
638         src/armnn/test/optimizations/ConvertConstantsFloatToHalfTests.cpp
639         src/armnn/test/optimizations/ConvertConstantsHalfToFloatTests.cpp
640         src/armnn/test/optimizations/Fp32NetworkToBf16ConverterTests.cpp
641         src/armnn/test/optimizations/Fp32NetworkToFp16ConverterTests.cpp
642         src/armnn/test/optimizations/InsertDebugLayerTests.cpp
643         src/armnn/test/optimizations/MovePermuteUpTests.cpp
644         src/armnn/test/optimizations/MoveTransposeUpTests.cpp
645         src/armnn/test/optimizations/OptimizeConsecutiveReshapesTests.cpp
646         src/armnn/test/optimizations/OptimizeInverseConversionsTests.cpp
647         src/armnn/test/optimizations/OptimizeInversePermutesTests.cpp
648         src/armnn/test/optimizations/PermuteAndBatchToSpaceAsDepthToSpaceTests.cpp
649         src/armnn/test/optimizations/PermuteAsReshapeTests.cpp
650         src/armnn/test/optimizations/SquashEqualSiblingsTests.cpp
651         src/armnn/test/optimizations/TransposeAsReshapeTests.cpp
652         src/armnn/test/OptionalTest.cpp
653         src/armnn/test/ProfilerTests.cpp
654         src/armnn/test/ProfilingEventTest.cpp
655         src/armnn/test/SubgraphViewTests.cpp
656         src/armnn/test/TensorHandleStrategyTest.cpp
657         src/armnn/test/TensorHelpers.hpp
658         src/armnn/test/TensorTest.cpp
659         src/armnn/test/TestInputOutputLayerVisitor.cpp
660         src/armnn/test/TestInputOutputLayerVisitor.hpp
661         src/armnn/test/TestLayerVisitor.cpp
662         src/armnn/test/TestLayerVisitor.hpp
663         src/armnn/test/TestNameOnlyLayerVisitor.cpp
664         src/armnn/test/TestNameOnlyLayerVisitor.hpp
665         src/armnn/test/TestNameAndDescriptorLayerVisitor.hpp
666         src/armnn/test/TestNameAndDescriptorLayerVisitor.cpp
667         src/armnn/test/TestUtils.cpp
668         src/armnn/test/TestUtils.hpp
669         src/armnn/test/UtilityTests.cpp
670         src/armnn/test/UnitTests.cpp
671         src/armnn/test/UnitTests.hpp
672         src/armnn/test/UtilsTests.cpp
673         src/armnnUtils/test/QuantizeHelperTest.cpp
674         src/armnnUtils/test/PrototxtConversionsTest.cpp
675         src/armnnUtils/test/ParserHelperTest.cpp
676         src/armnnUtils/test/TensorUtilsTest.cpp
677         src/profiling/test/BufferTests.cpp
678         src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
679         src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
680         src/profiling/test/ProfilingGuidTest.cpp
681         src/profiling/test/ProfilingMocks.hpp
682         src/profiling/test/ProfilingTests.cpp
683         src/profiling/test/ProfilingTests.hpp
684         src/profiling/test/ProfilingTestUtils.cpp
685         src/profiling/test/ProfilingTestUtils.hpp
686         src/profiling/test/SendCounterPacketTests.cpp
687         src/profiling/test/SendCounterPacketTests.hpp
688         src/profiling/test/SendTimelinePacketTests.cpp
689         src/profiling/test/TimelinePacketTests.cpp
690         src/profiling/test/TimelineUtilityMethodsTests.cpp
691         )
692
693     if(ARMNNREF)
694         list(APPEND unittest_sources
695             src/armnn/test/DebugCallbackTest.cpp
696             src/armnn/test/QuantizerTest.cpp
697             src/armnn/test/RuntimeTests.cpp
698             src/armnn/test/RuntimeTests.hpp
699             )
700     endif()
701
702     if(BUILD_TF_PARSER AND ARMNNREF)
703         list(APPEND unittest_sources
704             src/armnnTfParser/test/Activations.cpp
705             src/armnnTfParser/test/Addition.cpp
706             src/armnnTfParser/test/AddN.cpp
707             src/armnnTfParser/test/Assert.cpp
708             src/armnnTfParser/test/BiasAdd.cpp
709             src/armnnTfParser/test/BroadcastForAdd.cpp
710             src/armnnTfParser/test/Convolution2d.cpp
711             src/armnnTfParser/test/Concat.cpp
712             src/armnnTfParser/test/ConcatOfConcats.cpp
713             src/armnnTfParser/test/DepthwiseConvolution2d.cpp
714             src/armnnTfParser/test/Equal.cpp
715             src/armnnTfParser/test/ExpandDims.cpp
716             src/armnnTfParser/test/FusedBatchNorm.cpp
717             src/armnnTfParser/test/Gather.cpp
718             src/armnnTfParser/test/Greater.cpp
719             src/armnnTfParser/test/Identity.cpp
720             src/armnnTfParser/test/LocalResponseNormalization.cpp
721             src/armnnTfParser/test/Maximum.cpp
722             src/armnnTfParser/test/MaximumForLeakyRelu.cpp
723             src/armnnTfParser/test/Mean.cpp
724             src/armnnTfParser/test/Minimum.cpp
725             src/armnnTfParser/test/Multiplication.cpp
726             src/armnnTfParser/test/Pad.cpp
727             src/armnnTfParser/test/MultiOutput.cpp
728             src/armnnTfParser/test/PassThru.cpp
729             src/armnnTfParser/test/Pooling.cpp
730             src/armnnTfParser/test/RealDiv.cpp
731             src/armnnTfParser/test/Reshape.cpp
732             src/armnnTfParser/test/ResizeBilinear.cpp
733             src/armnnTfParser/test/Rsqrt.cpp
734             src/armnnTfParser/test/Shape.cpp
735             src/armnnTfParser/test/Softmax.cpp
736             src/armnnTfParser/test/TestDependencies.cpp
737             src/armnnTfParser/test/FullyConnected.cpp
738             src/armnnTfParser/test/Constant.cpp
739             src/armnnTfParser/test/TestMultiInputsOutputs.cpp
740             src/armnnTfParser/test/Split.cpp
741             src/armnnTfParser/test/Squeeze.cpp
742             src/armnnTfParser/test/Stack.cpp
743             src/armnnTfParser/test/Sub.cpp
744             src/armnnTfParser/test/StridedSlice.cpp
745             src/armnnTfParser/test/Transpose.cpp
746             )
747
748     endif()
749
750     if(BUILD_TF_LITE_PARSER AND ARMNNREF)
751         list(APPEND unittest_sources
752              src/armnnTfLiteParser/test/Activations.cpp
753              src/armnnTfLiteParser/test/Addition.cpp
754              src/armnnTfLiteParser/test/AvgPool2D.cpp
755              src/armnnTfLiteParser/test/BatchToSpaceND.cpp
756              src/armnnTfLiteParser/test/Concatenation.cpp
757              src/armnnTfLiteParser/test/Constant.cpp
758              src/armnnTfLiteParser/test/Conv2D.cpp
759              src/armnnTfLiteParser/test/DepthwiseConvolution2D.cpp
760              src/armnnTfLiteParser/test/Dequantize.cpp
761              src/armnnTfLiteParser/test/DetectionPostProcess.cpp
762              src/armnnTfLiteParser/test/FullyConnected.cpp
763              src/armnnTfLiteParser/test/L2Normalization.cpp
764              src/armnnTfLiteParser/test/Maximum.cpp
765              src/armnnTfLiteParser/test/MaxPool2D.cpp
766              src/armnnTfLiteParser/test/Mean.cpp
767              src/armnnTfLiteParser/test/Minimum.cpp
768              src/armnnTfLiteParser/test/Multiplication.cpp
769              src/armnnTfLiteParser/test/Pack.cpp
770              src/armnnTfLiteParser/test/Pad.cpp
771              src/armnnTfLiteParser/test/Reshape.cpp
772              src/armnnTfLiteParser/test/ResizeBilinear.cpp
773              src/armnnTfLiteParser/test/ResizeNearestNeighbor.cpp
774              src/armnnTfLiteParser/test/Softmax.cpp
775              src/armnnTfLiteParser/test/SpaceToBatchND.cpp
776              src/armnnTfLiteParser/test/Slice.cpp
777              src/armnnTfLiteParser/test/Split.cpp
778              src/armnnTfLiteParser/test/Squeeze.cpp
779              src/armnnTfLiteParser/test/StridedSlice.cpp
780              src/armnnTfLiteParser/test/Sub.cpp
781              src/armnnTfLiteParser/test/TransposeConv.cpp
782              src/armnnTfLiteParser/test/Transpose.cpp
783              src/armnnTfLiteParser/test/Unpack.cpp
784              src/armnnTfLiteParser/test/Unsupported.cpp
785              src/armnnTfLiteParser/test/LoadModel.cpp
786              src/armnnTfLiteParser/test/GetBuffer.cpp
787              src/armnnTfLiteParser/test/OutputShapeOfSqueeze.cpp
788              src/armnnTfLiteParser/test/InputOutputTensorNames.cpp
789              src/armnnTfLiteParser/test/GetTensorIds.cpp
790              src/armnnTfLiteParser/test/GetSubgraphInputsOutputs.cpp
791              src/armnnTfLiteParser/test/GetInputsOutputs.cpp
792              )
793
794         # Generate SchemaText.cpp file which contains the TfLite schema text as a
795         # static C-array of bytes. This is needed at runtime for TfLite parser tests.
796         add_custom_command(
797             OUTPUT  SchemaText.cpp
798             COMMAND cp ${TF_LITE_SCHEMA_INCLUDE_PATH}/schema.fbs g_TfLiteSchemaText
799             COMMAND xxd -i g_TfLiteSchemaText SchemaText.cpp
800             WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
801             DEPENDS ${TF_LITE_SCHEMA_INCLUDE_PATH}/schema.fbs
802         )
803         list(APPEND unittest_sources ${CMAKE_CURRENT_BINARY_DIR}/SchemaText.cpp)
804     endif()
805
806     if(BUILD_CAFFE_PARSER AND ARMNNREF)
807         list(APPEND unittest_sources
808             src/armnnCaffeParser/test/TestAdd.cpp
809             src/armnnCaffeParser/test/TestConcat.cpp
810             src/armnnCaffeParser/test/TestConvolution.cpp
811             src/armnnCaffeParser/test/TestDropout.cpp
812             src/armnnCaffeParser/test/TestInputs.cpp
813             src/armnnCaffeParser/test/TestMul.cpp
814             src/armnnCaffeParser/test/TestPooling2d.cpp
815             src/armnnCaffeParser/test/TestInPlace.cpp
816             src/armnnCaffeParser/test/TestMultiInputsOutputs.cpp
817             src/armnnCaffeParser/test/TestSplit.cpp
818             )
819     endif()
820
821     if(BUILD_ONNX_PARSER AND ARMNNREF)
822         list(APPEND unittest_sources
823             src/armnnOnnxParser/test/Addition.cpp
824             src/armnnOnnxParser/test/BatchNorm.cpp
825             src/armnnOnnxParser/test/Clip.cpp
826             src/armnnOnnxParser/test/Const.cpp
827             src/armnnOnnxParser/test/Constructor.cpp
828             src/armnnOnnxParser/test/Conv2D.cpp
829             src/armnnOnnxParser/test/CreateNetwork.cpp
830             src/armnnOnnxParser/test/DepthConv.cpp
831             src/armnnOnnxParser/test/Flatten.cpp
832             src/armnnOnnxParser/test/FullyConnected.cpp
833             src/armnnOnnxParser/test/GetInputsOutputs.cpp
834             src/armnnOnnxParser/test/Pooling.cpp
835             src/armnnOnnxParser/test/ProtoxtFixture.cpp
836             src/armnnOnnxParser/test/Relu.cpp
837             src/armnnOnnxParser/test/Reshape.cpp
838             )
839     endif()
840
841     if(BUILD_ARMNN_QUANTIZER AND ARMNNREF)
842         list(APPEND unittest_sources
843              src/armnnQuantizer/test/QuantizationDataSetTests.cpp
844              )
845     endif()
846
847     if(BUILD_ARMNN_SERIALIZER AND ARMNNREF)
848         enable_language(ASM)
849         list(APPEND unittest_sources
850             src/armnnSerializer/test/ActivationSerializationTests.cpp
851             src/armnnSerializer/test/SerializerTests.cpp
852             src/armnnDeserializer/test/DeserializeAbs.cpp
853             src/armnnDeserializer/test/DeserializeActivation.cpp
854             src/armnnDeserializer/test/DeserializeAdd.cpp
855             src/armnnDeserializer/test/DeserializeBatchToSpaceNd.cpp
856             src/armnnDeserializer/test/DeserializeBatchNormalization.cpp
857             src/armnnDeserializer/test/DeserializeComparison.cpp
858             src/armnnDeserializer/test/DeserializeConstant.cpp
859             src/armnnDeserializer/test/DeserializeConvolution2d.cpp
860             src/armnnDeserializer/test/DeserializeDepthToSpace.cpp
861             src/armnnDeserializer/test/DeserializeDivision.cpp
862             src/armnnDeserializer/test/DeserializeFloor.cpp
863             src/armnnDeserializer/test/DeserializeFullyConnected.cpp
864             src/armnnDeserializer/test/DeserializeGather.cpp
865             src/armnnDeserializer/test/DeserializeInstanceNormalization.cpp
866             src/armnnDeserializer/test/DeserializeL2Normalization.cpp
867             src/armnnDeserializer/test/DeserializeLogSoftmax.cpp
868             src/armnnDeserializer/test/DeserializeMean.cpp
869             src/armnnDeserializer/test/DeserializeMultiplication.cpp
870             src/armnnDeserializer/test/DeserializeNormalization.cpp
871             src/armnnDeserializer/test/DeserializePad.cpp
872             src/armnnDeserializer/test/DeserializePermute.cpp
873             src/armnnDeserializer/test/DeserializePooling2d.cpp
874             src/armnnDeserializer/test/DeserializeReshape.cpp
875             src/armnnDeserializer/test/DeserializeResizeBilinear.cpp
876             src/armnnDeserializer/test/DeserializeRsqrt.cpp
877             src/armnnDeserializer/test/DeserializeSlice.cpp
878             src/armnnDeserializer/test/DeserializeSpaceToBatchNd.cpp
879             src/armnnDeserializer/test/DeserializeStridedSlice.cpp
880             src/armnnDeserializer/test/DeserializeSubtraction.cpp
881             src/armnnDeserializer/test/ParserFlatbuffersSerializeFixture.hpp
882             src/armnnDeserializer/test/SchemaSerialize.s
883             )
884         set_source_files_properties(src/armnnDeserializer/test/SchemaSerialize.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
885     endif()
886
887     if(BUILD_GATORD_MOCK)
888         list(APPEND unittest_sources
889             tests/profiling/gatordmock/tests/GatordMockTests.cpp
890             )
891     endif()
892
893     if(BUILD_TIMELINE_DECODER)
894         list(APPEND unittest_sources
895              src/timelineDecoder/tests/JSONTimelineDecoderTests.cpp
896              src/timelineDecoder/tests/TimelineTests.cpp
897              )
898     endif()
899
900     foreach(lib ${armnnUnitTestLibraries})
901         message(STATUS "Adding object library dependency to UnitTests: ${lib}")
902         list(APPEND unittest_sources $<TARGET_OBJECTS:${lib}>)
903     endforeach()
904
905     add_executable(UnitTests ${unittest_sources})
906     target_include_directories(UnitTests PRIVATE src/armnn)
907     target_include_directories(UnitTests PRIVATE src/armnnUtils)
908     target_include_directories(UnitTests PRIVATE src/backends)
909     target_include_directories(UnitTests PRIVATE src/profiling)
910     target_include_directories(UnitTests PRIVATE src/timelineDecoder)
911
912     if(VALGRIND_FOUND)
913         if(HEAP_PROFILING OR LEAK_CHECKING)
914             message(STATUS "Valgrind is disabled for heap profiling and leak checking builds.")
915         else()
916             # Valgrind works with gperftools version number <= 2.4
917             target_compile_definitions(UnitTests PRIVATE "WITH_VALGRIND=1")
918         endif()
919     endif()
920
921     target_link_libraries(UnitTests ${CMAKE_THREAD_LIBS_INIT})
922     target_link_libraries(UnitTests ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
923
924     target_link_libraries(UnitTests armnn)
925     target_link_libraries(UnitTests armnnUtils)
926
927     if(BUILD_TF_PARSER)
928         target_link_libraries(UnitTests armnnTfParser)
929     endif()
930
931     if(BUILD_GATORD_MOCK)
932         target_link_libraries(UnitTests gatordMockService)
933     endif()
934
935     if(BUILD_TIMELINE_DECODER)
936         target_link_libraries(UnitTests timelineDecoder)
937     endif()
938
939     if(BUILD_TF_LITE_PARSER)
940         target_include_directories(UnitTests SYSTEM PRIVATE "${TF_LITE_SCHEMA_INCLUDE_PATH}")
941         target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
942         target_link_libraries(UnitTests armnnTfLiteParser)
943     endif()
944
945     if(BUILD_CAFFE_PARSER)
946         target_link_libraries(UnitTests armnnCaffeParser)
947     endif()
948
949     if(BUILD_ARMNN_SERIALIZER AND ARMNNREF)
950         target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnSerializer)
951         target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
952         target_link_libraries(UnitTests armnnSerializer)
953     endif()
954
955     if(BUILD_ARMNN_QUANTIZER AND ARMNNREF)
956         target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnQuantizer)
957         target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
958         target_link_libraries(UnitTests armnnQuantizer armnnSerializer)
959     endif()
960
961     if(BUILD_ONNX_PARSER)
962         target_link_libraries(UnitTests armnnOnnxParser)
963     endif()
964
965     addDllCopyCommands(UnitTests)
966 endif()
967
968 if (BUILD_ARMNN_SERIALIZER AND (BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER OR BUILD_CAFFE_PARSER) AND ARMNNREF)
969     set(ArmnnConverter_sources
970         src/armnnConverter/ArmnnConverter.cpp)
971
972     add_executable_ex(ArmnnConverter ${ArmnnConverter_sources})
973     target_include_directories(ArmnnConverter PRIVATE src/armnn)
974     target_include_directories(ArmnnConverter PRIVATE src/armnnUtils)
975
976     if(BUILD_CAFFE_PARSER)
977         target_link_libraries(ArmnnConverter armnnCaffeParser)
978     endif()
979
980     if(BUILD_ONNX_PARSER)
981         target_link_libraries(ArmnnConverter armnnOnnxParser)
982     endif()
983
984     if(BUILD_TF_PARSER)
985         target_link_libraries(ArmnnConverter armnnTfParser)
986     endif()
987
988     if(BUILD_TF_LITE_PARSER)
989         target_link_libraries(ArmnnConverter armnnTfLiteParser)
990     endif()
991
992     target_link_libraries(ArmnnConverter armnnSerializer)
993
994     target_link_libraries(ArmnnConverter armnn)
995     target_link_libraries(ArmnnConverter ${CMAKE_THREAD_LIBS_INIT})
996     target_link_libraries(ArmnnConverter
997         ${Boost_SYSTEM_LIBRARY}
998         ${Boost_FILESYSTEM_LIBRARY}
999         ${Boost_PROGRAM_OPTIONS_LIBRARY})
1000     addDllCopyCommands(ArmnnConverter)
1001 endif()
1002
1003 if(BUILD_GATORD_MOCK)
1004     add_subdirectory(src/timelineDecoder)
1005
1006     set(gatord_mock_sources)
1007     list(APPEND gatord_mock_sources
1008         tests/profiling/gatordmock/CommandFileParser.hpp
1009         tests/profiling/gatordmock/CommandFileParser.cpp
1010         tests/profiling/gatordmock/CommandLineProcessor.hpp
1011         tests/profiling/gatordmock/CommandLineProcessor.cpp
1012         tests/profiling/gatordmock/GatordMockService.hpp
1013         tests/profiling/gatordmock/GatordMockService.cpp
1014         tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.cpp
1015         tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp
1016         tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.cpp
1017         tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp
1018         tests/profiling/gatordmock/StreamMetadataCommandHandler.cpp
1019         tests/profiling/gatordmock/StreamMetadataCommandHandler.hpp
1020         )
1021
1022     include_directories(src/profiling tests/profiling tests/profiling/gatordmock src/timelineDecoder)
1023
1024     add_library_ex(gatordMockService STATIC ${gatord_mock_sources})
1025     target_include_directories(gatordMockService PRIVATE src/armnnUtils)
1026
1027     add_executable_ex(GatordMock tests/profiling/gatordmock/GatordMockMain.cpp)
1028     target_include_directories(GatordMock PRIVATE src/armnnUtils)
1029
1030     target_link_libraries(GatordMock
1031         armnn
1032         timelineDecoder
1033         gatordMockService
1034         ${Boost_PROGRAM_OPTIONS_LIBRARY}
1035         ${Boost_SYSTEM_LIBRARY})
1036
1037     if(Threads_FOUND AND (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android)))
1038         target_link_libraries(GatordMock pthread)
1039     endif()
1040
1041 endif()