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 8# Creates and names a library, sets it as either STATIC 9# or SHARED, and provides the relative paths to its source code. 10# You can define multiple libraries, and CMake builds them for you. 11# Gradle automatically packages shared libraries with your APK. 12 13include_directories(${FLATBUFFERS_SRC}/include) 14 15add_subdirectory(flatbuffers) 16 17FILE(GLOB Generated_SRCS generated/*.h) 18 19add_library( # Sets the name of the library. 20 native-lib 21 22 # Sets the library as a shared library. 23 SHARED 24 25 # Provides a relative path to your source file(s). 26 animals.cpp 27 ${Generated_SRCS} 28 29) 30 31# Searches for a specified prebuilt library and stores the path as a 32# variable. Because CMake includes system libraries in the search path by 33# default, you only need to specify the name of the public NDK library 34# you want to add. CMake verifies that the library exists before 35# completing its build. 36 37find_library( # Sets the name of the path variable. 38 log-lib 39 40 # Specifies the name of the NDK library that 41 # you want CMake to locate. 42 log ) 43 44# Specifies libraries CMake should link to your target library. You 45# can link multiple libraries, such as libraries you define in this 46# build script, prebuilt third-party libraries, or system libraries. 47 48target_link_libraries( # Specifies the target library. 49 native-lib 50 flatbuffers 51 flatbuffers_tests 52 # Links the target library to the log library 53 # included in the NDK. 54 ${log-lib} ) 55