blob: 6e345f57605a0825caf835d1b18f371ced88fde8 [file] [log] [blame]
Teresa Charlinad1b3d72023-03-14 12:10:28 +00001#
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
Francis Murtaghc4fb0dd2023-03-16 17:01:56 +00009 include/Version.hpp
10 src/armnn_delegate.cpp)
Teresa Charlinad1b3d72023-03-14 12:10:28 +000011
12add_library(armnnOpaqueDelegateObject OBJECT ${armnnOpaqueDelegateObject_sources})
13
14target_include_directories(armnnOpaqueDelegateObject
15 PUBLIC
16 $<INSTALL_INTERFACE:include>
17 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
18 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/common/include>
19 PRIVATE
20 ${CMAKE_CURRENT_SOURCE_DIR}/src
21 ${PROJECT_SOURCE_DIR}/common/src)
22
23## Add Tflite dependency
24if(NOT TfLite_INCLUDE_DIR OR NOT TfLite_Schema_INCLUDE_PATH)
25 find_package(TfLiteSrc REQUIRED MODULE)
26endif()
27
28# Various tflite header files are not warning clean
29# We can't change compilation flags on header files directly, so we need to add them to an interface library first
30add_library(tflite_headers_opaque INTERFACE)
31target_include_directories(tflite_headers_opaque
32 INTERFACE
33 $<BUILD_INTERFACE:${TfLite_INCLUDE_DIR}>
34 $<INSTALL_INTERFACE:include/tflite_headers_opaque>)
35
36target_compile_options(tflite_headers_opaque
37 INTERFACE
38 -Wno-conversion
39 -Wno-sign-conversion
40 -Wno-unused-parameter
41 -Wno-unused-function)
42
43target_link_libraries(armnnOpaqueDelegateObject PUBLIC tflite_headers_opaque)
44
45## Add Flatbuffers dependency
46find_package(Flatbuffers REQUIRED MODULE)
47
48target_link_libraries(armnnOpaqueDelegateObject PRIVATE ${Flatbuffers_LIB})
49
50# include/flatbuffers/flatbuffers.h is not warning clean
51# We can't change compilation flags on header files directly, so we need to add them to an interface library first
52add_library(flatbuffer_headers_opaque INTERFACE)
53target_include_directories(flatbuffer_headers_opaque
54 INTERFACE
55 $<BUILD_INTERFACE:${Flatbuffers_INCLUDE_DIR}>
56 $<INSTALL_INTERFACE:include/flatbuffer_headers_opaque>)
57target_compile_options(flatbuffer_headers_opaque INTERFACE -Wno-sign-conversion)
58
59target_link_libraries(armnnOpaqueDelegateObject PUBLIC flatbuffer_headers_opaque)
60
61####################################################
62## Export targets
63install(TARGETS armnnOpaqueDelegateObject
64 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
65 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})