Removed protocol check, using CMake now to setup the building scripts using Templates/* removed old scripts
--- a/.hgignore Tue Jun 28 18:33:51 2011 +0200
+++ b/.hgignore Wed Jun 29 18:05:04 2011 +0200
@@ -48,4 +48,4 @@
glob:project_files/Android-build/SDL-android-project/bin
glob:project_files/Android-build/SDL-android-project/gen
glob:project_files/Android-build/out
-glob:project_files/Android-build/DataPackage
+glob:project_files/Android-build/DataPackage/assets/Data/*
--- a/CMakeLists.txt Tue Jun 28 18:33:51 2011 +0200
+++ b/CMakeLists.txt Wed Jun 29 18:05:04 2011 +0200
@@ -185,6 +185,9 @@
add_subdirectory(misc/liblua)
add_subdirectory(hedgewars)
+#Xeli: Should if/endif this one too?
+add_subdirectory(project_files/Android-build)
+
if(NOT BUILD_ENGINE_LIBRARY)
add_subdirectory(bin)
add_subdirectory(QTfrontend)
--- a/hedgewars/uCommandHandlers.pas Tue Jun 28 18:33:51 2011 +0200
+++ b/hedgewars/uCommandHandlers.pas Wed Jun 29 18:05:04 2011 +0200
@@ -84,8 +84,8 @@
begin
val(s, i, c);
if (c <> 0) or (i = 0) then exit;
-//TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old', true);
-//TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new', true)
+TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old', true);
+TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new', true)
end
end;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/CMakeLists.txt Wed Jun 29 18:05:04 2011 +0200
@@ -0,0 +1,60 @@
+set(ANDROID_NDK /home/richard/SoftDev/android/android-ndk-r5b)
+set(ANDROID_SDK /home/richard/SoftDev/android/android-sdk-linux_86)
+set(FPC_DIR /home/richard/SoftDev/fpc-2.4.4)
+set(ANDROID_SDK_API_LVL 8)
+set(ANDROID_NDK_API_LVL 5)
+
+configure_file(Templates/complete_build.sh .)
+configure_file(Templates/default.properties SDL-android-project/)
+configure_file(Templates/local.properties SDL-android-project/)
+configure_file(Templates/default.properties DataPackage/)
+configure_file(Templates/local.properties DataPackage/)
+configure_file(Templates/Makefile.android .)
+configure_file(Templates/pushToDevice.sh .)
+
+set(PREFERED_DIRS
+ Sounds
+ Music
+)
+set(DIRS
+ Fonts
+ Forts
+ Graphics
+ Locale
+ Maps
+ misc
+ Missions
+ Names
+ Scripts
+ Themes
+)
+set(PREFERED_DIRS_PREFIX ../../../../Data)
+set(DIRS_PREFIX ../../../../../share/hedgewars/Data)
+
+if(CMAKE_HOST_WIN32) #Copy the asset files to the proper folder when using windows
+ set(OPERATION copy_directory)
+else(CMAKE_HOST_WIN32)#If it isn't windows we can assume it's unix/darwin which supports symlinks
+ set(OPERATION create_symlink)
+endif(CMAKE_HOST_WIN32)#We can make the above assumption because the android ndk/sdk only support Linux/Windows/Mac
+
+#Copy or symlink the smaller sized resources first
+foreach(DIR ${PREFERED_DIRS})
+ EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}"
+ -E
+ ${OPERATION}
+ ${PREFERED_DIRS_PREFIX}/${DIR}
+ DataPackage/assets/Data/${DIR}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+endforeach(DIR)
+
+#Use the global resources second
+foreach(DIR ${DIRS})
+ EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}"
+ -E
+ ${OPERATION}
+ ${DIRS_PREFIX}/${DIR}
+ DataPackage/assets/Data/${DIR}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+endforeach(DIR)
--- a/project_files/Android-build/Makefile.android Tue Jun 28 18:33:51 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#USER DEFINED
-FPC_DIR=/home/richard/SoftDev/fpc-2.4.4
-ANDROID_NDK=/home/richard/SoftDev/android/android-ndk-r5b
-ANDROID_SDK=/home/richard/SoftDev/android/android-sdk-linux_86
-#END USER DEFINED
-
-SDL_ANDROID_DIR=./SDL-android-project
-ANDROID_API_LVL=5
-
-PPCROSSARM=$(FPC_DIR)/compiler/ppcrossarm
-PPCROSSARM_FLAGS= -Xd -O- -Tlinux -XParm-linux-androideabi- -vwnh -XS -a-
-PPCROSSARM_INCLUDES= \
- -FD$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin \
- -Fu$(FPC_DIR)/rtl/units/arm-linux \
- -Fl$(ANDROID_NDK)/platforms/android-$(ANDROID_API_LVL)/arch-arm/usr/lib \
- -Fl$(SDL_ANDROID_DIR)/libs/armeabi \
- -Fl$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux/arm-linux-androideabi/4.4.3/ \
-#LINKERFLAGS= -k"--static"
-FPC_DEFINES=-dandroid -darm
-
-
-all:
- -mkdir out
- $(PPCROSSARM) $(LINKERFLAGS) $(PPCROSSARM_FLAGS) $(PPCROSSARM_INCLUDES) $(FPC_DEFINES) -oout/libhwengine.so ../../hedgewars/hwLibrary.pas
- cp out/libhwengine.so SDL-android-project/libs/armeabi
-clean:
- rm out/*
--- a/project_files/Android-build/SDL-android-project/default.properties Tue Jun 28 18:33:51 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=android-7
--- a/project_files/Android-build/SDL-android-project/local.properties Tue Jun 28 18:33:51 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must *NOT* be checked in Version Control Systems,
-# as it contains information specific to your local configuration.
-
-# location of the SDK. This is only used by Ant
-# For customization when using a Version Control System, please read the
-# header note.
-sdk.dir=/home/richard/SoftDev/android/android-sdk-linux_86
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/Templates/Makefile.android Wed Jun 29 18:05:04 2011 +0200
@@ -0,0 +1,20 @@
+SDL_ANDROID_DIR=./SDL-android-project
+
+PPCROSSARM=${FPC_DIR}/compiler/ppcrossarm
+PPCROSSARM_FLAGS= -Xd -O- -Tlinux -XParm-linux-androideabi- -vwnh -XS -a-
+PPCROSSARM_INCLUDES= \
+ -FD${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/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}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux/arm-linux-androideabi/4.4.3/ \
+#LINKERFLAGS= -k"--static"
+FPC_DEFINES=-dandroid -darm
+
+
+all:
+ -${CMAKE_COMMAND} -E make_directory out
+ $(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/
+clean:
+ ${CMAKE_COMMAND} -E remove_directory out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/Templates/complete_build.sh Wed Jun 29 18:05:04 2011 +0200
@@ -0,0 +1,27 @@
+#! /bin/sh
+
+
+cd SDL-android-project
+${ANDROID_NDK}/ndk-build
+if [ $? -ne 0 ]
+then
+ echo "Failed to execute ${ANDROID_NDK}/ndk-build"
+ exit 1
+fi
+
+cd ..
+make -f Makefile.android
+if [ $? -ne 0 ]
+then
+ echo "Failed to execute make"
+ exit 1
+fi
+
+cd SDL-android-project
+ant install
+if [ $? -ne 0 ]
+then
+ echo "Failed to execute ant install"
+ exit 1
+fi
+exit 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/Templates/default.properties Wed Jun 29 18:05:04 2011 +0200
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-${ANDROID_SDK_API_LVL}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/Templates/local.properties Wed Jun 29 18:05:04 2011 +0200
@@ -0,0 +1,10 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must *NOT* be checked in Version Control Systems,
+# as it contains information specific to your local configuration.
+
+# location of the SDK. This is only used by Ant
+# For customization when using a Version Control System, please read the
+# header note.
+sdk.dir=${ANDROID_SDK}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/Templates/pushToDevice.sh Wed Jun 29 18:05:04 2011 +0200
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+${ANDROID_SDK}/platform-tools/adb push ./out/libhwengine.so /sdcard/libhwengine.so
+${ANDROID_SDK}/platform-tools/adb shell "su -c \"cat /sdcard/libhwengine.so > /data/data/org.hedgewars/lib/libhwengine.so \""
+
--- a/project_files/Android-build/complete_build Tue Jun 28 18:33:51 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#! /bin/bash
-
-#USER DEFINES
-ANDROID_NDK=/home/richard/SoftDev/android/android-ndk-r5b
-
-#END USER DEFINES
-
-cd SDL-android-project
-$ANDROID_NDK/ndk-build
-if [ $? -ne 0 ]
-then
- echo "Failed to execute $ANDROID_NDK/ndk-build"
- exit 1
-fi
-cd ..
-make -f Makefile.android
-if [ $? -ne 0 ]
-then
- echo "Failed to execute make -f Makefile.android"
- exit 1
-fi
-cd SDL-android-project
-ant install
-if [ $? -ne 0 ]
-then
- echo "Failed to execute ant install"
- exit 1
-fi
-exit 0
--- a/project_files/Android-build/config.inc Tue Jun 28 18:33:51 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-(*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2011 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *)
-
-(*
- * config.inc contains constants that are determined and set
- * by the build system at compile time,
- * based on the contents of config.inc.in
- *)
-const cNetProtoVersion = -1;
- cVersionString = 'android-0.1';
- cLuaLibrary = 'liblua-5.1.so';
--- a/project_files/Android-build/pushToDevice Tue Jun 28 18:33:51 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-adb push ./out/libhwengine.so /sdcard/libhwengine.so
-adb shell "su -c \"cat /sdcard/libhwengine.so > /data/data/org.hedgewars/lib/libhwengine.so \""
-