• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# For more information about using CMake with Android Studio, read the
2# documentation: https://d.android.com/studio/projects/add-native-code.html
3
4# Sets the minimum version of CMake required to build the native library.
5
6cmake_minimum_required(VERSION 3.4.1)
7
8include_directories(${FLATBUFFERS_SRC}/include)
9
10set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -fexceptions -Wall -DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE")
11
12# Certain platforms such as ARM do not use signed chars by default
13# which causes issues with certain bounds checks.
14set(CMAKE_CXX_FLAGS
15   "${CMAKE_CXX_FLAGS} -fsigned-char")
16
17set(FlatBuffers_Library_SRCS
18        ${FLATBUFFERS_SRC}/include/flatbuffers/base.h
19        ${FLATBUFFERS_SRC}/include/flatbuffers/flatbuffers.h
20        ${FLATBUFFERS_SRC}/include/flatbuffers/hash.h
21        ${FLATBUFFERS_SRC}/include/flatbuffers/idl.h
22        ${FLATBUFFERS_SRC}/include/flatbuffers/util.h
23        ${FLATBUFFERS_SRC}/include/flatbuffers/reflection.h
24        ${FLATBUFFERS_SRC}/include/flatbuffers/reflection_generated.h
25        ${FLATBUFFERS_SRC}/include/flatbuffers/stl_emulation.h
26        ${FLATBUFFERS_SRC}/include/flatbuffers/flexbuffers.h
27        ${FLATBUFFERS_SRC}/include/flatbuffers/registry.h
28        ${FLATBUFFERS_SRC}/include/flatbuffers/minireflect.h
29        ${FLATBUFFERS_SRC}/src/idl_parser.cpp
30        ${FLATBUFFERS_SRC}/src/idl_gen_text.cpp
31        ${FLATBUFFERS_SRC}/src/reflection.cpp
32        ${FLATBUFFERS_SRC}/src/util.cpp
33        ${FLATBUFFERS_SRC}/src/idl_gen_fbs.cpp
34        ${FLATBUFFERS_SRC}/src/code_generators.cpp
35        )
36
37set(FlatBuffers_Test_SRCS
38        ${FLATBUFFERS_SRC}/tests/test.cpp
39        ${FLATBUFFERS_SRC}/tests/test_assert.h
40        ${FLATBUFFERS_SRC}/tests/test_builder.h
41        ${FLATBUFFERS_SRC}/tests/test_assert.cpp
42        ${FLATBUFFERS_SRC}/tests/test_builder.cpp
43        ${FLATBUFFERS_SRC}/tests/native_type_test_impl.h
44        ${FLATBUFFERS_SRC}/tests/native_type_test_impl.cpp
45)
46
47add_library( # Sets the name of the library.
48             flatbuffers
49
50             ${FlatBuffers_Library_SRCS}
51             ${FlatBuffers_Test_SRCS}
52             ${Generated_SRCS}
53)
54
55add_library( # Sets the name of the library.
56             flatbuffers_tests
57
58             ${FlatBuffers_Test_SRCS}
59)
60