• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright © 2023 Arm Ltd and Contributors. All rights reserved.
3# SPDX-License-Identifier: MIT
4#
5
6set(armnnOpaqueDelegateObject_sources)
7list(APPEND armnnOpaqueDelegateObject_sources
8        include/armnn_delegate.hpp
9        include/Version.hpp
10        src/armnn_delegate.cpp
11        src/Redefine.hpp)
12
13add_library(armnnOpaqueDelegateObject OBJECT ${armnnOpaqueDelegateObject_sources})
14
15target_include_directories(armnnOpaqueDelegateObject
16        PUBLIC
17            $<INSTALL_INTERFACE:include>
18            $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
19            $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/common/include>
20        PRIVATE
21            ${CMAKE_CURRENT_SOURCE_DIR}/src
22            ${PROJECT_SOURCE_DIR}/common/src)
23
24## Add Tflite dependency
25if(NOT TfLite_INCLUDE_DIR OR NOT TfLite_Schema_INCLUDE_PATH)
26    find_package(TfLiteSrc REQUIRED MODULE)
27endif()
28
29# Various tflite header files are not warning clean
30# We can't change compilation flags on header files directly, so we need to add them to an interface library first
31add_library(tflite_headers_opaque INTERFACE)
32target_include_directories(tflite_headers_opaque
33        INTERFACE
34            $<BUILD_INTERFACE:${TfLite_INCLUDE_DIR}>
35            $<INSTALL_INTERFACE:include/tflite_headers_opaque>)
36
37target_compile_options(tflite_headers_opaque
38        INTERFACE
39            -Wno-conversion
40            -Wno-sign-conversion
41            -Wno-unused-parameter
42            -Wno-unused-function)
43
44target_link_libraries(armnnOpaqueDelegateObject PUBLIC tflite_headers_opaque)
45
46## Add Flatbuffers dependency
47find_package(Flatbuffers REQUIRED MODULE)
48
49target_link_libraries(armnnOpaqueDelegateObject PRIVATE ${Flatbuffers_LIB})
50
51# include/flatbuffers/flatbuffers.h is not warning clean
52# We can't change compilation flags on header files directly, so we need to add them to an interface library first
53add_library(flatbuffer_headers_opaque INTERFACE)
54target_include_directories(flatbuffer_headers_opaque
55        INTERFACE
56            $<BUILD_INTERFACE:${Flatbuffers_INCLUDE_DIR}>
57            $<INSTALL_INTERFACE:include/flatbuffer_headers_opaque>)
58target_compile_options(flatbuffer_headers_opaque INTERFACE -Wno-sign-conversion)
59
60target_link_libraries(armnnOpaqueDelegateObject PUBLIC flatbuffer_headers_opaque)
61
62####################################################
63## Export targets
64install(TARGETS armnnOpaqueDelegateObject
65        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
66        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})