• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
3# SPDX-License-Identifier: MIT
4#
5if(BUILD_ARMNN_DESERIALIZER)
6    find_program(FLATC flatc
7                 HINTS ${FLATC_DIR}
8                 DOC "Path to 'flatc', the flatbuffers compiler")
9    if (NOT FLATC)
10        message(SEND_ERROR "flatc not found. Specify the full path of the flatc executable with -DFLATC=<flatc path>")
11    endif()
12
13    add_custom_command(
14        # Generate an ArmnnSchema_generated.h file if it doesn't exist, or update it when necessary otherwise
15        OUTPUT ArmnnSchema_generated.h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../armnnSerializer/ArmnnSchema.fbs
16        COMMAND ${FLATC} -o ${CMAKE_CURRENT_BINARY_DIR} --cpp ${CMAKE_CURRENT_SOURCE_DIR}/../armnnSerializer/ArmnnSchema.fbs
17    )
18
19    set(armnn_deserializer_sources)
20    list(APPEND armnn_deserializer_sources
21        ArmnnSchema_generated.h
22        Deserializer.hpp
23        Deserializer.cpp
24        )
25
26    add_library_ex(armnnDeserializer SHARED ${armnn_deserializer_sources})
27
28    include_directories(SYSTEM "${FLATBUFFERS_INCLUDE_PATH}")
29    set_target_properties(armnnDeserializer PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
30    target_include_directories(armnnDeserializer PRIVATE ../armnn)
31    target_include_directories(armnnDeserializer PRIVATE ../armnnUtils)
32
33    # System include to suppress warnings for flatbuffers generated files
34    target_include_directories(armnnDeserializer SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
35
36    target_link_libraries(armnnDeserializer armnn ${FLATBUFFERS_LIBRARY})
37
38    install(TARGETS armnnDeserializer
39            EXPORT armnn-targets
40            LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
41            ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
42    )
43    set_target_properties(armnnDeserializer PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
44endif()
45