Merge pull request #2021 from dumganhar/iss1733-hybrid

issue #1733: Updated multi-platform-lua/proj.android/build_native.sh.
This commit is contained in:
James Chen 2013-02-21 01:25:19 -08:00
commit 9332b7ae6c
1 changed files with 10 additions and 36 deletions

View File

@ -11,8 +11,8 @@ usage: $0 [options]
Build C/C++ code for $APPNAME using Android NDK Build C/C++ code for $APPNAME using Android NDK
OPTIONS: OPTIONS:
-s Build externals from source -s Build externals from source
-h this help -h this help
EOF EOF
} }
@ -30,23 +30,16 @@ done
# paths # paths
if [ -z "${NDK_ROOT+aaa}" ]; then if [ -z "${NDK_ROOT+aaa}" ];then
# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk" echo "please define NDK_ROOT"
NDK_ROOT="$HOME/bin/android-ndk" exit 1
fi fi
if [ -z "${COCOS2DX_ROOT+aaa}" ]; then DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... if COCOS2DX_ROOT is not set
# ... find current working directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory # ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../.." COCOS2DX_ROOT="$DIR/../../.."
APP_ROOT="$DIR/.." APP_ROOT="$DIR/.."
APP_ANDROID_ROOT="$DIR" APP_ANDROID_ROOT="$DIR"
else
APP_ROOT="$COCOS2DX_ROOT"/samples/Lua/"$APPNAME"
APP_ANDROID_ROOT="$COCOS2DX_ROOT"/samples/Lua/"$APPNAME"/proj.android
fi
echo "NDK_ROOT = $NDK_ROOT" echo "NDK_ROOT = $NDK_ROOT"
echo "COCOS2DX_ROOT = $COCOS2DX_ROOT" echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
@ -61,18 +54,6 @@ fi
mkdir "$APP_ANDROID_ROOT"/assets mkdir "$APP_ANDROID_ROOT"/assets
# copy resources # copy resources
for file in "$APP_ROOT"/../../Cpp/TestCpp/Resources/*
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 luaScript
for file in "$APP_ROOT"/Resources/* for file in "$APP_ROOT"/Resources/*
do do
if [ -d "$file" ]; then if [ -d "$file" ]; then
@ -84,13 +65,6 @@ if [ -f "$file" ]; then
fi fi
done done
# remove test_image_rgba4444.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
if [[ "$buildexternalsfromsource" ]]; then if [[ "$buildexternalsfromsource" ]]; then
echo "Building external dependencies from source" echo "Building external dependencies from source"
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
@ -99,4 +73,4 @@ else
echo "Using prebuilt externals" echo "Using prebuilt externals"
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt" "NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt"
fi fi