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