blob: aaba60ec1ca0f3014330902986d4855f3ff7371c [file] [log] [blame]
Eric Kunze2364dcd2021-04-26 11:06:57 -07001#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
19cmake_minimum_required(VERSION 3.13.4)
20project(TosaSerialization)
21
22set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
23set(CMAKE_CXX_STANDARD_REQUIRED YES)
24
25set(CMAKE_VERBOSE_MAKEFILE ON)
26
27include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
28include_directories(${PROJECT_SOURCE_DIR}/third_party/flatbuffers/include)
29
Kevin Cheng87de41f2021-11-03 22:09:42 -070030# Turn off unnecessary flatbuffers targets
31set(FLATBUFFERS_BUILD_TESTS OFF)
32add_subdirectory(third_party/flatbuffers)
33
Eric Kunze2364dcd2021-04-26 11:06:57 -070034add_library(tosa_serialization_lib STATIC
35 src/tosa_serialization_handler.cpp
36 src/numpy_utils.cpp
Kevin Cheng87de41f2021-11-03 22:09:42 -070037)
Eric Kunze2364dcd2021-04-26 11:06:57 -070038
Kevin Cheng87de41f2021-11-03 22:09:42 -070039target_link_libraries(tosa_serialization_lib PRIVATE flatbuffers)
Eric Kunze2364dcd2021-04-26 11:06:57 -070040
41add_executable(serialization_read_write
42 test/src/serialization_read_write.cpp
43)
44
45target_link_libraries(serialization_read_write
46 tosa_serialization_lib
Eric Kunze2364dcd2021-04-26 11:06:57 -070047)
48
49add_executable(serialization_npy_test
50 test/src/serialization_npy_test.cpp
51)
52
53target_link_libraries(serialization_npy_test
54 tosa_serialization_lib
Kevin Cheng87de41f2021-11-03 22:09:42 -070055)
56
57set(TOSA_SERIALIZATION_LIB_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/tosa_serialization_lib")
58
59install(
60 TARGETS tosa_serialization_lib EXPORT TosaSerializationLibTargets
61 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
62 INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
63)
64
65install(EXPORT TosaSerializationLibTargets
66 FILE TosaSerializationLibTargets.cmake
67 NAMESPACE tosa::
68 DESTINATION ${TOSA_SERIALIZATION_LIB_CMAKE_DIR}
Eric Kunze2364dcd2021-04-26 11:06:57 -070069)