Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 1 | #TOSA serialization library |
| 2 | |
| 3 | # Copyright (c) 2020-2021, ARM Limited. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # Contains TOSA flatbuffer serialization library content. |
| 18 | |
| 19 | cmake_minimum_required(VERSION 3.13.4) |
| 20 | project(TosaSerialization) |
| 21 | |
| 22 | set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to") |
| 23 | set(CMAKE_CXX_STANDARD_REQUIRED YES) |
| 24 | |
| 25 | set(CMAKE_VERBOSE_MAKEFILE ON) |
| 26 | |
| 27 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) |
| 28 | include_directories(${PROJECT_SOURCE_DIR}/third_party/flatbuffers/include) |
| 29 | |
Kevin Cheng | 87de41f | 2021-11-03 22:09:42 -0700 | [diff] [blame] | 30 | # Turn off unnecessary flatbuffers targets |
| 31 | set(FLATBUFFERS_BUILD_TESTS OFF) |
| 32 | add_subdirectory(third_party/flatbuffers) |
| 33 | |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 34 | add_library(tosa_serialization_lib STATIC |
| 35 | src/tosa_serialization_handler.cpp |
| 36 | src/numpy_utils.cpp |
Kevin Cheng | 87de41f | 2021-11-03 22:09:42 -0700 | [diff] [blame] | 37 | ) |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 38 | |
Kevin Cheng | 87de41f | 2021-11-03 22:09:42 -0700 | [diff] [blame] | 39 | target_link_libraries(tosa_serialization_lib PRIVATE flatbuffers) |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 40 | |
| 41 | add_executable(serialization_read_write |
| 42 | test/src/serialization_read_write.cpp |
| 43 | ) |
| 44 | |
| 45 | target_link_libraries(serialization_read_write |
| 46 | tosa_serialization_lib |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 47 | ) |
| 48 | |
| 49 | add_executable(serialization_npy_test |
| 50 | test/src/serialization_npy_test.cpp |
| 51 | ) |
| 52 | |
| 53 | target_link_libraries(serialization_npy_test |
| 54 | tosa_serialization_lib |
Kevin Cheng | 87de41f | 2021-11-03 22:09:42 -0700 | [diff] [blame] | 55 | ) |
| 56 | |
| 57 | set(TOSA_SERIALIZATION_LIB_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/tosa_serialization_lib") |
| 58 | |
| 59 | install( |
| 60 | TARGETS tosa_serialization_lib EXPORT TosaSerializationLibTargets |
| 61 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 62 | INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} |
| 63 | ) |
| 64 | |
| 65 | install(EXPORT TosaSerializationLibTargets |
| 66 | FILE TosaSerializationLibTargets.cmake |
| 67 | NAMESPACE tosa:: |
| 68 | DESTINATION ${TOSA_SERIALIZATION_LIB_CMAKE_DIR} |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 69 | ) |