Game Development Reference
In-Depth Information
You have created the basic Android architecture for the Quake engine, plus you've
performed the required changes to the native engine. You now have all the pieces to get
Quake up and running in your Android device. Let's look at how this happens.
Running on a Device
Before running on a device, the very first thing you need to do is compile the native library.
To do this, you must create the compilation scripts: Application.mk and Android.mk .
Application.mk is tiny. It contains the name of the modules you want to build and the path
to Android.mk , which is the real compilation script. In this case, you want to compile two
modules: NanoGL as a static library (so it can be reused in Chapter 7) and the Quake engine.
NanoGL compiles into libNanoGL.a , and Quake compiles into libquake.so and includes
libNanGL.a .
APP_BUILD_SCRIPT := $(call my-dir)/Quake/Android.mk
APP_MODULES := NanoGL quake
Android.mk is where all the meat lives. The first thing it does is compile the NanoGL static
library, as follows:
LOCAL_MODULE := NanoGL
DIR:= $(LOCAL_MODULE)
LOCAL_C_INCLUDES := jni/Quake/NanoGL/GL
LOCAL_SRC_FILES := $(DIR)/eglwrap.cpp $(DIR)/nanogl.cpp $(DIR)/nanoWrap.cpp
include $(BUILD_STATIC_LIBRARY)
LOCAL_MODULE : Specifies the module to compile.
LOCAL_C_INCLUDES : Specifies a list of directories where to look for
header files.
LOCAL_SRC_FILES : Specifies the source files to compile.
BUILD_STATIC_LIBRARY : Calls the Android build system to create
libNanoGL.a.
Next, Android.mk compiles the Quake engine, as shown in Listing 6-18.
Listing 6-18. Android.mk Fragment to Compile the Quake Engine
LOCAL_MODULE := quake
LOCAL_CFLAGS := -O3 -DANDROID -DGLQUAKE -Wfatal-errors \
-D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstricmp=strcasecmp \
-Dstrnicmp=strncasecmp
LOCAL_C_INCLUDES := jni/Quake/android jni/Quake/NanoGL
LOCAL_LDLIBS := -ldl -llog
LOCAL_STATIC_LIBRARIES := libNanoGL
 
Search WWH ::




Custom Search