Home | History | Annotate | Download | only in jni
      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 
     17 LOCAL_PATH := $(call my-dir)
     18 FLATBUFFERS_ROOT_DIR := $(LOCAL_PATH)/../../..
     19 
     20 # FlatBuffers test
     21 include $(CLEAR_VARS)
     22 
     23 # Include the FlatBuffer utility function to generate header files from schemas.
     24 include $(FLATBUFFERS_ROOT_DIR)/android/jni/include.mk
     25 
     26 LOCAL_MODULE := FlatBufferSample
     27 
     28 # Set up some useful variables to identify schema and output directories and
     29 # schema files.
     30 ANDROID_SAMPLE_GENERATED_OUTPUT_DIR := $(LOCAL_PATH)/gen/include
     31 ANDROID_SAMPLE_SCHEMA_DIR := $(LOCAL_PATH)/schemas
     32 ANDROID_SAMPLE_SCHEMA_FILES := $(ANDROID_SAMPLE_SCHEMA_DIR)/animal.fbs
     33 
     34 LOCAL_C_INCLUDES := $(ANDROID_SAMPLE_GENERATED_OUTPUT_DIR)
     35 
     36 $(info $(LOCAL_C_INCLUDES))
     37 
     38 LOCAL_SRC_FILES := main.cpp
     39 
     40 LOCAL_CPPFLAGS := -std=c++11 -fexceptions -Wall -Wno-literal-suffix
     41 LOCAL_LDLIBS := -llog -landroid -latomic
     42 LOCAL_ARM_MODE := arm
     43 LOCAL_STATIC_LIBRARIES := android_native_app_glue flatbuffers
     44 
     45 ifeq (,$(ANDROID_SAMPLE_RUN_ONCE))
     46 ANDROID_SAMPLE_RUN_ONCE := 1
     47 $(call flatbuffers_header_build_rules,$(ANDROID_SAMPLE_SCHEMA_FILES),$(ANDROID_SAMPLE_SCHEMA_DIR),$(ANDROID_SAMPLE_GENERATED_OUTPUT_DIR),,$(LOCAL_SRC_FILES))
     48 endif
     49 
     50 include $(BUILD_SHARED_LIBRARY)
     51 
     52 # Path to Flatbuffers root directory.
     53 $(call import-add-path,$(FLATBUFFERS_ROOT_DIR)/..)
     54 
     55 $(call import-module,flatbuffers/android/jni)
     56 $(call import-module,android/native_app_glue)
     57