xref: /aosp_15_r20/external/armnn/delegate/classic/CMakeLists.txt (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1#
2# Copyright © 2023 Arm Ltd and Contributors. All rights reserved.
3# SPDX-License-Identifier: MIT
4#
5
6set(armnnClassicDelegateObject_sources)
7list(APPEND armnnClassicDelegateObject_sources
8        include/armnn_delegate.hpp
9        include/Version.hpp
10        src/armnn_delegate.cpp
11        src/armnn_external_delegate.cpp
12        src/Activation.hpp
13        src/ArgMinMax.hpp
14        src/BatchMatMul.hpp
15        src/BatchSpace.hpp
16        src/ClassicDelegateUtils.hpp
17        src/Comparison.hpp
18        src/Convolution.hpp
19        src/Control.hpp
20        src/ElementwiseBinary.hpp
21        src/ElementwiseUnary.hpp
22        src/Fill.hpp
23        src/FullyConnected.hpp
24        src/Gather.hpp
25        src/GatherNd.hpp
26        src/LogicalBinary.hpp
27        src/Lstm.hpp
28        src/MultiLayerFacade.hpp
29        src/Normalization.hpp
30        src/Pack.hpp
31        src/Pad.hpp
32        src/Pooling.hpp
33        src/Prelu.hpp
34        src/Quantization.hpp
35        src/Redefine.hpp
36        src/Reduce.hpp
37        src/Resize.hpp
38        src/Round.hpp
39        src/Shape.hpp
40        src/SharedFunctions.hpp
41        src/SharedFunctions.cpp
42        src/Slice.hpp
43        src/Softmax.hpp
44        src/SpaceDepth.hpp
45        src/Split.hpp
46        src/Unpack.hpp
47        src/Transpose.hpp)
48
49add_library(armnnClassicDelegateObject OBJECT ${armnnClassicDelegateObject_sources})
50
51target_include_directories(armnnClassicDelegateObject
52        PUBLIC
53            $<INSTALL_INTERFACE:include>
54            $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
55            $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/common/include>
56        PRIVATE
57            ${CMAKE_CURRENT_SOURCE_DIR}/src
58            ${PROJECT_SOURCE_DIR}/common/src)
59
60## Add Tflite dependency
61if(NOT TfLite_INCLUDE_DIR OR NOT TfLite_Schema_INCLUDE_PATH)
62    find_package(TfLiteSrc REQUIRED MODULE)
63endif()
64
65# Various tflite header files are not warning clean
66# We can't change compilation flags on header files directly, so we need to add them to an interface library first
67add_library(tflite_headers INTERFACE)
68target_include_directories(tflite_headers
69        INTERFACE
70            $<BUILD_INTERFACE:${TfLite_INCLUDE_DIR}>
71            $<INSTALL_INTERFACE:include/tflite_headers>)
72
73target_compile_options(tflite_headers
74        INTERFACE
75            -Wno-conversion
76            -Wno-sign-conversion
77            -Wno-unused-parameter
78            -Wno-unused-function)
79
80target_link_libraries(armnnClassicDelegateObject PUBLIC tflite_headers)
81
82## Add Flatbuffers dependency
83find_package(Flatbuffers REQUIRED MODULE)
84
85target_link_libraries(armnnClassicDelegateObject PRIVATE ${Flatbuffers_LIB})
86
87# include/flatbuffers/flatbuffers.h is not warning clean
88# We can't change compilation flags on header files directly, so we need to add them to an interface library first
89add_library(flatbuffer_headers INTERFACE)
90target_include_directories(flatbuffer_headers
91        INTERFACE
92            $<BUILD_INTERFACE:${Flatbuffers_INCLUDE_DIR}>
93            $<INSTALL_INTERFACE:include/flatbuffer_headers>)
94target_compile_options(flatbuffer_headers INTERFACE -Wno-sign-conversion)
95
96target_link_libraries(armnnClassicDelegateObject PUBLIC flatbuffer_headers)
97
98####################################################
99## Export targets
100install(TARGETS armnnClassicDelegateObject
101        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
102        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})