Game Development Reference
In-Depth Information
APP_ABI := armeabi-v7a x86
APP_MODULES := FreeImage
2.
The Android.mk ile is similar to the ones we have written for the sample
applications in the previous chapter, yet with a few exceptions. At the top of the ile,
some required variables must be deined. Let us see what the Android.mk ile for
the FreeImage library may look like:
# Android API level
TARGET_PLATFORM := android-8
# local directory
LOCAL_PATH := $(call my-dir)
# the command to reset the compiler flags to the empty state
include $(CLEAR_VARS)
# use the complete ARM instruction set
LOCAL_ARM_MODE := arm
# define the library name and the name of the .a file
LOCAL_MODULE := FreeImage
# add the include directories
LOCAL_C_INCLUDES += src \
# add the list of source files
LOCAL_SRC_FILES += <ListOfSourceFiles>
3. Deine some common compiler options: treat all warnings as errors ( -Werror ), the
ANDROID pre-processing symbol is deined, and the system include directory is set:
COMMON_CFLAGS := -Werror -DANDROID -isystem
$(SYSROOT)/usr/include/
4. The compilation lags are ixed, according to the selected CPU architecture:
ifeq ($(TARGET_ARCH),x86)
LOCAL_CFLAGS := $(COMMON_CFLAGS)
else
LOCAL_CFLAGS := -mfpu=vfp -mfloat-abi=softfp -fno-short-enums
$(COMMON_CFLAGS)
endif
5.
Since we are building a static library, we need the following line at the end of the
makeile:
include $(BUILD_STATIC_LIBRARY)
How it works...
The Android NDK developers provide their own set of rules to build applications and libraries.
In the previous chapter we saw how to build a shared object ile with the .so extension.
Here we just replace the BUILD_SHARED_LIBRARY symbol to the BUILD_STATIC_LIBRARY
and explicitly list the source iles required to build each object ile.
 
Search WWH ::




Custom Search