1# Copyright (c) 2013 Google, Inc.
2#
3# This software is provided 'as-is', without any express or implied
4# warranty.  In no event will the authors be held liable for any damages
5# arising from the use of this software.
6# Permission is granted to anyone to use this software for any purpose,
7# including commercial applications, and to alter it and redistribute it
8# freely, subject to the following restrictions:
9# 1. The origin of this software must not be misrepresented; you must not
10# claim that you wrote the original software. If you use this software
11# in a product, an acknowledgment in the product documentation would be
12# appreciated but is not required.
13# 2. Altered source versions must be plainly marked as such, and must not be
14# misrepresented as being the original software.
15# 3. This notice may not be removed or altered from any source distribution.
16
17LOCAL_PATH := $(call my-dir)/../..
18
19include $(LOCAL_PATH)/android/jni/include.mk
20LOCAL_PATH := $(call realpath-portable,$(LOCAL_PATH))
21
22# Empty static library so that other projects can include just the basic
23# FlatBuffers headers as a module.
24include $(CLEAR_VARS)
25LOCAL_MODULE := flatbuffers
26LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-Zlib
27LOCAL_LICENSE_CONDITIONS := notice
28LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE $(LOCAL_PATH)/../../LICENSE.txt
29LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
30LOCAL_EXPORT_CPPFLAGS := -std=c++11 -fexceptions -Wall \
31    -DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE
32
33include $(BUILD_STATIC_LIBRARY)
34
35# static library that additionally includes text parsing/generation/reflection
36# for projects that want richer functionality.
37include $(CLEAR_VARS)
38LOCAL_MODULE := flatbuffers_extra
39LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-Zlib
40LOCAL_LICENSE_CONDITIONS := notice
41LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE $(LOCAL_PATH)/../../LICENSE.txt
42LOCAL_SRC_FILES := src/idl_parser.cpp \
43                   src/idl_gen_text.cpp \
44                   src/reflection.cpp \
45                   src/util.cpp
46LOCAL_STATIC_LIBRARIES := flatbuffers
47LOCAL_ARM_MODE := arm
48include $(BUILD_STATIC_LIBRARY)
49
50# FlatBuffers test
51include $(CLEAR_VARS)
52LOCAL_MODULE := FlatBufferTest
53LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-Zlib
54LOCAL_LICENSE_CONDITIONS := notice
55LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE $(LOCAL_PATH)/../../LICENSE.txt
56LOCAL_SRC_FILES := android/jni/main.cpp \
57                   tests/test.cpp \
58                   tests/test_assert.h \
59                   tests/test_builder.h \
60                   tests/test_assert.cpp \
61                   tests/test_builder.cpp \
62                   tests/native_type_test_impl.h \
63                   tests/native_type_test_impl.cpp \
64                   src/idl_gen_fbs.cpp \
65                   src/code_generators.cpp
66LOCAL_LDLIBS := -llog -landroid -latomic
67LOCAL_STATIC_LIBRARIES := android_native_app_glue flatbuffers_extra
68LOCAL_ARM_MODE := arm
69include $(BUILD_SHARED_LIBRARY)
70
71$(call import-module,android/native_app_glue)
72
73$(call import-add-path,$(LOCAL_PATH)/../..)
74