mirror of https://github.com/axmolengine/axmol.git
Merge pull request #4029 from minggo/iss2905-adjust_folder
use build/android-build to build android samples, and update readme
This commit is contained in:
commit
9e5420c954
22
README.md
22
README.md
|
@ -23,14 +23,15 @@ How to start a new game
|
|||
-----------------------
|
||||
|
||||
1. Download the code from [cocos2d download site][4]
|
||||
2. Enter `tools/project-creator`
|
||||
|
||||
2. Run the `create-multi-platform-projects.py` script
|
||||
2. Run the `create-projects.py` script
|
||||
|
||||
Example:
|
||||
|
||||
$ cd cocos2d-x
|
||||
$ cd cocos2d-x/tools/project-creator
|
||||
$ ./create-multi-platform-projects.py -p mygame -k com.your_company.mygame -l cpp
|
||||
$ cd projects/mygame
|
||||
$ cd ../../projects/mygame
|
||||
|
||||
|
||||
Main features
|
||||
|
@ -79,9 +80,6 @@ Runtime Requirements
|
|||
* Android 2.3+ for Android games
|
||||
* OS X v10.6+ for Mac games
|
||||
* Windows 7+ for Win games
|
||||
* Tizen 2.2+
|
||||
* Emscripten
|
||||
* Google Native Client
|
||||
|
||||
|
||||
Running Tests
|
||||
|
@ -92,28 +90,26 @@ Select the test you want from Xcode Scheme chooser.
|
|||
* For OS X / iOS
|
||||
|
||||
```
|
||||
$ cd cocos2d-x/samples
|
||||
$ cd cocos2d-x/build
|
||||
$ open samples.xcodeproj
|
||||
```
|
||||
|
||||
* For Linux
|
||||
|
||||
```
|
||||
$ cd cocos2d-x
|
||||
$ cd cocos2d-x/build
|
||||
$ ./make-all-linux-projects.sh
|
||||
```
|
||||
|
||||
or open the `cocos2d-x/cocos2dx-qt5.pro` file using QT Creator 5.
|
||||
|
||||
* For Windows
|
||||
|
||||
Open the `cocos2d-x/cocos2d-win32.vc2012.sln`
|
||||
Open the `cocos2d-x/build/cocos2d-win32.vc2012.sln`
|
||||
|
||||
* For Android
|
||||
|
||||
```
|
||||
$ cd cocos2d-x/samples/Cpp/HelloCpp/proj.android
|
||||
$ ./build_native.sh
|
||||
$ cd cocos2d-x/build
|
||||
$ python ./android-build.py hellocpp
|
||||
```
|
||||
|
||||
Import HelloCpp Android project using Eclipse(released with Android SDK). The path to be imported is `cocos2d-x/samples/Cpp/HelloCpp/proj.android`.
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
# begin
|
||||
import sys
|
||||
import os, os.path
|
||||
import shutil
|
||||
from optparse import OptionParser
|
||||
|
||||
CPP_SAMPLES = ['hellocpp', 'testcpp', 'simplegame', 'assetsmanager']
|
||||
|
@ -62,7 +63,7 @@ def caculate_built_samples(args):
|
|||
'jsb' for short of all javascript samples
|
||||
'''
|
||||
|
||||
if 'all' == args:
|
||||
if 'all' in args:
|
||||
return ALL_SAMPLES
|
||||
|
||||
targets = []
|
||||
|
@ -100,6 +101,63 @@ def do_build(cocos_root, ndk_root, app_android_root, ndk_build_param):
|
|||
command = '%s -C %s %s %s' % (ndk_path, app_android_root, ndk_build_param, ndk_module_path)
|
||||
os.system(command)
|
||||
|
||||
def copy_files(src, dst):
|
||||
|
||||
for item in os.listdir(src):
|
||||
path = os.path.join(src, item)
|
||||
# Android can not package the file that ends with ".gz"
|
||||
if not item.startswith('.') and not item.endswith('.gz') and os.path.isfile(path):
|
||||
shutil.copy(path, dst)
|
||||
if os.path.isdir(path):
|
||||
new_dst = os.path.join(dst, item)
|
||||
os.mkdir(new_dst)
|
||||
copy_files(path, new_dst)
|
||||
|
||||
def copy_resources(target, app_android_root):
|
||||
|
||||
# remove app_android_root/assets if it exists
|
||||
assets_dir = os.path.join(app_android_root, "assets")
|
||||
if os.path.isdir(assets_dir):
|
||||
shutil.rmtree(assets_dir)
|
||||
|
||||
# copy resources(cpp samples and lua samples)
|
||||
os.mkdir(assets_dir)
|
||||
resources_dir = os.path.join(app_android_root, "../Resources")
|
||||
if os.path.isdir(resources_dir):
|
||||
copy_files(resources_dir, assets_dir)
|
||||
|
||||
# jsb samples should copy javascript files and resources(shared with cocos2d-html5)
|
||||
if target in JSB_SAMPLES or target == "assetsmanager":
|
||||
resources_dir = os.path.join(app_android_root, "../../../../cocos/scripting/javascript/script")
|
||||
copy_files(resources_dir, assets_dir)
|
||||
|
||||
if target == "cocosdragon":
|
||||
resources_dir = os.path.join(app_android_root, "../../Shared/games/CocosDragonJS/Published files Android")
|
||||
if target == "crystalcraze":
|
||||
resources_dir = os.path.join(app_android_root, "../../Shared/games/CrystalCraze/Published-Android")
|
||||
if target == "moonwarriors":
|
||||
resources_dir = os.path.join(app_android_root, "../../Shared/games/MoonWarriors/res")
|
||||
if target == "testjavascript":
|
||||
resources_dir = os.path.join(app_android_root, "../../Shared/tests/")
|
||||
if target == "watermelonwithme":
|
||||
resources_dir = os.path.join(app_android_root, "../../Shared/games/WatermelonWithMe")
|
||||
copy_files(resources_dir, assets_dir)
|
||||
|
||||
# AssetsManager test should also copy javascript files
|
||||
if target == "assetsmanager":
|
||||
resources_dir = os.path.join(app_android_root, "../../../../cocos/scripting/javascript/script")
|
||||
copy_files(resources_dir, assets_dir)
|
||||
|
||||
# lua samples should copy lua script
|
||||
if target in LUA_SAMPLES:
|
||||
resources_dir = os.path.join(app_android_root, "../../../../cocos/scripting/lua/script")
|
||||
copy_files(resources_dir, assets_dir)
|
||||
|
||||
# TestLua shared resources with TestCpp
|
||||
if target == "testlua":
|
||||
resources_dir = os.path.join(app_android_root, "../../../Cpp/TestCpp/Resources")
|
||||
copy_files(resources_dir, assets_dir)
|
||||
|
||||
def build_samples(target,ndk_build_param):
|
||||
|
||||
ndk_root = check_environment_variables()
|
||||
|
@ -137,6 +195,7 @@ def build_samples(target,ndk_build_param):
|
|||
print 'unknown target %s, pass it', target
|
||||
continue
|
||||
|
||||
copy_resources(target, app_android_root)
|
||||
do_build(cocos_root, ndk_root, app_android_root, ndk_build_param)
|
||||
|
||||
# -------------- main --------------
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
@echo off
|
||||
|
||||
set APPNAME="AssetsManager"
|
||||
|
||||
set buildexternalsfromsource=
|
||||
set PARALLEL_BUILD_FLAG=
|
||||
|
||||
goto :getopts
|
||||
|
||||
:usage
|
||||
echo Build C/C++ code for %APPNAME% using Android NDK
|
||||
echo OPTIONS:
|
||||
echo -s Build externals from source
|
||||
echo -h this help
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:def
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:getopts
|
||||
set "par=%~1"
|
||||
if "%par%"=="" (goto :L)
|
||||
if "%~1"=="-s" set /a buildexternalsfromsource=1
|
||||
if "%~1"=="-h" goto :usage
|
||||
shift
|
||||
goto :getopts
|
||||
|
||||
:L
|
||||
set NDK_ROOT=%NDK_ROOT%
|
||||
if "%NDK_ROOT%"=="" goto:def
|
||||
|
||||
rem check toolchains
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.8 (goto :toolchains48)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.7 (goto :toolchains47)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.6 (goto :toolchains46)
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:toolchains48
|
||||
set NDK_TOOLCHAIN_VERSION=4.8
|
||||
goto :InitPath
|
||||
:toolchains47
|
||||
set NDK_TOOLCHAIN_VERSION=4.7
|
||||
goto :InitPath
|
||||
:toolchains46
|
||||
set NDK_TOOLCHAIN_VERSION=4.6
|
||||
|
||||
:InitPath
|
||||
|
||||
set COCOS2DX_ROOT=%~dp0..\..\..\..
|
||||
set APP_ROOT=%~dp0..
|
||||
set APP_ANDROID_ROOT=%~dp0
|
||||
set BINDINGS_JS_ROOT=%COCOS2DX_ROOT%\cocos\scripting\javascript\script
|
||||
|
||||
if "%buildexternalsfromsource%"=="1" (goto :MODULE1) else (goto :MODULE2)
|
||||
:MODULE1
|
||||
echo "Building external dependencies from source"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos2dx\platform\third_party\android\source
|
||||
goto :COPY_RES
|
||||
:MODULE2
|
||||
echo "Using prebuilt externals"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos;%COCOS2DX_ROOT%\external
|
||||
|
||||
:COPY_RES
|
||||
echo NDK_ROOT = %NDK_ROOT%
|
||||
echo COCOS2DX_ROOT=%COCOS2DX_ROOT%
|
||||
echo APP_ROOT=%APP_ROOT%
|
||||
echo APP_ANDROID_ROOT=%APP_ANDROID_ROOT%
|
||||
echo NDK_TOOLCHAIN_VERSION=%NDK_TOOLCHAIN_VERSION%
|
||||
|
||||
rem make sure assets is exist
|
||||
if exist %APP_ANDROID_ROOT%\assets rd /q /s %APP_ANDROID_ROOT%\assets
|
||||
|
||||
mkdir %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy Resources/* into assets' root
|
||||
xcopy /e /q /r /y %APP_ROOT%\Resources\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy bindings/*.js into assets' root
|
||||
xcopy /e /q /r /y %BINDINGS_JS_ROOT%\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
call %NDK_ROOT%\ndk-build.cmd NDK_LOG=0 V=0 %*
|
||||
pause
|
|
@ -1,123 +0,0 @@
|
|||
APPNAME="AssetsManager"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "sh" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# read local.properties
|
||||
|
||||
_LOCALPROPERTIES_FILE=$(dirname "$0")"/local.properties"
|
||||
if [ -f "$_LOCALPROPERTIES_FILE" ]
|
||||
then
|
||||
[ -r "$_LOCALPROPERTIES_FILE" ] || die "Fatal Error: $_LOCALPROPERTIES_FILE exists but is unreadable"
|
||||
|
||||
# strip out entries with a "." because Bash cannot process variables with a "."
|
||||
_PROPERTIES=`sed '/\./d' "$_LOCALPROPERTIES_FILE"`
|
||||
for line in "$_PROPERTIES"; do
|
||||
declare "$line";
|
||||
done
|
||||
fi
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For compatibility of android-ndk-r9, 4.7 was removed from r9
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.7
|
||||
echo "The Selected NDK toolchain version was 4.7 !"
|
||||
else
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.8
|
||||
echo "The Selected NDK toolchain version was 4.8 !"
|
||||
else
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
BINDINGS_JS_ROOT="$APP_ROOT/../../../cocos/scripting/javascript/script"
|
||||
|
||||
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 "$APP_ROOT"/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 bindings/*.js into assets' root
|
||||
cp -rf "$BINDINGS_JS_ROOT"/* "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy icons (if they exist)
|
||||
file="$APP_ANDROID_ROOT"/assets/Icon-72.png
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-hdpi/icon.png
|
||||
fi
|
||||
file="$APP_ANDROID_ROOT"/assets/Icon-48.png
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-mdpi/icon.png
|
||||
fi
|
||||
file="$APP_ANDROID_ROOT"/assets/Icon-32.png
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-ldpi/icon.png
|
||||
fi
|
||||
|
||||
|
||||
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"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos:${COCOS2DX_ROOT}/external"
|
||||
fi
|
|
@ -1,83 +0,0 @@
|
|||
@echo off
|
||||
|
||||
set APPNAME="HelloCpp"
|
||||
|
||||
set buildexternalsfromsource=
|
||||
set PARALLEL_BUILD_FLAG=
|
||||
|
||||
goto :getopts
|
||||
|
||||
:usage
|
||||
echo Build C/C++ code for %APPNAME% using Android NDK
|
||||
echo OPTIONS:
|
||||
echo -s Build externals from source
|
||||
echo -h this help
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:def
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:getopts
|
||||
set "par=%~1"
|
||||
if "%par%"=="" (goto :L)
|
||||
if "%~1"=="-s" set /a buildexternalsfromsource=1
|
||||
if "%~1"=="-h" goto :usage
|
||||
shift
|
||||
goto :getopts
|
||||
|
||||
:L
|
||||
set NDK_ROOT=%NDK_ROOT%
|
||||
if "%NDK_ROOT%"=="" goto:def
|
||||
|
||||
rem check toolchains
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.8 (goto :toolchains48)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.7 (goto :toolchains47)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.6 (goto :toolchains46)
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:toolchains48
|
||||
set NDK_TOOLCHAIN_VERSION=4.8
|
||||
goto :InitPath
|
||||
:toolchains47
|
||||
set NDK_TOOLCHAIN_VERSION=4.7
|
||||
goto :InitPath
|
||||
:toolchains46
|
||||
set NDK_TOOLCHAIN_VERSION=4.6
|
||||
|
||||
:InitPath
|
||||
|
||||
set COCOS2DX_ROOT=%~dp0..\..\..\..
|
||||
set APP_ROOT=%~dp0..
|
||||
set APP_ANDROID_ROOT=%~dp0
|
||||
|
||||
if "%buildexternalsfromsource%"=="1" (goto :MODULE1) else (goto :MODULE2)
|
||||
:MODULE1
|
||||
echo "Building external dependencies from source"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos2dx\platform\third_party\android\source
|
||||
goto :COPY_RES
|
||||
:MODULE2
|
||||
echo "Using prebuilt externals"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%\external;%COCOS2DX_ROOT%\cocos
|
||||
|
||||
:COPY_RES
|
||||
echo NDK_ROOT = %NDK_ROOT%
|
||||
echo COCOS2DX_ROOT=%COCOS2DX_ROOT%
|
||||
echo APP_ROOT=%APP_ROOT%
|
||||
echo APP_ANDROID_ROOT=%APP_ANDROID_ROOT%
|
||||
echo NDK_TOOLCHAIN_VERSION=%NDK_TOOLCHAIN_VERSION%
|
||||
|
||||
rem make sure assets is exist
|
||||
if exist %APP_ANDROID_ROOT%\assets rd /q /s %APP_ANDROID_ROOT%\assets
|
||||
|
||||
mkdir %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy Resources/* into assets' root
|
||||
xcopy /e /q /r /y %APP_ROOT%\Resources\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
call %NDK_ROOT%\ndk-build.cmd NDK_LOG=0 V=0 %*
|
||||
pause
|
|
@ -1,107 +0,0 @@
|
|||
APPNAME="HelloCpp"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "sh" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# read local.properties
|
||||
|
||||
_LOCALPROPERTIES_FILE=$(dirname "$0")"/local.properties"
|
||||
if [ -f "$_LOCALPROPERTIES_FILE" ]
|
||||
then
|
||||
[ -r "$_LOCALPROPERTIES_FILE" ] || die "Fatal Error: $_LOCALPROPERTIES_FILE exists but is unreadable"
|
||||
|
||||
# strip out entries with a "." because Bash cannot process variables with a "."
|
||||
_PROPERTIES=`sed '/\./d' "$_LOCALPROPERTIES_FILE"`
|
||||
for line in "$_PROPERTIES"; do
|
||||
declare "$line";
|
||||
done
|
||||
fi
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For compatibility of android-ndk-r9, 4.7 was removed from r9
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.7
|
||||
echo "The Selected NDK toolchain version was 4.7 !"
|
||||
else
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.8
|
||||
echo "The Selected NDK toolchain version was 4.8 !"
|
||||
else
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
|
||||
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 "$APP_ROOT"/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
|
||||
|
||||
if [[ "$buildexternalsfromsource" ]]; then
|
||||
echo "Building external dependencies from source"
|
||||
set -x
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}/external:${COCOS2DX_ROOT}/cocos"
|
||||
else
|
||||
echo "Using prebuilt externals"
|
||||
set -x
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}/external:${COCOS2DX_ROOT}/cocos"
|
||||
|
||||
fi
|
|
@ -1,83 +0,0 @@
|
|||
@echo off
|
||||
|
||||
set APPNAME="SimpleGame"
|
||||
|
||||
set buildexternalsfromsource=
|
||||
set PARALLEL_BUILD_FLAG=
|
||||
|
||||
goto :getopts
|
||||
|
||||
:usage
|
||||
echo Build C/C++ code for %APPNAME% using Android NDK
|
||||
echo OPTIONS:
|
||||
echo -s Build externals from source
|
||||
echo -h this help
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:def
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:getopts
|
||||
set "par=%~1"
|
||||
if "%par%"=="" (goto :L)
|
||||
if "%~1"=="-s" set /a buildexternalsfromsource=1
|
||||
if "%~1"=="-h" goto :usage
|
||||
shift
|
||||
goto :getopts
|
||||
|
||||
:L
|
||||
set NDK_ROOT=%NDK_ROOT%
|
||||
if "%NDK_ROOT%"=="" goto:def
|
||||
|
||||
rem check toolchains
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.8 (goto :toolchains48)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.7 (goto :toolchains47)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.6 (goto :toolchains46)
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:toolchains48
|
||||
set NDK_TOOLCHAIN_VERSION=4.8
|
||||
goto :InitPath
|
||||
:toolchains47
|
||||
set NDK_TOOLCHAIN_VERSION=4.7
|
||||
goto :InitPath
|
||||
:toolchains46
|
||||
set NDK_TOOLCHAIN_VERSION=4.6
|
||||
|
||||
:InitPath
|
||||
|
||||
set COCOS2DX_ROOT=%~dp0..\..\..\..
|
||||
set APP_ROOT=%~dp0..
|
||||
set APP_ANDROID_ROOT=%~dp0
|
||||
|
||||
if "%buildexternalsfromsource%"=="1" (goto :MODULE1) else (goto :MODULE2)
|
||||
:MODULE1
|
||||
echo "Building external dependencies from source"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos2dx\platform\third_party\android\source
|
||||
goto :COPY_RES
|
||||
:MODULE2
|
||||
echo "Using prebuilt externals"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos;%COCOS2DX_ROOT%\external
|
||||
|
||||
:COPY_RES
|
||||
echo NDK_ROOT = %NDK_ROOT%
|
||||
echo COCOS2DX_ROOT=%COCOS2DX_ROOT%
|
||||
echo APP_ROOT=%APP_ROOT%
|
||||
echo APP_ANDROID_ROOT=%APP_ANDROID_ROOT%
|
||||
echo NDK_TOOLCHAIN_VERSION=%NDK_TOOLCHAIN_VERSION%
|
||||
|
||||
rem make sure assets is exist
|
||||
if exist %APP_ANDROID_ROOT%\assets rd /q /s %APP_ANDROID_ROOT%\assets
|
||||
|
||||
mkdir %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy Resources/* into assets' root
|
||||
xcopy /e /q /r /y %APP_ROOT%\Resources\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
call %NDK_ROOT%\ndk-build.cmd NDK_LOG=0 V=0 %*
|
||||
pause
|
|
@ -1,107 +0,0 @@
|
|||
APPNAME="SimpleGame"
|
||||
|
||||
# options
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "h" OPTION; do
|
||||
case "$OPTION" in
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# read local.properties
|
||||
|
||||
_LOCALPROPERTIES_FILE=$(dirname "$0")"/local.properties"
|
||||
if [ -f "$_LOCALPROPERTIES_FILE" ]
|
||||
then
|
||||
[ -r "$_LOCALPROPERTIES_FILE" ] || die "Fatal Error: $_LOCALPROPERTIES_FILE exists but is unreadable"
|
||||
|
||||
# strip out entries with a "." because Bash cannot process variables with a "."
|
||||
_PROPERTIES=$(sed '/\./d' "$_LOCALPROPERTIES_FILE")
|
||||
for line in $_PROPERTIES; do
|
||||
declare "$line";
|
||||
done
|
||||
fi
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For compatibility of android-ndk-r9, 4.7 was removed from r9
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.7
|
||||
echo "The Selected NDK toolchain version was 4.7 !"
|
||||
else
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.8
|
||||
echo "The Selected NDK toolchain version was 4.8 !"
|
||||
else
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
|
||||
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 "$APP_ROOT"/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 icons (if they exist)
|
||||
file="$APP_ANDROID_ROOT"/assets/Icon-72.png
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-hdpi/icon.png
|
||||
fi
|
||||
file="$APP_ANDROID_ROOT"/assets/Icon-48.png
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-mdpi/icon.png
|
||||
fi
|
||||
file="$APP_ANDROID_ROOT"/assets/Icon-32.png
|
||||
if [ -f "$file" ]; then
|
||||
cp "$file" "$APP_ANDROID_ROOT"/res/drawable-ldpi/icon.png
|
||||
fi
|
||||
|
||||
echo "Building in debug"
|
||||
|
||||
"$NDK_ROOT"/ndk-build NDK_DEBUG=1 -C "$APP_ANDROID_ROOT" \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos:${COCOS2DX_ROOT}/external"
|
|
@ -1,90 +0,0 @@
|
|||
@echo off
|
||||
|
||||
set APPNAME="TestCpp"
|
||||
|
||||
set buildexternalsfromsource=
|
||||
set PARALLEL_BUILD_FLAG=
|
||||
|
||||
goto :getopts
|
||||
|
||||
:usage
|
||||
echo Build C/C++ code for %APPNAME% using Android NDK
|
||||
echo OPTIONS:
|
||||
echo -s Build externals from source
|
||||
echo -h this help
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:def
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:getopts
|
||||
set "par=%~1"
|
||||
if "%par%"=="" (goto :L)
|
||||
if "%~1"=="-s" set /a buildexternalsfromsource=1
|
||||
if "%~1"=="-h" goto :usage
|
||||
shift
|
||||
goto :getopts
|
||||
|
||||
:L
|
||||
set NDK_ROOT=%NDK_ROOT%
|
||||
if "%NDK_ROOT%"=="" goto:def
|
||||
|
||||
rem check toolchains
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.8 (goto :toolchains48)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.7 (goto :toolchains47)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.6 (goto :toolchains46)
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:toolchains48
|
||||
set NDK_TOOLCHAIN_VERSION=4.8
|
||||
goto :InitPath
|
||||
:toolchains47
|
||||
set NDK_TOOLCHAIN_VERSION=4.7
|
||||
goto :InitPath
|
||||
:toolchains46
|
||||
set NDK_TOOLCHAIN_VERSION=4.6
|
||||
|
||||
:InitPath
|
||||
|
||||
set COCOS2DX_ROOT=%~dp0..\..\..\..
|
||||
set APP_ROOT=%~dp0..
|
||||
set APP_ANDROID_ROOT=%~dp0
|
||||
|
||||
if "%buildexternalsfromsource%"=="1" (goto :MODULE1) else (goto :MODULE2)
|
||||
:MODULE1
|
||||
echo "Building external dependencies from source"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos2dx\platform\third_party\android\source
|
||||
goto :COPY_RES
|
||||
:MODULE2
|
||||
echo "Using prebuilt externals"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\external;%COCOS2DX_ROOT%\cocos
|
||||
|
||||
:COPY_RES
|
||||
echo NDK_ROOT = %NDK_ROOT%
|
||||
echo COCOS2DX_ROOT=%COCOS2DX_ROOT%
|
||||
echo APP_ROOT=%APP_ROOT%
|
||||
echo APP_ANDROID_ROOT=%APP_ANDROID_ROOT%
|
||||
echo NDK_TOOLCHAIN_VERSION=%NDK_TOOLCHAIN_VERSION%
|
||||
|
||||
rem make sure assets is exist
|
||||
if exist %APP_ANDROID_ROOT%\assets rd /q /s %APP_ANDROID_ROOT%\assets
|
||||
|
||||
mkdir %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy Resources/* into assets' root
|
||||
xcopy /e /q /r /y %APP_ROOT%\Resources\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem remove test_image_rgba4444.pvr.gz
|
||||
del /f /q %APP_ANDROID_ROOT%\assets\Images\test_image_rgba4444.pvr.gz
|
||||
del /f /q %APP_ANDROID_ROOT%\assets\Images\test_1021x1024_rgba8888.pvr.gz
|
||||
del /f /q %APP_ANDROID_ROOT%\assets\Images\test_1021x1024_rgb888.pvr.gz
|
||||
del /f /q %APP_ANDROID_ROOT%\assets\Images\test_1021x1024_rgba4444.pvr.gz
|
||||
del /f /q %APP_ANDROID_ROOT%\assets\Images\test_1021x1024_a8.pvr.gz
|
||||
|
||||
call %NDK_ROOT%\ndk-build.cmd NDK_LOG=0 V=0 %*
|
||||
pause
|
|
@ -1,98 +0,0 @@
|
|||
APPNAME="TestCpp"
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "h" OPTION; do
|
||||
case "$OPTION" in
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# read local.properties
|
||||
|
||||
_LOCALPROPERTIES_FILE=$(dirname "$0")"/local.properties"
|
||||
if [ -f "$_LOCALPROPERTIES_FILE" ]
|
||||
then
|
||||
[ -r "$_LOCALPROPERTIES_FILE" ] || die "Fatal Error: $_LOCALPROPERTIES_FILE exists but is unreadable"
|
||||
|
||||
# strip out entries with a "." because Bash cannot process variables with a "."
|
||||
_PROPERTIES=$(sed '/\./d' "$_LOCALPROPERTIES_FILE")
|
||||
for line in $_PROPERTIES; do
|
||||
declare "$line";
|
||||
done
|
||||
fi
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For compatibility of android-ndk-r9, 4.7 was removed from r9
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.7
|
||||
echo "The Selected NDK toolchain version was 4.7 !"
|
||||
else
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.8
|
||||
echo "The Selected NDK toolchain version was 4.8 !"
|
||||
else
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
|
||||
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 "$APP_ROOT"/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
|
||||
|
||||
# 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
|
||||
|
||||
echo "Using prebuilt externals"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/external:${COCOS2DX_ROOT}/cocos"
|
|
@ -1,90 +0,0 @@
|
|||
@echo off
|
||||
|
||||
set APPNAME="CocosDragonJS"
|
||||
|
||||
set buildexternalsfromsource=
|
||||
set PARALLEL_BUILD_FLAG=
|
||||
|
||||
goto :getopts
|
||||
|
||||
:usage
|
||||
echo Build C/C++ code for %APPNAME% using Android NDK
|
||||
echo OPTIONS:
|
||||
echo -s Build externals from source
|
||||
echo -p Run make with -j8 option to take advantage of multiple processors
|
||||
echo -h this help
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:def
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:getopts
|
||||
set "par=%~1"
|
||||
if "%par%"=="" (goto :L)
|
||||
if "%~1"=="-s" set /a buildexternalsfromsource=1
|
||||
if "%~1"=="-p" set PARALLEL_BUILD_FLAG=\-j8
|
||||
if "%~1"=="-h" goto :usage
|
||||
shift
|
||||
goto :getopts
|
||||
|
||||
:L
|
||||
set NDK_ROOT=%NDK_ROOT%
|
||||
if "%NDK_ROOT%"=="" goto:def
|
||||
|
||||
rem check toolchains
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.8 (goto :toolchains48)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.7 (goto :toolchains47)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.6 (goto :toolchains46)
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:toolchains48
|
||||
set NDK_TOOLCHAIN_VERSION=4.8
|
||||
goto :InitPath
|
||||
:toolchains47
|
||||
set NDK_TOOLCHAIN_VERSION=4.7
|
||||
goto :InitPath
|
||||
:toolchains46
|
||||
set NDK_TOOLCHAIN_VERSION=4.6
|
||||
|
||||
:InitPath
|
||||
|
||||
set COCOS2DX_ROOT=%~dp0..\..\..\..
|
||||
set APP_ROOT=%~dp0..
|
||||
set APP_ANDROID_ROOT=%~dp0
|
||||
set RESROUCE_ROOT="%APP_ROOT%\..\Shared\games\CocosDragonJS\Published files Android"
|
||||
set BINDINGS_JS_ROOT=%COCOS2DX_ROOT%\cocos\scripting\javascript\script
|
||||
|
||||
if "%buildexternalsfromsource%"=="1" (goto :MODULE1) else (goto :MODULE2)
|
||||
:MODULE1
|
||||
echo "Building external dependencies from source"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos2dx\platform\third_party\android\source
|
||||
goto :COPY_RES
|
||||
:MODULE2
|
||||
echo "Using prebuilt externals"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos;%COCOS2DX_ROOT%\external
|
||||
|
||||
:COPY_RES
|
||||
echo NDK_ROOT = %NDK_ROOT%
|
||||
echo COCOS2DX_ROOT=%COCOS2DX_ROOT%
|
||||
echo APP_ROOT=%APP_ROOT%
|
||||
echo APP_ANDROID_ROOT=%APP_ANDROID_ROOT%
|
||||
echo NDK_TOOLCHAIN_VERSION=%NDK_TOOLCHAIN_VERSION%
|
||||
|
||||
rem make sure assets is exist
|
||||
if exist %APP_ANDROID_ROOT%\assets rd /q /s %APP_ANDROID_ROOT%\assets
|
||||
|
||||
mkdir %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy Resources/* into assets' root
|
||||
xcopy /e /q /r /y %RESROUCE_ROOT%\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy bindings/*.js into assets' root
|
||||
xcopy /e /q /r /y %BINDINGS_JS_ROOT%\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
call %NDK_ROOT%\ndk-build.cmd %PARALLEL_BUILD_FLAG% NDK_LOG=0 V=0 %*
|
||||
pause
|
|
@ -1,114 +0,0 @@
|
|||
#NDK_ROOT="/opt/android/android-ndk"
|
||||
APPNAME="CocosDragonJS"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
PARALLEL_BUILD_FLAG=
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
-p Run make with -j8 option to take advantage of multiple processors
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "sph" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
;;
|
||||
p)
|
||||
PARALLEL_BUILD_FLAG=\-j8
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# exit this script if any commmand fails
|
||||
set -e
|
||||
|
||||
# read local.properties
|
||||
|
||||
_LOCALPROPERTIES_FILE=$(dirname "$0")"/local.properties"
|
||||
if [ -f "$_LOCALPROPERTIES_FILE" ]
|
||||
then
|
||||
[ -r "$_LOCALPROPERTIES_FILE" ] || die "Fatal Error: $_LOCALPROPERTIES_FILE exists but is unreadable"
|
||||
|
||||
# strip out entries with a "." because Bash cannot process variables with a "."
|
||||
_PROPERTIES=`sed '/\./d' "$_LOCALPROPERTIES_FILE"`
|
||||
for line in "$_PROPERTIES"; do
|
||||
declare "$line";
|
||||
done
|
||||
fi
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For compatibility of android-ndk-r9, 4.7 was removed from r9
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.7
|
||||
echo "The Selected NDK toolchain version was 4.7 !"
|
||||
else
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.8
|
||||
echo "The Selected NDK toolchain version was 4.8 !"
|
||||
else
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
RESROUCE_ROOT="$APP_ROOT/../Shared/games/CocosDragonJS/Published files Android"
|
||||
BINDINGS_JS_ROOT="$APP_ROOT/../../../cocos/scripting/javascript/script"
|
||||
|
||||
echo
|
||||
echo "Paths"
|
||||
echo " NDK_ROOT = $NDK_ROOT"
|
||||
echo " COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
||||
echo " APP_ROOT = $APP_ROOT"
|
||||
echo " APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||
echo
|
||||
|
||||
# Debug
|
||||
set -x
|
||||
|
||||
# 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" into "assets"
|
||||
cp -rf "$RESROUCE_ROOT"/* "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy bindings/*.js into assets' root
|
||||
cp -rf "$BINDINGS_JS_ROOT"/* "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
echo "Using prebuilt externals"
|
||||
echo
|
||||
|
||||
set -x
|
||||
|
||||
"$NDK_ROOT"/ndk-build $PARALLEL_BUILD_FLAG -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos:${COCOS2DX_ROOT}/external" \
|
||||
NDK_LOG=0 V=0
|
|
@ -1,90 +0,0 @@
|
|||
@echo off
|
||||
|
||||
set APPNAME="CrystalCraze"
|
||||
|
||||
set buildexternalsfromsource=
|
||||
set PARALLEL_BUILD_FLAG=
|
||||
|
||||
goto :getopts
|
||||
|
||||
:usage
|
||||
echo Build C/C++ code for %APPNAME% using Android NDK
|
||||
echo OPTIONS:
|
||||
echo -s Build externals from source
|
||||
echo -p Run make with -j8 option to take advantage of multiple processors
|
||||
echo -h this help
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:def
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:getopts
|
||||
set "par=%~1"
|
||||
if "%par%"=="" (goto :L)
|
||||
if "%~1"=="-s" set /a buildexternalsfromsource=1
|
||||
if "%~1"=="-p" set PARALLEL_BUILD_FLAG=\-j8
|
||||
if "%~1"=="-h" goto :usage
|
||||
shift
|
||||
goto :getopts
|
||||
|
||||
:L
|
||||
set NDK_ROOT=%NDK_ROOT%
|
||||
if "%NDK_ROOT%"=="" goto:def
|
||||
|
||||
rem check toolchains
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.8 (goto :toolchains48)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.7 (goto :toolchains47)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.6 (goto :toolchains46)
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:toolchains48
|
||||
set NDK_TOOLCHAIN_VERSION=4.8
|
||||
goto :InitPath
|
||||
:toolchains47
|
||||
set NDK_TOOLCHAIN_VERSION=4.7
|
||||
goto :InitPath
|
||||
:toolchains46
|
||||
set NDK_TOOLCHAIN_VERSION=4.6
|
||||
|
||||
:InitPath
|
||||
|
||||
set COCOS2DX_ROOT=%~dp0..\..\..\..
|
||||
set APP_ROOT=%~dp0..
|
||||
set APP_ANDROID_ROOT=%~dp0
|
||||
set RESROUCE_ROOT="%APP_ROOT%\..\Shared\games\CrystalCraze\Published-Android"
|
||||
set BINDINGS_JS_ROOT=%COCOS2DX_ROOT%\cocos\scripting\javascript\script
|
||||
|
||||
if "%buildexternalsfromsource%"=="1" (goto :MODULE1) else (goto :MODULE2)
|
||||
:MODULE1
|
||||
echo "Building external dependencies from source"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos2dx\platform\third_party\android\source
|
||||
goto :COPY_RES
|
||||
:MODULE2
|
||||
echo "Using prebuilt externals"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos;%COCOS2DX_ROOT%\external
|
||||
|
||||
:COPY_RES
|
||||
echo NDK_ROOT = %NDK_ROOT%
|
||||
echo COCOS2DX_ROOT=%COCOS2DX_ROOT%
|
||||
echo APP_ROOT=%APP_ROOT%
|
||||
echo APP_ANDROID_ROOT=%APP_ANDROID_ROOT%
|
||||
echo NDK_TOOLCHAIN_VERSION=%NDK_TOOLCHAIN_VERSION%
|
||||
|
||||
rem make sure assets is exist
|
||||
if exist %APP_ANDROID_ROOT%\assets rd /q /s %APP_ANDROID_ROOT%\assets
|
||||
|
||||
mkdir %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy Resources/* into assets' root
|
||||
xcopy /e /q /r /y %RESROUCE_ROOT%\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy bindings/*.js into assets' root
|
||||
xcopy /e /q /r /y %BINDINGS_JS_ROOT%\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
call %NDK_ROOT%\ndk-build.cmd %PARALLEL_BUILD_FLAG% NDK_LOG=0 V=0 %*
|
||||
pause
|
|
@ -1,115 +0,0 @@
|
|||
#NDK_ROOT="/opt/android/android-ndk"
|
||||
APPNAME="CrystalCraze"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
PARALLEL_BUILD_FLAG=
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
-p Run make with -j8 option to take advantage of multiple processors
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "sph" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
;;
|
||||
p)
|
||||
PARALLEL_BUILD_FLAG=\-j8
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# exit this script if any commmand fails
|
||||
set -e
|
||||
|
||||
# read local.properties
|
||||
|
||||
_LOCALPROPERTIES_FILE=$(dirname "$0")"/local.properties"
|
||||
if [ -f "$_LOCALPROPERTIES_FILE" ]
|
||||
then
|
||||
[ -r "$_LOCALPROPERTIES_FILE" ] || die "Fatal Error: $_LOCALPROPERTIES_FILE exists but is unreadable"
|
||||
|
||||
# strip out entries with a "." because Bash cannot process variables with a "."
|
||||
_PROPERTIES=`sed '/\./d' "$_LOCALPROPERTIES_FILE"`
|
||||
for line in "$_PROPERTIES"; do
|
||||
declare "$line";
|
||||
done
|
||||
fi
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For compatibility of android-ndk-r9, 4.7 was removed from r9
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.7
|
||||
echo "The Selected NDK toolchain version was 4.7 !"
|
||||
else
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.8
|
||||
echo "The Selected NDK toolchain version was 4.8 !"
|
||||
else
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
RESROUCE_ROOT="$APP_ROOT/../Shared/games/CrystalCraze/Published-Android"
|
||||
BINDINGS_JS_ROOT="$APP_ROOT/../../../cocos/scripting/javascript/script"
|
||||
|
||||
echo
|
||||
echo "Paths"
|
||||
echo " NDK_ROOT = $NDK_ROOT"
|
||||
echo " COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
||||
echo " APP_ROOT = $APP_ROOT"
|
||||
echo " APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||
echo
|
||||
|
||||
# Debug
|
||||
set -x
|
||||
|
||||
# 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" into "assets"
|
||||
cp -rf "$RESROUCE_ROOT"/* "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy bindings/*.js into assets' root
|
||||
cp -rf "$BINDINGS_JS_ROOT"/* "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
|
||||
echo "Using prebuilt externals"
|
||||
echo
|
||||
|
||||
set -x
|
||||
|
||||
"$NDK_ROOT"/ndk-build $PARALLEL_BUILD_FLAG -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos:${COCOS2DX_ROOT}/external" \
|
||||
NDK_LOG=0 V=0
|
|
@ -1,96 +0,0 @@
|
|||
@echo off
|
||||
|
||||
set APPNAME="MoonWarriors"
|
||||
|
||||
set buildexternalsfromsource=
|
||||
set PARALLEL_BUILD_FLAG=
|
||||
|
||||
goto :getopts
|
||||
|
||||
:usage
|
||||
echo Build C/C++ code for %APPNAME% using Android NDK
|
||||
echo OPTIONS:
|
||||
echo -s Build externals from source
|
||||
echo -p Run make with -j8 option to take advantage of multiple processors
|
||||
echo -h this help
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:def
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:getopts
|
||||
set "par=%~1"
|
||||
if "%par%"=="" (goto :L)
|
||||
if "%~1"=="-s" set /a buildexternalsfromsource=1
|
||||
if "%~1"=="-p" set PARALLEL_BUILD_FLAG=\-j8
|
||||
if "%~1"=="-h" goto :usage
|
||||
shift
|
||||
goto :getopts
|
||||
|
||||
:L
|
||||
set NDK_ROOT=%NDK_ROOT%
|
||||
if "%NDK_ROOT%"=="" goto:def
|
||||
|
||||
rem check toolchains
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.8 (goto :toolchains48)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.7 (goto :toolchains47)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.6 (goto :toolchains46)
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:toolchains48
|
||||
set NDK_TOOLCHAIN_VERSION=4.8
|
||||
goto :InitPath
|
||||
:toolchains47
|
||||
set NDK_TOOLCHAIN_VERSION=4.7
|
||||
goto :InitPath
|
||||
:toolchains46
|
||||
set NDK_TOOLCHAIN_VERSION=4.6
|
||||
|
||||
:InitPath
|
||||
|
||||
set COCOS2DX_ROOT=%~dp0..\..\..\..
|
||||
set APP_ROOT=%~dp0..
|
||||
set APP_ANDROID_ROOT=%~dp0
|
||||
set RESROUCE_ROOT="%APP_ROOT%\..\Shared\games\MoonWarriors\res"
|
||||
set BINDINGS_JS_ROOT=%COCOS2DX_ROOT%\cocos\scripting\javascript\script
|
||||
|
||||
if "%buildexternalsfromsource%"=="1" (goto :MODULE1) else (goto :MODULE2)
|
||||
:MODULE1
|
||||
echo "Building external dependencies from source"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos2dx\platform\third_party\android\source
|
||||
goto :COPY_RES
|
||||
:MODULE2
|
||||
echo "Using prebuilt externals"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos;%COCOS2DX_ROOT%\external
|
||||
|
||||
:COPY_RES
|
||||
echo NDK_ROOT = %NDK_ROOT%
|
||||
echo COCOS2DX_ROOT=%COCOS2DX_ROOT%
|
||||
echo APP_ROOT=%APP_ROOT%
|
||||
echo APP_ANDROID_ROOT=%APP_ANDROID_ROOT%
|
||||
echo NDK_TOOLCHAIN_VERSION=%NDK_TOOLCHAIN_VERSION%
|
||||
|
||||
rem make sure assets is exist
|
||||
if exist %APP_ANDROID_ROOT%\assets rd /q /s %APP_ANDROID_ROOT%\assets
|
||||
|
||||
mkdir %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy Resources/* into assets' root
|
||||
xcopy /e /q /r /y %RESROUCE_ROOT%\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy MoonWarriors js
|
||||
xcopy /e /q /r /y %RESROUCE_ROOT%\..\src %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy MoonWarriors-native.js
|
||||
xcopy /e /q /r /y %RESROUCE_ROOT%\..\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy bindings/*.js into assets' root
|
||||
xcopy /e /q /r /y %BINDINGS_JS_ROOT%\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
call %NDK_ROOT%\ndk-build.cmd %PARALLEL_BUILD_FLAG% NDK_LOG=0 V=0 %*
|
||||
pause
|
|
@ -1,117 +0,0 @@
|
|||
APPNAME="MoonWarriors"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
PARALLEL_BUILD_FLAG=
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
-p Run make with -j8 option to take advantage of multiple processors
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "sph" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
;;
|
||||
p)
|
||||
PARALLEL_BUILD_FLAG=\-j8
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# exit this script if any commmand fails
|
||||
set -e
|
||||
|
||||
# read local.properties
|
||||
|
||||
_LOCALPROPERTIES_FILE=$(dirname "$0")"/local.properties"
|
||||
if [ -f "$_LOCALPROPERTIES_FILE" ]
|
||||
then
|
||||
[ -r "$_LOCALPROPERTIES_FILE" ] || die "Fatal Error: $_LOCALPROPERTIES_FILE exists but is unreadable"
|
||||
|
||||
# strip out entries with a "." because Bash cannot process variables with a "."
|
||||
_PROPERTIES=`sed '/\./d' "$_LOCALPROPERTIES_FILE"`
|
||||
for line in "$_PROPERTIES"; do
|
||||
declare "$line";
|
||||
done
|
||||
fi
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For compatibility of android-ndk-r9, 4.7 was removed from r9
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.7
|
||||
echo "The Selected NDK toolchain version was 4.7 !"
|
||||
else
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.8
|
||||
echo "The Selected NDK toolchain version was 4.8 !"
|
||||
else
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
RESROUCE_ROOT="$APP_ROOT/../Shared/games/MoonWarriors/res"
|
||||
BINDINGS_JS_ROOT="$APP_ROOT/../../../cocos/scripting/javascript/script"
|
||||
|
||||
echo
|
||||
echo "Paths"
|
||||
echo " NDK_ROOT = $NDK_ROOT"
|
||||
echo " COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
||||
echo " APP_ROOT = $APP_ROOT"
|
||||
echo " APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||
echo
|
||||
|
||||
# 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" into "assets"
|
||||
cp -rf "$RESROUCE_ROOT" "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy MoonWarriors js
|
||||
cp -rf "$RESROUCE_ROOT"/../src "$APP_ANDROID_ROOT"/assets
|
||||
# copy MoonWarriors-native.js
|
||||
cp "$RESROUCE_ROOT"/../*.js "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy bindings/*.js into assets' root
|
||||
cp -rf "$BINDINGS_JS_ROOT"/* "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
|
||||
echo "Using prebuilt externals"
|
||||
echo
|
||||
|
||||
set -x
|
||||
|
||||
"$NDK_ROOT"/ndk-build $PARALLEL_BUILD_FLAG -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos:${COCOS2DX_ROOT}/external" \
|
||||
NDK_LOG=1 V=1
|
|
@ -1,90 +0,0 @@
|
|||
@echo off
|
||||
|
||||
set APPNAME="TestJavascript"
|
||||
|
||||
set buildexternalsfromsource=
|
||||
set PARALLEL_BUILD_FLAG=
|
||||
|
||||
goto :getopts
|
||||
|
||||
:usage
|
||||
echo Build C/C++ code for %APPNAME% using Android NDK
|
||||
echo OPTIONS:
|
||||
echo -s Build externals from source
|
||||
echo -p Run make with -j8 option to take advantage of multiple processors
|
||||
echo -h this help
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:def
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:getopts
|
||||
set "par=%~1"
|
||||
if "%par%"=="" (goto :L)
|
||||
if "%~1"=="-s" set /a buildexternalsfromsource=1
|
||||
if "%~1"=="-p" set PARALLEL_BUILD_FLAG=\-j8
|
||||
if "%~1"=="-h" goto :usage
|
||||
shift
|
||||
goto :getopts
|
||||
|
||||
:L
|
||||
set NDK_ROOT=%NDK_ROOT%
|
||||
if "%NDK_ROOT%"=="" goto:def
|
||||
|
||||
rem check toolchains
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.8 (goto :toolchains48)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.7 (goto :toolchains47)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.6 (goto :toolchains46)
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:toolchains48
|
||||
set NDK_TOOLCHAIN_VERSION=4.8
|
||||
goto :InitPath
|
||||
:toolchains47
|
||||
set NDK_TOOLCHAIN_VERSION=4.7
|
||||
goto :InitPath
|
||||
:toolchains46
|
||||
set NDK_TOOLCHAIN_VERSION=4.6
|
||||
|
||||
:InitPath
|
||||
|
||||
set COCOS2DX_ROOT=%~dp0..\..\..\..
|
||||
set APP_ROOT=%~dp0..
|
||||
set APP_ANDROID_ROOT=%~dp0
|
||||
set BINDINGS_JS_ROOT=%COCOS2DX_ROOT%\cocos\scripting\javascript\script
|
||||
|
||||
if "%buildexternalsfromsource%"=="1" (goto :MODULE1) else (goto :MODULE2)
|
||||
:MODULE1
|
||||
echo "Building external dependencies from source"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos2dx\platform\third_party\android\source
|
||||
goto :COPY_RES
|
||||
:MODULE2
|
||||
echo "Using prebuilt externals"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos;%COCOS2DX_ROOT%\external
|
||||
|
||||
:COPY_RES
|
||||
echo NDK_ROOT = %NDK_ROOT%
|
||||
echo COCOS2DX_ROOT=%COCOS2DX_ROOT%
|
||||
echo APP_ROOT=%APP_ROOT%
|
||||
echo APP_ANDROID_ROOT=%APP_ANDROID_ROOT%
|
||||
echo NDK_TOOLCHAIN_VERSION=%NDK_TOOLCHAIN_VERSION%
|
||||
|
||||
rem make sure assets is exist
|
||||
if exist %APP_ANDROID_ROOT%\assets rd /q /s %APP_ANDROID_ROOT%\assets
|
||||
|
||||
mkdir %APP_ANDROID_ROOT%\assets
|
||||
mkdir %APP_ANDROID_ROOT%\assets\res
|
||||
|
||||
rem copy Resources/* into assets' root
|
||||
xcopy /e /q /r /y %APP_ROOT%\..\Shared\tests\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy bindings/*.js into assets' root
|
||||
xcopy /e /q /r /y %BINDINGS_JS_ROOT%\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
call %NDK_ROOT%\ndk-build.cmd %PARALLEL_BUILD_FLAG% NDK_LOG=0 V=0 %*
|
||||
pause
|
|
@ -1,114 +0,0 @@
|
|||
APPNAME="TestJavascript"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
PARALLEL_BUILD_FLAG=
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
-p Run make with -j8 option to take advantage of multiple processors
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "sph" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
;;
|
||||
p)
|
||||
PARALLEL_BUILD_FLAG=\-j8
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# exit this script if any commmand fails
|
||||
set -e
|
||||
|
||||
# read local.properties
|
||||
|
||||
_LOCALPROPERTIES_FILE=$(dirname "$0")"/local.properties"
|
||||
if [ -f "$_LOCALPROPERTIES_FILE" ]
|
||||
then
|
||||
[ -r "$_LOCALPROPERTIES_FILE" ] || die "Fatal Error: $_LOCALPROPERTIES_FILE exists but is unreadable"
|
||||
|
||||
# strip out entries with a "." because Bash cannot process variables with a "."
|
||||
_PROPERTIES=`sed '/\./d' "$_LOCALPROPERTIES_FILE"`
|
||||
for line in "$_PROPERTIES"; do
|
||||
declare "$line";
|
||||
done
|
||||
fi
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For compatibility of android-ndk-r9, 4.7 was removed from r9
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.7
|
||||
echo "The Selected NDK toolchain version was 4.7 !"
|
||||
else
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.8
|
||||
echo "The Selected NDK toolchain version was 4.8 !"
|
||||
else
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
BINDINGS_JS_ROOT="$APP_ROOT/../../../cocos/scripting/javascript/script"
|
||||
|
||||
echo
|
||||
echo "Paths"
|
||||
echo " NDK_ROOT = $NDK_ROOT"
|
||||
echo " COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
||||
echo " APP_ROOT = $APP_ROOT"
|
||||
echo " APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||
echo
|
||||
|
||||
# Debug
|
||||
set -x
|
||||
|
||||
# make sure assets is exist
|
||||
if [ -d "$APP_ANDROID_ROOT"/assets ]; then
|
||||
rm -rf "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
mkdir "$APP_ANDROID_ROOT"/assets
|
||||
mkdir "$APP_ANDROID_ROOT"/assets/res
|
||||
|
||||
# copy src/**/*.js from cocos2d-js-tests into assets' root
|
||||
cp -rf "$APP_ROOT"/../Shared/tests/* "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
|
||||
# copy bindings/*.js into assets' root
|
||||
cp -rf "$BINDINGS_JS_ROOT"/* "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
echo "Using prebuilt externals"
|
||||
echo
|
||||
|
||||
set -x
|
||||
|
||||
"$NDK_ROOT"/ndk-build $PARALLEL_BUILD_FLAG -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos:${COCOS2DX_ROOT}/external" \
|
||||
NDK_LOG=0 V=0
|
|
@ -1,90 +0,0 @@
|
|||
@echo off
|
||||
|
||||
set APPNAME="WatermelonWithMe"
|
||||
|
||||
set buildexternalsfromsource=
|
||||
set PARALLEL_BUILD_FLAG=
|
||||
|
||||
goto :getopts
|
||||
|
||||
:usage
|
||||
echo Build C/C++ code for %APPNAME% using Android NDK
|
||||
echo OPTIONS:
|
||||
echo -s Build externals from source
|
||||
echo -p Run make with -j8 option to take advantage of multiple processors
|
||||
echo -h this help
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:def
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:getopts
|
||||
set "par=%~1"
|
||||
if "%par%"=="" (goto :L)
|
||||
if "%~1"=="-s" set /a buildexternalsfromsource=1
|
||||
if "%~1"=="-p" set PARALLEL_BUILD_FLAG=\-j8
|
||||
if "%~1"=="-h" goto :usage
|
||||
shift
|
||||
goto :getopts
|
||||
|
||||
:L
|
||||
set NDK_ROOT=%NDK_ROOT%
|
||||
if "%NDK_ROOT%"=="" goto:def
|
||||
|
||||
rem check toolchains
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.8 (goto :toolchains48)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.7 (goto :toolchains47)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.6 (goto :toolchains46)
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:toolchains48
|
||||
set NDK_TOOLCHAIN_VERSION=4.8
|
||||
goto :InitPath
|
||||
:toolchains47
|
||||
set NDK_TOOLCHAIN_VERSION=4.7
|
||||
goto :InitPath
|
||||
:toolchains46
|
||||
set NDK_TOOLCHAIN_VERSION=4.6
|
||||
|
||||
:InitPath
|
||||
|
||||
set COCOS2DX_ROOT=%~dp0..\..\..\..
|
||||
set APP_ROOT=%~dp0..
|
||||
set APP_ANDROID_ROOT=%~dp0
|
||||
set RESROUCE_ROOT="%APP_ROOT%\..\Shared\games\WatermelonWithMe"
|
||||
set BINDINGS_JS_ROOT=%COCOS2DX_ROOT%\cocos\scripting\javascript\script
|
||||
|
||||
if "%buildexternalsfromsource%"=="1" (goto :MODULE1) else (goto :MODULE2)
|
||||
:MODULE1
|
||||
echo "Building external dependencies from source"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos2dx\platform\third_party\android\source
|
||||
goto :COPY_RES
|
||||
:MODULE2
|
||||
echo "Using prebuilt externals"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos;%COCOS2DX_ROOT%\external
|
||||
|
||||
:COPY_RES
|
||||
echo NDK_ROOT = %NDK_ROOT%
|
||||
echo COCOS2DX_ROOT=%COCOS2DX_ROOT%
|
||||
echo APP_ROOT=%APP_ROOT%
|
||||
echo APP_ANDROID_ROOT=%APP_ANDROID_ROOT%
|
||||
echo NDK_TOOLCHAIN_VERSION=%NDK_TOOLCHAIN_VERSION%
|
||||
|
||||
rem make sure assets is exist
|
||||
if exist %APP_ANDROID_ROOT%\assets rd /q /s %APP_ANDROID_ROOT%\assets
|
||||
|
||||
mkdir %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy Resources/* into assets' root
|
||||
xcopy /e /q /r /y %RESROUCE_ROOT%\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy bindings/*.js into assets' root
|
||||
xcopy /e /q /r /y %BINDINGS_JS_ROOT%\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
call %NDK_ROOT%\ndk-build.cmd %PARALLEL_BUILD_FLAG% NDK_LOG=0 V=0 %*
|
||||
pause
|
|
@ -1,113 +0,0 @@
|
|||
APPNAME="TestJavascript"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
PARALLEL_BUILD_FLAG=
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
-p Run make with -j8 option to take advantage of multiple processors
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "sph" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
;;
|
||||
p)
|
||||
PARALLEL_BUILD_FLAG=\-j8
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# exit this script if any commmand fails
|
||||
set -e
|
||||
|
||||
# read local.properties
|
||||
|
||||
_LOCALPROPERTIES_FILE=$(dirname "$0")"/local.properties"
|
||||
if [ -f "$_LOCALPROPERTIES_FILE" ]
|
||||
then
|
||||
[ -r "$_LOCALPROPERTIES_FILE" ] || die "Fatal Error: $_LOCALPROPERTIES_FILE exists but is unreadable"
|
||||
|
||||
# strip out entries with a "." because Bash cannot process variables with a "."
|
||||
_PROPERTIES=`sed '/\./d' "$_LOCALPROPERTIES_FILE"`
|
||||
for line in "$_PROPERTIES"; do
|
||||
declare "$line";
|
||||
done
|
||||
fi
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For compatibility of android-ndk-r9, 4.7 was removed from r9
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.7
|
||||
echo "The Selected NDK toolchain version was 4.7 !"
|
||||
else
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.8
|
||||
echo "The Selected NDK toolchain version was 4.8 !"
|
||||
else
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
RESROUCE_ROOT="$APP_ROOT/../Shared/games/WatermelonWithMe"
|
||||
BINDINGS_JS_ROOT="$APP_ROOT/../../../cocos/scripting/javascript/script"
|
||||
|
||||
echo
|
||||
echo "Paths"
|
||||
echo " NDK_ROOT = $NDK_ROOT"
|
||||
echo " COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
||||
echo " APP_ROOT = $APP_ROOT"
|
||||
echo " APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||
echo
|
||||
|
||||
# Debug
|
||||
set -x
|
||||
|
||||
# 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" into "assets"
|
||||
cp -rf "$RESROUCE_ROOT"/* "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy bindings/*.js into assets' root
|
||||
cp -rf "$BINDINGS_JS_ROOT"/* "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
echo "Using prebuilt externals"
|
||||
echo
|
||||
|
||||
set -x
|
||||
|
||||
"$NDK_ROOT"/ndk-build $PARALLEL_BUILD_FLAG -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos:${COCOS2DX_ROOT}/external" \
|
||||
NDK_LOG=0 V=0
|
|
@ -1,86 +0,0 @@
|
|||
@echo off
|
||||
|
||||
set APPNAME="HelloLua"
|
||||
|
||||
set buildexternalsfromsource=
|
||||
set PARALLEL_BUILD_FLAG=
|
||||
|
||||
goto :getopts
|
||||
|
||||
:usage
|
||||
echo Build C/C++ code for %APPNAME% using Android NDK
|
||||
echo OPTIONS:
|
||||
echo -s Build externals from source
|
||||
echo -h this help
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:def
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:getopts
|
||||
set "par=%~1"
|
||||
if "%par%"=="" (goto :L)
|
||||
if "%~1"=="-s" set /a buildexternalsfromsource=1
|
||||
if "%~1"=="-h" goto :usage
|
||||
shift
|
||||
goto :getopts
|
||||
|
||||
:L
|
||||
set NDK_ROOT=%NDK_ROOT%
|
||||
if "%NDK_ROOT%"=="" goto:def
|
||||
|
||||
rem check toolchains
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.8 (goto :toolchains48)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.7 (goto :toolchains47)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.6 (goto :toolchains46)
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:toolchains48
|
||||
set NDK_TOOLCHAIN_VERSION=4.8
|
||||
goto :InitPath
|
||||
:toolchains47
|
||||
set NDK_TOOLCHAIN_VERSION=4.7
|
||||
goto :InitPath
|
||||
:toolchains46
|
||||
set NDK_TOOLCHAIN_VERSION=4.6
|
||||
|
||||
:InitPath
|
||||
|
||||
set COCOS2DX_ROOT=%~dp0..\..\..\..
|
||||
set APP_ROOT=%~dp0..
|
||||
set APP_ANDROID_ROOT=%~dp0
|
||||
|
||||
if "%buildexternalsfromsource%"=="1" (goto :MODULE1) else (goto :MODULE2)
|
||||
:MODULE1
|
||||
echo "Building external dependencies from source"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos2dx\platform\third_party\android\source
|
||||
goto :COPY_RES
|
||||
:MODULE2
|
||||
echo "Using prebuilt externals"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos;%COCOS2DX_ROOT%\external
|
||||
|
||||
:COPY_RES
|
||||
echo NDK_ROOT = %NDK_ROOT%
|
||||
echo COCOS2DX_ROOT=%COCOS2DX_ROOT%
|
||||
echo APP_ROOT=%APP_ROOT%
|
||||
echo APP_ANDROID_ROOT=%APP_ANDROID_ROOT%
|
||||
echo NDK_TOOLCHAIN_VERSION=%NDK_TOOLCHAIN_VERSION%
|
||||
|
||||
rem make sure assets is exist
|
||||
if exist %APP_ANDROID_ROOT%\assets rd /q /s %APP_ANDROID_ROOT%\assets
|
||||
|
||||
mkdir %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy Resources/* into assets' root
|
||||
xcopy /e /q /r /y %APP_ROOT%\Resources\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy common luaScript
|
||||
xcopy /e /q /r /y %COCOS2DX_ROOT%\cocos\scripting\lua\script\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
call %NDK_ROOT%\ndk-build.cmd NDK_LOG=0 V=0 %*
|
||||
pause
|
|
@ -1,116 +0,0 @@
|
|||
APPNAME="HelloLua"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "sh" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# read local.properties
|
||||
|
||||
_LOCALPROPERTIES_FILE=$(dirname "$0")"/local.properties"
|
||||
if [ -f "$_LOCALPROPERTIES_FILE" ]
|
||||
then
|
||||
[ -r "$_LOCALPROPERTIES_FILE" ] || die "Fatal Error: $_LOCALPROPERTIES_FILE exists but is unreadable"
|
||||
|
||||
# strip out entries with a "." because Bash cannot process variables with a "."
|
||||
_PROPERTIES=`sed '/\./d' "$_LOCALPROPERTIES_FILE"`
|
||||
for line in "$_PROPERTIES"; do
|
||||
declare "$line";
|
||||
done
|
||||
fi
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For compatibility of android-ndk-r9, 4.7 was removed from r9
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.7
|
||||
echo "The Selected NDK toolchain version was 4.7 !"
|
||||
else
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.8
|
||||
echo "The Selected NDK toolchain version was 4.8 !"
|
||||
else
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
|
||||
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 "$APP_ROOT"/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 comment script
|
||||
for file in "$APP_ROOT"/../../../cocos/scripting/lua/script/*
|
||||
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
|
||||
|
||||
if [[ "$buildexternalsfromsource" ]]; then
|
||||
echo "Building external dependencies from source"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}/external:${COCOS2DX_ROOT}/cocos:${COCOS2DX_ROOT}"
|
||||
else
|
||||
echo "Using prebuilt externals"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}/external:${COCOS2DX_ROOT}/cocos:${COCOS2DX_ROOT}"
|
||||
fi
|
|
@ -1,93 +0,0 @@
|
|||
@echo off
|
||||
|
||||
set APPNAME="TestLua"
|
||||
|
||||
set buildexternalsfromsource=
|
||||
set PARALLEL_BUILD_FLAG=
|
||||
|
||||
goto :getopts
|
||||
|
||||
:usage
|
||||
echo Build C/C++ code for %APPNAME% using Android NDK
|
||||
echo OPTIONS:
|
||||
echo -s Build externals from source
|
||||
echo -h this help
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:def
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:getopts
|
||||
set "par=%~1"
|
||||
if "%par%"=="" (goto :L)
|
||||
if "%~1"=="-s" set /a buildexternalsfromsource=1
|
||||
if "%~1"=="-h" goto :usage
|
||||
shift
|
||||
goto :getopts
|
||||
|
||||
:L
|
||||
set NDK_ROOT=%NDK_ROOT%
|
||||
if "%NDK_ROOT%"=="" goto:def
|
||||
|
||||
rem check toolchains
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.8 (goto :toolchains48)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.7 (goto :toolchains47)
|
||||
if exist %NDK_ROOT%\toolchains\arm-linux-androideabi-4.6 (goto :toolchains46)
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:toolchains48
|
||||
set NDK_TOOLCHAIN_VERSION=4.8
|
||||
goto :InitPath
|
||||
:toolchains47
|
||||
set NDK_TOOLCHAIN_VERSION=4.7
|
||||
goto :InitPath
|
||||
:toolchains46
|
||||
set NDK_TOOLCHAIN_VERSION=4.6
|
||||
|
||||
:InitPath
|
||||
|
||||
set COCOS2DX_ROOT=%~dp0..\..\..\..
|
||||
set APP_ROOT=%~dp0..
|
||||
set APP_ANDROID_ROOT=%~dp0
|
||||
|
||||
if "%buildexternalsfromsource%"=="1" (goto :MODULE1) else (goto :MODULE2)
|
||||
:MODULE1
|
||||
echo "Building external dependencies from source"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos2dx\platform\third_party\android\source
|
||||
goto :COPY_RES
|
||||
:MODULE2
|
||||
echo "Using prebuilt externals"
|
||||
set NDK_MODULE_PATH=%COCOS2DX_ROOT%;%COCOS2DX_ROOT%\cocos;%COCOS2DX_ROOT%\external
|
||||
|
||||
:COPY_RES
|
||||
echo NDK_ROOT = %NDK_ROOT%
|
||||
echo COCOS2DX_ROOT=%COCOS2DX_ROOT%
|
||||
echo APP_ROOT=%APP_ROOT%
|
||||
echo APP_ANDROID_ROOT=%APP_ANDROID_ROOT%
|
||||
echo NDK_TOOLCHAIN_VERSION=%NDK_TOOLCHAIN_VERSION%
|
||||
|
||||
rem make sure assets is exist
|
||||
if exist %APP_ANDROID_ROOT%\assets rd /q /s %APP_ANDROID_ROOT%\assets
|
||||
|
||||
mkdir %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy Resources/* into assets' root
|
||||
xcopy /e /q /r /y %APP_ROOT%\Resources\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem copy common luaScript
|
||||
xcopy /e /q /r /y %COCOS2DX_ROOT%\cocos\scripting\lua\script\* %APP_ANDROID_ROOT%\assets
|
||||
|
||||
rem remove test_image_rgba4444.pvr.gz
|
||||
del /f /q %APP_ANDROID_ROOT%\assets\Images\test_image_rgba4444.pvr.gz
|
||||
del /f /q %APP_ANDROID_ROOT%\assets\Images\test_1021x1024_rgba8888.pvr.gz
|
||||
del /f /q %APP_ANDROID_ROOT%\assets\Images\test_1021x1024_rgb888.pvr.gz
|
||||
del /f /q %APP_ANDROID_ROOT%\assets\Images\test_1021x1024_rgba4444.pvr.gz
|
||||
del /f /q %APP_ANDROID_ROOT%\assets\Images\test_1021x1024_a8.pvr.gz
|
||||
|
||||
call %NDK_ROOT%\ndk-build.cmd NDK_LOG=0 V=0 %*
|
||||
pause
|
|
@ -1,143 +0,0 @@
|
|||
APPNAME="TestLua"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "sh" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# read local.properties
|
||||
|
||||
_LOCALPROPERTIES_FILE=$(dirname "$0")"/local.properties"
|
||||
if [ -f "$_LOCALPROPERTIES_FILE" ]
|
||||
then
|
||||
[ -r "$_LOCALPROPERTIES_FILE" ] || die "Fatal Error: $_LOCALPROPERTIES_FILE exists but is unreadable"
|
||||
|
||||
# strip out entries with a "." because Bash cannot process variables with a "."
|
||||
_PROPERTIES=`sed '/\./d' "$_LOCALPROPERTIES_FILE"`
|
||||
for line in "$_PROPERTIES"; do
|
||||
declare "$line";
|
||||
done
|
||||
fi
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
||||
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# For compatibility of android-ndk-r9, 4.7 was removed from r9
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.7
|
||||
echo "The Selected NDK toolchain version was 4.7 !"
|
||||
else
|
||||
if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then
|
||||
export NDK_TOOLCHAIN_VERSION=4.8
|
||||
echo "The Selected NDK toolchain version was 4.8 !"
|
||||
else
|
||||
echo "Couldn't find the gcc toolchain."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
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/Lua/"$APPNAME"
|
||||
APP_ANDROID_ROOT="$COCOS2DX_ROOT"/samples/Lua/"$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 "$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/*
|
||||
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 common luaScript
|
||||
for file in "$APP_ROOT"/../../../cocos/scripting/lua/script/*
|
||||
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
|
||||
|
||||
# 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
|
||||
echo "Building external dependencies from source"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos:${COCOS2DX_ROOT}/external"
|
||||
else
|
||||
echo "Using prebuilt externals"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos:${COCOS2DX_ROOT}/external"
|
||||
fi
|
Loading…
Reference in New Issue