mirror of https://github.com/axmolengine/axmol.git
Merge pull request #1147 from folecr/morefixandroidbuildscript
Further clean up of android build scripts and template
This commit is contained in:
commit
60983e8a02
|
@ -44,8 +44,8 @@ if [ -z "${COCOS2DX_ROOT+aaa}" ]; then
|
|||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
else
|
||||
APP_ROOT="$COCOS2DX_ROOT/samples/$APPNAME"
|
||||
APP_ANDROID_ROOT="$COCOS2DX_ROOT/samples/$APPNAME/proj.android"
|
||||
APP_ROOT="$COCOS2DX_ROOT"/samples/"$APPNAME"
|
||||
APP_ANDROID_ROOT="$COCOS2DX_ROOT"/samples/"$APPNAME"/proj.android
|
||||
fi
|
||||
|
||||
echo "NDK_ROOT = $NDK_ROOT"
|
||||
|
@ -54,30 +54,30 @@ echo "APP_ROOT = $APP_ROOT"
|
|||
echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||
|
||||
# make sure assets is exist
|
||||
if [ -d "$APP_ANDROID_ROOT/assets" ]; then
|
||||
rm -rf $APP_ANDROID_ROOT/assets
|
||||
if [ -d "$APP_ANDROID_ROOT"/assets ]; then
|
||||
rm -rf "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
mkdir $APP_ANDROID_ROOT/assets
|
||||
mkdir "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy resources
|
||||
for file in $APP_ROOT/Resources/*
|
||||
for file in "$APP_ROOT"/Resources/*
|
||||
do
|
||||
if [ -d "$file" ]; then
|
||||
cp -rf $file $APP_ANDROID_ROOT/assets
|
||||
cp -rf "$file" "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
if [ -f "$file" ]; then
|
||||
cp $file $APP_ANDROID_ROOT/assets
|
||||
cp "$file" "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$buildexternalsfromsource" ]]; then
|
||||
echo "Building external dependencies from source"
|
||||
$NDK_ROOT/ndk-build -C $APP_ANDROID_ROOT $* \
|
||||
NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source"
|
||||
else
|
||||
echo "Using prebuilt externals"
|
||||
$NDK_ROOT/ndk-build -C $APP_ANDROID_ROOT $* \
|
||||
NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt"
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# set params
|
||||
NDK_ROOT_LOCAL=/home/james/Software/android/android-ndk-r8b
|
||||
COCOS2DX_ROOT_LOCAL=/home/james/Project/cocos2d-x
|
||||
APPNAME="HelloLua"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
|
||||
|
@ -8,7 +8,7 @@ usage(){
|
|||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ native code using Android NDK
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
|
@ -16,7 +16,7 @@ OPTIONS:
|
|||
EOF
|
||||
}
|
||||
|
||||
while getopts "s" OPTION; do
|
||||
while getopts "sh" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
|
@ -28,48 +28,56 @@ exit 0
|
|||
esac
|
||||
done
|
||||
|
||||
# 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
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ]; then
|
||||
# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk"
|
||||
NDK_ROOT="$HOME/bin/android-ndk"
|
||||
fi
|
||||
|
||||
if [ $COCOS2DX_ROOT"aaa" != "aaa" ]; then
|
||||
echo "use global definition of COCOS2DX_ROOT: $COCOS2DX_ROOT"
|
||||
COCOS2DX_ROOT_LOCAL=$COCOS2DX_ROOT
|
||||
if [ -z "${COCOS2DX_ROOT+aaa}" ]; then
|
||||
# ... if COCOS2DX_ROOT is not set
|
||||
# ... find current working directory
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
else
|
||||
APP_ROOT="$COCOS2DX_ROOT"/samples/"$APPNAME"
|
||||
APP_ANDROID_ROOT="$COCOS2DX_ROOT"/samples/"$APPNAME"/proj.android
|
||||
fi
|
||||
|
||||
GAME_ROOT=$COCOS2DX_ROOT_LOCAL/samples/HelloLua
|
||||
GAME_ANDROID_ROOT=$GAME_ROOT/proj.android
|
||||
GAME_RESOURCE_ROOT=$GAME_ROOT/Resources
|
||||
echo "NDK_ROOT = $NDK_ROOT"
|
||||
echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
||||
echo "APP_ROOT = $APP_ROOT"
|
||||
echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||
|
||||
# make sure assets is exist
|
||||
if [ -d $GAME_ANDROID_ROOT/assets ]; then
|
||||
rm -rf $GAME_ANDROID_ROOT/assets
|
||||
if [ -d "$APP_ANDROID_ROOT"/assets ]; then
|
||||
rm -rf "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
mkdir $GAME_ANDROID_ROOT/assets
|
||||
mkdir "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy resources
|
||||
for file in $GAME_RESOURCE_ROOT/*
|
||||
for file in "$APP_ROOT"/Resources/*
|
||||
do
|
||||
if [ -d $file ]; then
|
||||
cp -rf $file $GAME_ANDROID_ROOT/assets
|
||||
if [ -d "$file" ]; then
|
||||
cp -rf "$file" "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
if [ -f $file ]; then
|
||||
cp $file $GAME_ANDROID_ROOT/assets
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# build
|
||||
if [[ $buildexternalsfromsource ]]; then
|
||||
echo "Building external dependencies from source"
|
||||
$NDK_ROOT_LOCAL/ndk-build -C $GAME_ANDROID_ROOT $* \
|
||||
NDK_MODULE_PATH=${COCOS2DX_ROOT_LOCAL}:${COCOS2DX_ROOT_LOCAL}/cocos2dx/platform/third_party/android/source
|
||||
if [[ "$buildexternalsfromsource" ]]; then
|
||||
echo "Building external dependencies from source"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source"
|
||||
else
|
||||
echo "Using prebuilt externals"
|
||||
$NDK_ROOT_LOCAL/ndk-build -C $GAME_ANDROID_ROOT $* \
|
||||
NDK_MODULE_PATH=${COCOS2DX_ROOT_LOCAL}:${COCOS2DX_ROOT_LOCAL}/cocos2dx/platform/third_party/android/prebuilt
|
||||
echo "Using prebuilt externals"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt"
|
||||
fi
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/bash
|
||||
# set params
|
||||
NDK_ROOT_LOCAL=/home/james/Software/android/android-ndk-r8b
|
||||
COCOS2DX_ROOT_LOCAL=/home/james/Project/cocos2d-x
|
||||
APPNAME="TestCpp"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
|
||||
|
@ -9,7 +8,7 @@ usage(){
|
|||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ native code using Android NDK
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
|
@ -17,7 +16,7 @@ OPTIONS:
|
|||
EOF
|
||||
}
|
||||
|
||||
while getopts "s" OPTION; do
|
||||
while getopts "sh" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
|
@ -29,52 +28,63 @@ exit 0
|
|||
esac
|
||||
done
|
||||
|
||||
# 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
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ]; then
|
||||
# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk"
|
||||
NDK_ROOT="$HOME/bin/android-ndk"
|
||||
fi
|
||||
|
||||
if [ $COCOS2DX_ROOT"aaa" != "aaa" ]; then
|
||||
echo "use global definition of COCOS2DX_ROOT: $COCOS2DX_ROOT"
|
||||
COCOS2DX_ROOT_LOCAL=$COCOS2DX_ROOT
|
||||
if [ -z "${COCOS2DX_ROOT+aaa}" ]; then
|
||||
# ... if COCOS2DX_ROOT is not set
|
||||
# ... find current working directory
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
else
|
||||
APP_ROOT="$COCOS2DX_ROOT"/samples/"$APPNAME"
|
||||
APP_ANDROID_ROOT="$COCOS2DX_ROOT"/samples/"$APPNAME"/proj.android
|
||||
fi
|
||||
|
||||
TESTS_ROOT=$COCOS2DX_ROOT_LOCAL/samples/TestCpp/proj.android
|
||||
echo "NDK_ROOT = $NDK_ROOT"
|
||||
echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
||||
echo "APP_ROOT = $APP_ROOT"
|
||||
echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||
|
||||
# make sure assets is exist
|
||||
if [ -d $TESTS_ROOT/assets ]; then
|
||||
rm -rf $TESTS_ROOT/assets
|
||||
if [ -d "$APP_ANDROID_ROOT"/assets ]; then
|
||||
rm -rf "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
mkdir $TESTS_ROOT/assets
|
||||
mkdir "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy resources
|
||||
for file in $COCOS2DX_ROOT_LOCAL/samples/TestCpp/Resources/*
|
||||
for file in "$APP_ROOT"/Resources/*
|
||||
do
|
||||
if [ -d $file ]; then
|
||||
cp -rf $file $TESTS_ROOT/assets
|
||||
if [ -d "$file" ]; then
|
||||
cp -rf "$file" "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
if [ -f $file ]; then
|
||||
cp $file $TESTS_ROOT/assets
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
done
|
||||
|
||||
# remove test_image_rgba4444.pvr.gz
|
||||
rm -f $TESTS_ROOT/assets/Images/test_image_rgba4444.pvr.gz
|
||||
rm -f $TESTS_ROOT/assets/Images/test_1021x1024_rgba8888.pvr.gz
|
||||
rm -f $TESTS_ROOT/assets/Images/test_1021x1024_rgb888.pvr.gz
|
||||
rm -f $TESTS_ROOT/assets/Images/test_1021x1024_rgba4444.pvr.gz
|
||||
rm -f $TESTS_ROOT/assets/Images/test_1021x1024_a8.pvr.gz
|
||||
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_image_rgba4444.pvr.gz
|
||||
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgba8888.pvr.gz
|
||||
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgb888.pvr.gz
|
||||
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgba4444.pvr.gz
|
||||
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_a8.pvr.gz
|
||||
|
||||
# build
|
||||
if [[ $buildexternalsfromsource ]]; then
|
||||
echo "Building external dependencies from source"
|
||||
$NDK_ROOT_LOCAL/ndk-build -C $TESTS_ROOT $* \
|
||||
NDK_MODULE_PATH=${COCOS2DX_ROOT_LOCAL}:${COCOS2DX_ROOT_LOCAL}/cocos2dx/platform/third_party/android/source
|
||||
if [[ "$buildexternalsfromsource" ]]; then
|
||||
echo "Building external dependencies from source"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source"
|
||||
else
|
||||
echo "Using prebuilt externals"
|
||||
$NDK_ROOT_LOCAL/ndk-build -C $TESTS_ROOT $* \
|
||||
NDK_MODULE_PATH=${COCOS2DX_ROOT_LOCAL}:${COCOS2DX_ROOT_LOCAL}/cocos2dx/platform/third_party/android/prebuilt
|
||||
echo "Using prebuilt externals"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt"
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# set params
|
||||
NDK_ROOT_LOCAL=/home/james/Software/android/android-ndk-r8b
|
||||
COCOS2DX_ROOT_LOCAL=/home/james/Project/cocos2d-x
|
||||
APPNAME="TestJavascript"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
|
||||
|
@ -8,7 +8,7 @@ usage(){
|
|||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ native code using Android NDK
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
|
@ -16,7 +16,7 @@ OPTIONS:
|
|||
EOF
|
||||
}
|
||||
|
||||
while getopts "s" OPTION; do
|
||||
while getopts "sh" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
|
@ -28,45 +28,56 @@ exit 0
|
|||
esac
|
||||
done
|
||||
|
||||
# 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
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ]; then
|
||||
# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk"
|
||||
NDK_ROOT="$HOME/bin/android-ndk"
|
||||
fi
|
||||
|
||||
if [ $COCOS2DX_ROOT"aaa" != "aaa" ]; then
|
||||
echo "use global definition of COCOS2DX_ROOT: $COCOS2DX_ROOT"
|
||||
COCOS2DX_ROOT_LOCAL=$COCOS2DX_ROOT
|
||||
if [ -z "${COCOS2DX_ROOT+aaa}" ]; then
|
||||
# ... if COCOS2DX_ROOT is not set
|
||||
# ... find current working directory
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
else
|
||||
APP_ROOT="$COCOS2DX_ROOT"/samples/"$APPNAME"
|
||||
APP_ANDROID_ROOT="$COCOS2DX_ROOT"/samples/"$APPNAME"/proj.android
|
||||
fi
|
||||
|
||||
TEST_JS_ROOT=$COCOS2DX_ROOT_LOCAL/samples/TestJavascript/proj.android
|
||||
echo "NDK_ROOT = $NDK_ROOT"
|
||||
echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
||||
echo "APP_ROOT = $APP_ROOT"
|
||||
echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||
|
||||
# make sure assets is exist
|
||||
if [ -d $TEST_JS_ROOT/assets ]; then
|
||||
rm -rf $TEST_JS_ROOT/assets
|
||||
if [ -d "$APP_ANDROID_ROOT"/assets ]; then
|
||||
rm -rf "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
mkdir $TEST_JS_ROOT/assets
|
||||
mkdir "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy resources
|
||||
for file in $COCOS2DX_ROOT_LOCAL/samples/TestJavascript/Resources/*
|
||||
for file in "$APP_ROOT"/Resources/*
|
||||
do
|
||||
if [ -d "$file" ]; then
|
||||
cp -rf "$file" $TEST_JS_ROOT/assets
|
||||
cp -rf "$file" "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" $TEST_JS_ROOT/assets
|
||||
cp "$file" "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
if [[ $buildexternalsfromsource ]]; then
|
||||
echo "Building external dependencies from source"
|
||||
$NDK_ROOT_LOCAL/ndk-build -C $TEST_JS_ROOT $* \
|
||||
NDK_MODULE_PATH=${COCOS2DX_ROOT_LOCAL}:${COCOS2DX_ROOT_LOCAL}/cocos2dx/platform/third_party/android/prebuilt
|
||||
if [[ "$buildexternalsfromsource" ]]; then
|
||||
echo "Building external dependencies from source"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source"
|
||||
else
|
||||
echo "Using prebuilt externals"
|
||||
$NDK_ROOT_LOCAL/ndk-build -C $TEST_JS_ROOT $* \
|
||||
NDK_MODULE_PATH=${COCOS2DX_ROOT_LOCAL}:${COCOS2DX_ROOT_LOCAL}/cocos2dx/platform/third_party/android/prebuilt
|
||||
echo "Using prebuilt externals"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt"
|
||||
fi
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
# set params
|
||||
NDK_ROOT=__ndkroot__
|
||||
COCOS2DX_ROOT=__cocos2dxroot__
|
||||
GAME_ROOT=$COCOS2DX_ROOT/__projectname__
|
||||
GAME_ANDROID_ROOT=$GAME_ROOT/proj.android
|
||||
RESOURCE_ROOT=$GAME_ROOT/Resources
|
||||
APPNAME="__projectname__"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
|
||||
|
@ -11,69 +8,91 @@ usage(){
|
|||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ native code using Android NDK
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
-h this help
|
||||
-s Build externals from source
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "s" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
while getopts "sh" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# make sure assets is exist
|
||||
if [ -d $GAME_ANDROID_ROOT/assets ]; then
|
||||
rm -rf $GAME_ANDROID_ROOT/assets
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ]; then
|
||||
# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk"
|
||||
NDK_ROOT="__ndkroot__"
|
||||
fi
|
||||
|
||||
mkdir $GAME_ANDROID_ROOT/assets
|
||||
if [ -z "${COCOS2DX_ROOT+aaa}" ]; then
|
||||
# ... if COCOS2DX_ROOT is not set
|
||||
# ... find current working directory
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
else
|
||||
APP_ROOT="$COCOS2DX_ROOT"/"$APPNAME"
|
||||
APP_ANDROID_ROOT="$COCOS2DX_ROOT"/"$APPNAME"/proj.android
|
||||
fi
|
||||
|
||||
echo "NDK_ROOT = $NDK_ROOT"
|
||||
echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
||||
echo "APP_ROOT = $APP_ROOT"
|
||||
echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||
|
||||
# make sure assets is exist
|
||||
if [ -d "$APP_ANDROID_ROOT"/assets ]; then
|
||||
rm -rf "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
mkdir "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy resources
|
||||
for file in $RESOURCE_ROOT/*
|
||||
for file in "$APP_ROOT"/Resources/*
|
||||
do
|
||||
if [ -d "$file" ]; then
|
||||
cp -rf "$file" $GAME_ANDROID_ROOT/assets
|
||||
fi
|
||||
if [ -d "$file" ]; then
|
||||
cp -rf "$file" "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" $GAME_ANDROID_ROOT/assets
|
||||
fi
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
done
|
||||
|
||||
# copy icons (if they exist)
|
||||
file=$GAME_ANDROID_ROOT/assets/Icon-72.png
|
||||
file="$APP_ANDROID_ROOT"/assets/Icon-72.png
|
||||
if [ -f "$file" ]; then
|
||||
cp $file $GAME_ANDROID_ROOT/res/drawable-hdpi/icon.png
|
||||
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-hdpi/icon.png
|
||||
fi
|
||||
file=$GAME_ANDROID_ROOT/assets/Icon-48.png
|
||||
file="$APP_ANDROID_ROOT"/assets/Icon-48.png
|
||||
if [ -f "$file" ]; then
|
||||
cp $file $GAME_ANDROID_ROOT/res/drawable-mdpi/icon.png
|
||||
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-mdpi/icon.png
|
||||
fi
|
||||
file=$GAME_ANDROID_ROOT/assets/Icon-32.png
|
||||
file="$APP_ANDROID_ROOT"/assets/Icon-32.png
|
||||
if [ -f "$file" ]; then
|
||||
cp $file $GAME_ANDROID_ROOT/res/drawable-ldpi/icon.png
|
||||
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-ldpi/icon.png
|
||||
fi
|
||||
|
||||
|
||||
if [[ $buildexternalsfromsource ]]; then
|
||||
if [[ "$buildexternalsfromsource" ]]; then
|
||||
echo "Building external dependencies from source"
|
||||
$NDK_ROOT/ndk-build -C $GAME_ANDROID_ROOT \
|
||||
NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source"
|
||||
else
|
||||
echo "Using prebuilt externals"
|
||||
$NDK_ROOT/ndk-build -C $GAME_ANDROID_ROOT \
|
||||
NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue