mirror of https://github.com/axmolengine/axmol.git
smarter script for creating android project
This commit is contained in:
parent
3cff8bee16
commit
c23267834b
|
@ -1,35 +1,43 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# parameters passed to script
|
||||||
# This script should be called by create-android-project.bat
|
# This script should be called by create-android-project.bat
|
||||||
# or should be runned in linux shell. It can not be runned under
|
# or should be runned in linux shell. It can not be runned under cygwin.
|
||||||
# cygwin.
|
|
||||||
# Don't modify the script until you know what you do.
|
# Don't modify the script until you know what you do.
|
||||||
|
PARAMS=$@
|
||||||
|
|
||||||
|
# you can also set the environment here and uncomment them
|
||||||
|
#NDK_ROOT=
|
||||||
|
#ANDROID_SDK_ROOT
|
||||||
|
#COCOS2DX_ROOT
|
||||||
|
|
||||||
# set environment paramters
|
# set environment paramters
|
||||||
NDK_ROOT_LOCAL="/home/laschweinski/android/android-ndk-r5"
|
if [ "x${NDK_ROOT}" == "x" ] ; then
|
||||||
ANDROID_SDK_ROOT_LOCAL="/home/laschweinski/android/android-sdk-linux_86"
|
NDK_ROOT="/opt/android-ndk"
|
||||||
|
|
||||||
NEED_BOX2D=false
|
|
||||||
NEED_CHIPMUNK=false
|
|
||||||
NEED_LUA=false
|
|
||||||
|
|
||||||
# try to get global variable
|
|
||||||
if [ $NDK_ROOT"aaa" != "aaa" ]; then
|
|
||||||
echo "use global definition of NDK_ROOT: $NDK_ROOT"
|
|
||||||
NDK_ROOT_LOCAL=$NDK_ROOT
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $ANDROID_SDK_ROOT"aaa" != "aaa" ]; then
|
if [ "x${ANDROID_SDK_ROOT}" == "x" ] ; then
|
||||||
echo "use global definition of ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT"
|
ANDROID_SDK_ROOT="/opt/android-sdk-update-manager"
|
||||||
ANDROID_SDK_ROOT_LOCAL=$ANDROID_SDK_ROOT
|
fi
|
||||||
|
ANDROID_CMD="${ANDROID_SDK_ROOT}/tools/android"
|
||||||
|
|
||||||
|
if [ "x${COCOS2DX_ROOT}" == "x" ] ; then
|
||||||
|
COCOS2DX_ROOT="${HOME}/cocos2d-x"
|
||||||
|
if [ ! -d $COCOS2DX_ROOT ] ; then
|
||||||
|
COCOS2DX_ROOT=`pwd`
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# parameters passed to .bat or .sh
|
if [ ! -d ${NDK_ROOT} -o ! -d ${ANDROID_SDK_ROOT} -o ! -x ${ANDROID_CMD} ] ; then
|
||||||
PARAMS=
|
echo "Please set the environment at first"
|
||||||
|
fi
|
||||||
|
|
||||||
|
USE_BOX2D=false
|
||||||
|
USE_CHIPMUNK=false
|
||||||
|
USE_LUA=false
|
||||||
|
|
||||||
print_usage(){
|
print_usage(){
|
||||||
echo ERROR!!!
|
echo "usage:"
|
||||||
echo usage
|
echo "$0 [-b|--box2d] [-c|--chipmunk] [-l|--lua]"
|
||||||
echo "$0(or corresponding bat file on windows) [-b|--box2d] [-c|--chipmunk] [-l|--lua]"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_param(){
|
check_param(){
|
||||||
|
@ -38,15 +46,15 @@ check_param(){
|
||||||
case $param in
|
case $param in
|
||||||
-b | --box2d)
|
-b | --box2d)
|
||||||
echo using box2d
|
echo using box2d
|
||||||
NEED_BOX2D=true
|
USE_BOX2D=true
|
||||||
;;
|
;;
|
||||||
-c | --chipmunk)
|
-c | --chipmunk)
|
||||||
echo using chipmunk
|
echo using chipmunk
|
||||||
NEED_CHIPMUNK=true
|
USE_CHIPMUNK=true
|
||||||
;;
|
;;
|
||||||
-l | --lua)
|
-l | --lua)
|
||||||
echo using lua
|
echo using lua
|
||||||
NEED_LUA=true
|
USE_LUA=true
|
||||||
;;
|
;;
|
||||||
-linux)
|
-linux)
|
||||||
// skip it
|
// skip it
|
||||||
|
@ -57,79 +65,76 @@ check_param(){
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $NEED_BOX2D = "true" ]; then
|
if [ $USE_BOX2D == "true" -a $USE_CHIPMUNK == "true" ] ; then
|
||||||
if [ $NEED_CHIPMUNK = "true" ]; then
|
echo '[WARN] Using box2d and chipmunk together!'
|
||||||
echo Warning!!!
|
|
||||||
echo Use box2d and chipmunk together????
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if it was called by .bat file
|
# check if it was called by .bat file
|
||||||
if [ $# -ge 5 ];then
|
if [ $# -ge 5 -a "x$5" == "xwindows" ] ; then
|
||||||
if [ $5 = "windows" ];then
|
# should be called by .bat file
|
||||||
# called by .bat file
|
length=`expr $# - 5`
|
||||||
length=`expr $# - 5`
|
PARAMS=${@:6:$length}
|
||||||
PARAMS=${@:6:$length}
|
check_param
|
||||||
check_param
|
COCOS2DX_ROOT=$COCOS2DX_ROOT sh $COCOS2DX_ROOT/template/android/copy_files.sh $1 $2 $3 $4 $USE_BOX2D $USE_CHIPMUNK $USE_LUA
|
||||||
sh $1/template/android/copy_files.sh $1 $2 $3 $4 $NEED_BOX2D $NEED_CHIPMUNK $NEED_LUA
|
exit
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# the bash file should not be called by cygwin
|
# the bash file should not be called by cygwin
|
||||||
KERNEL_NAME=`uname -s | grep "CYGWIN*"`
|
KERNEL_NAME=`uname -s | grep "CYGWIN*"`
|
||||||
if [ $KERNEL_NAME"hi" != "hi" ]; then
|
if [ "x$KERNEL_NAME" != "x" ] ; then
|
||||||
echo "Error!!!"
|
echo "[ERROR] Don't run in cygwin. You should run .bat file"
|
||||||
echo "Don't run in cygwin. You should run corresponding bat."
|
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ok, it was run under linux
|
# ok, it was run under linux
|
||||||
|
|
||||||
# check it was runned in cocos2d-x root
|
|
||||||
check_path(){
|
|
||||||
if [ ! -f create-android-project.sh ];then
|
|
||||||
echo Error!!!
|
|
||||||
echo Please run in cocos2dx root
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
create_android_project(){
|
create_android_project(){
|
||||||
echo "Input package path. For example: org.cocos2dx.example"
|
DEFAULT_PACKAGE_PATH='org.cocos2dx.demo'
|
||||||
|
DEFAULT_TARGET_ID='1'
|
||||||
|
DEFAULT_PROJECT_NAME="Hello"
|
||||||
|
|
||||||
|
echo -n "Input package path [${DEFAULT_PACKAGE_PATH}]:"
|
||||||
read PACKAGE_PATH
|
read PACKAGE_PATH
|
||||||
echo "Now cocos2d-x supports Android 2.2 or upper version"
|
if [ "x${PACKAGE_PATH}" == "x" ] ; then
|
||||||
$ANDROID_SDK_ROOT_LOCAL/tools/android list targets
|
PACKAGE_PATH=${DEFAULT_PACKAGE_PATH}
|
||||||
echo "input target id:"
|
fi
|
||||||
|
|
||||||
|
${ANDROID_CMD} list targets
|
||||||
|
echo -n "Input target id [${DEFAULT_TARGET_ID}]:"
|
||||||
read TARGET_ID
|
read TARGET_ID
|
||||||
echo "input your project name:"
|
if [ "x${TARGET_ID}" == "x" ] ; then
|
||||||
|
TARGET_ID=${DEFAULT_TARGET_ID}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "Input your project name [${DEFAULT_PROJECT_NAME}]:"
|
||||||
read PROJECT_NAME
|
read PROJECT_NAME
|
||||||
PROJECT_DIR=`pwd`/$PROJECT_NAME
|
if [ "x${PROJECT_NAME}" == "x" ] ; then
|
||||||
|
PROJECT_NAME=${DEFAULT_PROJECT_NAME}
|
||||||
|
fi
|
||||||
|
PROJECT_DIR=`pwd`/${PROJECT_NAME}
|
||||||
|
|
||||||
# check if PROJECT_DIR is exist
|
# check if PROJECT_DIR is exist
|
||||||
if [ -d $PROJECT_DIR ]; then
|
if [ -d $PROJECT_DIR ] ; then
|
||||||
echo "$PROJECT_DIR is exist, please use another name"
|
echo "$PROJECT_DIR already exist, please use another name"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make project directory
|
# Make project directory
|
||||||
mkdir $PROJECT_DIR
|
mkdir $PROJECT_DIR
|
||||||
# Create Android project inside proj.android
|
# Create Android project inside proj.android
|
||||||
$ANDROID_SDK_ROOT_LOCAL/tools/android create project -n $PROJECT_NAME -t $TARGET_ID -k $PACKAGE_PATH -a $PROJECT_NAME -p $PROJECT_DIR/proj.android
|
$ANDROID_CMD create project -n $PROJECT_NAME -t $TARGET_ID -k $PACKAGE_PATH -a $PROJECT_NAME -p $PROJECT_DIR/proj.android
|
||||||
$ANDROID_SDK_ROOT_LOCAL/tools/android update project -l cocos2dx/platform/android/java -p $PROJECT_DIR/proj.android
|
$ANDROID_CMD update project -l ${COCOS2DX_ROOT}/cocos2dx/platform/android/java -p $PROJECT_DIR/proj.android
|
||||||
}
|
}
|
||||||
|
|
||||||
check_path
|
|
||||||
PARAMS=$@
|
|
||||||
check_param
|
check_param
|
||||||
create_android_project
|
create_android_project
|
||||||
|
|
||||||
if [ $0 = "linux" ]; then
|
if [ $0 = "linux" ]; then
|
||||||
# invoked by create-linux-android-project.sh
|
# invoked by create-linux-android-project.sh
|
||||||
sh `pwd`/template/linux/mycopy_files.sh `pwd` $PROJECT_NAME $NDK_ROOT_LOCAL $PACKAGE_PATH $NEED_BOX2D $NEED_CHIPMUNK $NEED_LUA
|
COCOS2DX_ROOT=$COCOS2DX_ROOT sh $COCOS2DX_ROOT/template/linux/mycopy_files.sh $COCOS2DX_ROOT $PROJECT_NAME $NDK_ROOT $PACKAGE_PATH $USE_BOX2D $USE_CHIPMUNK $USE_LUA
|
||||||
else
|
else
|
||||||
# invoke template/android/copy_files.sh
|
# invoke template/android/copy_files.sh
|
||||||
sh `pwd`/template/android/copy_files.sh `pwd` $PROJECT_NAME $NDK_ROOT_LOCAL $PACKAGE_PATH $NEED_BOX2D $NEED_CHIPMUNK $NEED_LUA
|
COCOS2DX_ROOT=$COCOS2DX_ROOT sh $COCOS2DX_ROOT/template/android/copy_files.sh $COCOS2DX_ROOT $PROJECT_DIR $PACKAGE_PATH $USE_BOX2D $USE_CHIPMUNK $USE_LUA
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
PROJECT_PATH=${PWD}
|
||||||
APPNAME="__projectname__"
|
APPNAME="__projectname__"
|
||||||
|
COCOS2DX_ROOT="__cocos2dxroot__"
|
||||||
|
NDK_ROOT="__ndkroot__"
|
||||||
|
DIR=$(cd `dirname $0`;pwd)
|
||||||
|
APP_ROOT=$(cd $DIR/..;pwd)
|
||||||
|
|
||||||
# options
|
# options
|
||||||
|
|
||||||
|
@ -16,35 +22,27 @@ OPTIONS:
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts "sh" OPTION; do
|
while getopts "sh" OPTION ; do
|
||||||
case "$OPTION" in
|
case "$OPTION" in
|
||||||
s)
|
s)
|
||||||
buildexternalsfromsource=1
|
buildexternalsfromsource=1
|
||||||
;;
|
;;
|
||||||
h)
|
h)
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# paths
|
# paths
|
||||||
|
|
||||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
|
||||||
echo "please define NDK_ROOT"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
# ... use paths relative to current directory
|
# ... use paths relative to current directory
|
||||||
COCOS2DX_ROOT="$DIR/../.."
|
|
||||||
APP_ROOT="$DIR/.."
|
|
||||||
APP_ANDROID_ROOT="$DIR"
|
APP_ANDROID_ROOT="$DIR"
|
||||||
|
|
||||||
echo "NDK_ROOT = $NDK_ROOT"
|
#echo "NDK_ROOT = $NDK_ROOT"
|
||||||
echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
#echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
||||||
echo "APP_ROOT = $APP_ROOT"
|
#echo "APP_ROOT = $APP_ROOT"
|
||||||
echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
#echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||||
|
|
||||||
# make sure assets is exist
|
# make sure assets is exist
|
||||||
if [ -d "$APP_ANDROID_ROOT"/assets ]; then
|
if [ -d "$APP_ANDROID_ROOT"/assets ]; then
|
||||||
|
@ -54,29 +52,20 @@ fi
|
||||||
mkdir "$APP_ANDROID_ROOT"/assets
|
mkdir "$APP_ANDROID_ROOT"/assets
|
||||||
|
|
||||||
# copy resources
|
# copy resources
|
||||||
for file in "$APP_ROOT"/Resources/*
|
cp -rf "$APP_ROOT"/Resources/* "$APP_ANDROID_ROOT"/assets
|
||||||
do
|
|
||||||
if [ -d "$file" ]; then
|
|
||||||
cp -rf "$file" "$APP_ANDROID_ROOT"/assets
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$file" ]; then
|
|
||||||
cp "$file" "$APP_ANDROID_ROOT"/assets
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# copy icons (if they exist)
|
# copy icons (if they exist)
|
||||||
file="$APP_ANDROID_ROOT"/assets/Icon-72.png
|
file="$APP_ANDROID_ROOT"/assets/Icon-72.png
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-hdpi/icon.png
|
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-hdpi/icon.png
|
||||||
fi
|
fi
|
||||||
file="$APP_ANDROID_ROOT"/assets/Icon-48.png
|
file="$APP_ANDROID_ROOT"/assets/Icon-48.png
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-mdpi/icon.png
|
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-mdpi/icon.png
|
||||||
fi
|
fi
|
||||||
file="$APP_ANDROID_ROOT"/assets/Icon-32.png
|
file="$APP_ANDROID_ROOT"/assets/Icon-32.png
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-ldpi/icon.png
|
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-ldpi/icon.png
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,59 +1,51 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# check the args
|
# check the args
|
||||||
# $1: root of cocos2dx $2: app name $3: ndk root $4:pakcage path
|
# $1: root of cocos2dx $2: app path $3: pakcage path
|
||||||
|
|
||||||
APP_NAME=$2
|
|
||||||
COCOS2DX_ROOT=$1
|
COCOS2DX_ROOT=$1
|
||||||
APP_DIR=$COCOS2DX_ROOT/$APP_NAME
|
APP_DIR=$2
|
||||||
|
PACKAGE_PATH=$3
|
||||||
|
USE_BOX2D=$4
|
||||||
|
USE_CHIPMUNK=$5
|
||||||
|
USE_LUA=$6
|
||||||
|
|
||||||
|
APP_NAME=`basename ${APP_DIR}`
|
||||||
HELLOWORLD_ROOT=$COCOS2DX_ROOT/samples/Cpp/HelloCpp
|
HELLOWORLD_ROOT=$COCOS2DX_ROOT/samples/Cpp/HelloCpp
|
||||||
COCOSJAVALIB_ROOT=$COCOS2DX_ROOT/cocos2dx/platform/android/java
|
COCOSJAVALIB_ROOT=$COCOS2DX_ROOT/cocos2dx/platform/android/java
|
||||||
NDK_ROOT=$3
|
|
||||||
PACKAGE_PATH=$4
|
|
||||||
NEED_BOX2D=$5
|
|
||||||
NEED_CHIPMUNK=$6
|
|
||||||
NEED_LUA=$7
|
|
||||||
|
|
||||||
# xxx.yyy.zzz -> xxx/yyy/zzz
|
# xxx.yyy.zzz -> xxx/yyy/zzz
|
||||||
convert_package_path_to_dir(){
|
convert_package_path_to_dir(){
|
||||||
PACKAGE_PATH_DIR=`echo $1 | sed -e "s/\./\//g"`
|
PACKAGE_PATH_DIR=`echo $1 | sed -e "s/\./\//g"`
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_cpp_h(){
|
copy_cpp_h() {
|
||||||
mkdir $APP_DIR/Classes
|
mkdir $APP_DIR/Classes
|
||||||
for file in $COCOS2DX_ROOT/template/android/Classes/*
|
cp $COCOS2DX_ROOT/template/android/Classes/* $APP_DIR/Classes
|
||||||
do
|
|
||||||
cp $file $APP_DIR/Classes
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# copy resources
|
# copy resources
|
||||||
copy_resouces(){
|
copy_resouces() {
|
||||||
mkdir $APP_DIR/Resources
|
mkdir $APP_DIR/Resources
|
||||||
|
cp -rf $HELLOWORLD_ROOT/Resources/iphone/* $APP_DIR/Resources
|
||||||
for file in $HELLOWORLD_ROOT/Resources/iphone/*
|
|
||||||
do
|
|
||||||
cp -rf $file $APP_DIR/Resources
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# from HelloWorld copy src and jni to APP_DIR
|
# from HelloWorld copy src and jni to APP_DIR
|
||||||
copy_src_and_jni(){
|
copy_src_and_jni() {
|
||||||
cp -rf $HELLOWORLD_ROOT/proj.android/jni $APP_DIR/proj.android
|
cp -rf $HELLOWORLD_ROOT/proj.android/{jni,src} $APP_DIR/proj.android
|
||||||
cp -rf $HELLOWORLD_ROOT/proj.android/src $APP_DIR/proj.android
|
|
||||||
|
|
||||||
# replace Android.mk
|
# replace Android.mk
|
||||||
sh $COCOS2DX_ROOT/template/android/gamemk.sh $APP_DIR/proj.android/jni/Android.mk $NEED_BOX2D $NEED_CHIPMUNK $NEED_LUA
|
sh $COCOS2DX_ROOT/template/android/gamemk.sh $APP_DIR/proj.android/jni/Android.mk $USE_BOX2D $USE_CHIPMUNK $USE_LUA
|
||||||
}
|
}
|
||||||
|
|
||||||
# copy build_native.sh and replace something
|
# copy build_native.sh and replace something
|
||||||
copy_build_native(){
|
copy_build_native() {
|
||||||
# here should use # instead of /, why??
|
# here should use # instead of /, why??
|
||||||
sed "s#__cocos2dxroot__#$COCOS2DX_ROOT#;s#__ndkroot__#$NDK_ROOT#;s#__projectname__#$APP_NAME#" $COCOS2DX_ROOT/template/android/build_native.sh > $APP_DIR/proj.android/build_native.sh
|
sed "s#__cocos2dxroot__#$COCOS2DX_ROOT#;s#__ndkroot__#$NDK_ROOT#;s#__projectname__#$APP_NAME#" $COCOS2DX_ROOT/template/android/build_native.sh > $APP_DIR/proj.android/build_native.sh
|
||||||
chmod u+x $APP_DIR/proj.android/build_native.sh
|
chmod u+x $APP_DIR/proj.android/build_native.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
# copy debugger script and replace templated parameters
|
# copy debugger script and replace templated parameters
|
||||||
copy_ndkgdb(){
|
copy_ndkgdb() {
|
||||||
sed "s#__projectname__#$APP_NAME#;s#__packagename__#$PACKAGE_PATH#" $COCOS2DX_ROOT/template/android/ndkgdb.sh > $APP_DIR/proj.android/ndkgdb.sh
|
sed "s#__projectname__#$APP_NAME#;s#__packagename__#$PACKAGE_PATH#" $COCOS2DX_ROOT/template/android/ndkgdb.sh > $APP_DIR/proj.android/ndkgdb.sh
|
||||||
chmod u+x $APP_DIR/proj.android/ndkgdb.sh
|
chmod u+x $APP_DIR/proj.android/ndkgdb.sh
|
||||||
}
|
}
|
||||||
|
@ -71,7 +63,7 @@ modify_androidmanifest(){
|
||||||
}
|
}
|
||||||
|
|
||||||
# modify HelloCpp.java
|
# modify HelloCpp.java
|
||||||
modify_applicationdemo(){
|
modify_applicationdemo() {
|
||||||
convert_package_path_to_dir $PACKAGE_PATH
|
convert_package_path_to_dir $PACKAGE_PATH
|
||||||
|
|
||||||
# rename APP_DIR/android/src/org/cocos2dx/hellocpp/HelloCpp.java to
|
# rename APP_DIR/android/src/org/cocos2dx/hellocpp/HelloCpp.java to
|
||||||
|
@ -80,13 +72,13 @@ modify_applicationdemo(){
|
||||||
rm -fr $APP_DIR/proj.android/src/org/cocos2dx/hellocpp
|
rm -fr $APP_DIR/proj.android/src/org/cocos2dx/hellocpp
|
||||||
}
|
}
|
||||||
|
|
||||||
modify_layout(){
|
modify_layout() {
|
||||||
rm -f $APP_DIR/proj.android/res/layout/main.xml
|
rm -f $APP_DIR/proj.android/res/layout/main.xml
|
||||||
}
|
}
|
||||||
|
|
||||||
# android.bat of android 4.0 don't create res/drawable-hdpi res/drawable-ldpi and res/drawable-mdpi.
|
# android.bat of android 4.0 don't create res/drawable-hdpi res/drawable-ldpi and res/drawable-mdpi.
|
||||||
# These work are done in ADT
|
# These work are done in ADT
|
||||||
copy_icon(){
|
copy_icon() {
|
||||||
if [ ! -d $APP_DIR/proj.android/res/drawable-hdpi ]; then
|
if [ ! -d $APP_DIR/proj.android/res/drawable-hdpi ]; then
|
||||||
cp -r $HELLOWORLD_ROOT/proj.android/res/drawable-hdpi $APP_DIR/proj.android/res
|
cp -r $HELLOWORLD_ROOT/proj.android/res/drawable-hdpi $APP_DIR/proj.android/res
|
||||||
cp -r $HELLOWORLD_ROOT/proj.android/res/drawable-ldpi $APP_DIR/proj.android/res
|
cp -r $HELLOWORLD_ROOT/proj.android/res/drawable-ldpi $APP_DIR/proj.android/res
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
FILE=$1
|
FILE=$1
|
||||||
NEED_BOX2D=$2
|
USE_BOX2D=$2
|
||||||
NEED_CHIPMUNK=$3
|
USE_CHIPMUNK=$3
|
||||||
NEED_LUA=$4
|
USE_LUA=$4
|
||||||
|
|
||||||
LOCAL_STATIC_LIBRARIES="LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static"
|
LOCAL_STATIC_LIBRARIES="LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static"
|
||||||
MODULES_TO_CALL="\$(call import-module,CocosDenshion/android) \\
|
MODULES_TO_CALL="\$(call import-module,CocosDenshion/android) \\
|
||||||
|
@ -14,17 +14,17 @@ LOCAL_SRC_FILES="LOCAL_SRC_FILES := hellocpp/main.cpp \\
|
||||||
../../Classes/AppDelegate.cpp \\
|
../../Classes/AppDelegate.cpp \\
|
||||||
../../Classes/HelloWorldScene.cpp"
|
../../Classes/HelloWorldScene.cpp"
|
||||||
|
|
||||||
if [ $NEED_BOX2D = "true" ];then
|
if [ $USE_BOX2D = "true" ];then
|
||||||
LOCAL_STATIC_LIBRARIES=$LOCAL_STATIC_LIBRARIES" box2d_static"
|
LOCAL_STATIC_LIBRARIES=$LOCAL_STATIC_LIBRARIES" box2d_static"
|
||||||
MODULES_TO_CALL=$MODULES_TO_CALL" \$(call import-module,external/Box2D)"
|
MODULES_TO_CALL=$MODULES_TO_CALL" \$(call import-module,external/Box2D)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $NEED_CHIPMUNK = "true" ]; then
|
if [ $USE_CHIPMUNK = "true" ]; then
|
||||||
LOCAL_STATIC_LIBRARIES=$LOCAL_STATIC_LIBRARIES" chipmunk_static"
|
LOCAL_STATIC_LIBRARIES=$LOCAL_STATIC_LIBRARIES" chipmunk_static"
|
||||||
MODULES_TO_CALL=$MODULES_TO_CALL" \$(call import-module,external/chipmunk)"
|
MODULES_TO_CALL=$MODULES_TO_CALL" \$(call import-module,external/chipmunk)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $NEED_LUA = "true" ]; then
|
if [ $USE_LUA = "true" ]; then
|
||||||
LOCAL_STATIC_LIBRARIES=$LOCAL_STATIC_LIBRARIES" cocos_lua_static"
|
LOCAL_STATIC_LIBRARIES=$LOCAL_STATIC_LIBRARIES" cocos_lua_static"
|
||||||
MODULES_TO_CALL=$MODULES_TO_CALL" \$(call import-module,scripting/lua/proj.android)"
|
MODULES_TO_CALL=$MODULES_TO_CALL" \$(call import-module,scripting/lua/proj.android)"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue