project_files/Android-build/Templates/Makefile.android
author simmax@googlemail.com
Fri, 23 Mar 2012 00:21:34 +0100
changeset 6807 f4816282ba01
parent 6686 bdb7c67eba06
child 6812 929b467c7277
permissions -rw-r--r--
Improved cmake build script for Android: - Error out when Ant or android can't be found - Attempt to find the NDK toolchain binaries on Windows and Linux instead of assuming Linux - Use find_program instead of find_path to find some binaries - ANDROID_SDK now refers to the Android SDK base directory - Fixed detection of android.bat on Windows - Output of the android tool is now shown so that success/failure is visible

SDL_ANDROID_DIR=./SDL-android-project

PPCROSSARM=${FPC_DIR}/ppcrossarm
PPCROSSARM_FLAGS= -Xd -O2 -g -Tlinux -XParm-linux-androideabi- -B -vwnh
PPCROSSARM_INCLUDES= \
	-FD${ANDROID_NDK_TOOLCHAINDIR}/bin \
	-Fu${FPC_DIR}/rtl/units/arm-linux \
	-Fl${ANDROID_NDK}/platforms/android-${ANDROID_NDK_API_LVL}/arch-arm/usr/lib \
	-Fl$(SDL_ANDROID_DIR)/libs/armeabi \
	-Fl${ANDROID_NDK_TOOLCHAINDIR}/lib/gcc/arm-linux/arm-linux-androideabi/4.4.3/ \
#LINKERFLAGS= -k"--static"
FPC_DEFINES=-dandroid -darm

all: install
build:
	-${CMAKE_COMMAND} -E make_directory out

	${ANDROID_NDK}/ndk-build -C $(SDL_ANDROID_DIR) -j 8

	$(PPCROSSARM) $(LINKERFLAGS) $(PPCROSSARM_FLAGS) $(PPCROSSARM_INCLUDES) $(FPC_DEFINES) -oout/libhwengine.so ../../hedgewars/hwLibrary.pas
	${CMAKE_COMMAND} -E copy out/libhwengine.so SDL-android-project/libs/armeabi/
	${ANT} clean -f $(SDL_ANDROID_DIR)/build.xml
	${ANT} debug -f $(SDL_ANDROID_DIR)/build.xml
install: build
	${ANT} installd -f $(SDL_ANDROID_DIR)/build.xml
       
clean:  
	${CMAKE_COMMAND} -E remove_directory out
	${ANDROID_NDK}/ndk-build -C $(SDL_ANDROID_DIR) -j 8 clean
	${ANT} clean -f $(SDL_ANDROID_DIR)/build.xml