Game Development Reference
In-Depth Information
Tip By including another script within Android.mk , the compilation process will resume from
the last file whenever updates are performed to the included script.
In hardlinkedq2gl.mk , you build NanoGL as a static library first. Note that the source code
lives in Chapter 6.
# hardlinkedq2gl.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
DIR:= ../../ch06.Quake/jni/Quake/NanoGL
LOCAL_MODULE := NanoGL
LOCAL_C_INCLUDES := ../ch06.Quake/jni/Quake/NanoGL/GL
LOCAL_SRC_FILES := $(DIR)/eglwrap.cpp $(DIR)/nanogl.cpp \
$(DIR)/nanoWrap.cpp
include $(BUILD_STATIC_LIBRARY)
Next, you build Quake II as a shared library ( libquake2.so; see Listing 7-10). Note the
following compiler options:
-DANDROID : It tells the compiler to use the custom Android code declared
throughout the engine.
-DGLQUAKE : It tells the compiler to build the OpenGL renderer
-DLIBQUAKE2 : It tells the compiler to use custom Quake II code.
-Dstricmp=strcasecmp : It replaces all occurrences of stricmp with
strcasecmp for string comparison. Some Linux C-library implementations
don't include stricmp .
-DREF_HARD_LINKED : This is a critical option. It tells the compiler to pack
the renderer and client modules as a single monolithic file. This makes
the build/debug/run process much simpler in mobile platforms.
-DGAME_HARD_LINKED : Another critical option. It tells the compiler to
include the game module in the pack.
Listing 7-10. Quake II Android Compilation Script
# hardlinkedq2gl.mk
BUILDDIR:=quake2-3.21
include $(CLEAR_VARS)
LOCAL_MODULE := quake2
 
Search WWH ::




Custom Search