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