diff --git a/CHANGELOG b/CHANGELOG index 8fc9c367ee..158e288955 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,7 @@ cocos2d-x-3.0alpha1 @??? 2013 [FIX] Fixed application will crash when pause and resume. [FIX] Clear NoSuchMethodError Exception when JniHelper fails to find method id [NEW] Added xlargeScreens="true" to supports-screens + [NEW] Added build/android-build.py to build all Android samples [Mac] [FIX] Removed unused CCLOG() from GL initialization [iOS] diff --git a/README.md b/README.md index 39e47ca9ad..217779827f 100644 --- a/README.md +++ b/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`. diff --git a/build/android-build.py b/build/android-build.py new file mode 100755 index 0000000000..62bc226e77 --- /dev/null +++ b/build/android-build.py @@ -0,0 +1,212 @@ +#!/usr/bin/python +# android-build.py +# Build android samples + +# You can use + + +# begin +import sys +import os, os.path +import shutil +from optparse import OptionParser + +CPP_SAMPLES = ['hellocpp', 'testcpp', 'simplegame', 'assetsmanager'] +LUA_SAMPLES = ['hellolua', 'testlua'] +JSB_SAMPLES = ['cocosdragon', 'crystalcraze', 'moonwarriors', 'testjavascript', 'watermelonwithme'] +ALL_SAMPLES = CPP_SAMPLES + LUA_SAMPLES + JSB_SAMPLES + + +def usage(): + + print "%prog [-n ndk-build-parameter] target\n\ + valid target are [hellocpp|testcpp|simplegame|assetsmanager|hellolua|testlua|cocosdragon\ +|crystalcraze|moonwarriors|testjavascript|watermelonwithme], of course you can use 'cpp'\ +to build all cpp samples, 'lua' to build all lua samples, 'jsb' to build all javascript samples,\ + and 'all' for all samples" + +def check_environment_variables(): + ''' Checking the environment NDK_ROOT, which will be used for building + ''' + + try: + NDK_ROOT = os.environ['NDK_ROOT'] + except Exception: + print "NDK_ROOT not defined. Please define NDK_ROOT in your environment" + sys.exit(1) + + return NDK_ROOT + +def select_toolchain_version(): + '''Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn't support c++11. So we should select gcc4.7 when + using ndk-r8e. But gcc4.7 is removed in ndk-r9, so we should determine whether gcc4.7 exist. + Conclution: + ndk-r8e -> use gcc4.7 + ndk-r9 -> use gcc4.8 + ''' + + ndk_root = check_environment_variables() + if os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.8")): + os.environ['NDK_TOOLCHAIN_VERSION'] = '4.8' + print "The Selected NDK toolchain version was 4.8 !" + elif os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.7")): + os.environ['NDK_TOOLCHAIN_VERSION'] = '4.7' + print "The Selected NDK toolchain version was 4.7 !" + else: + print "Couldn't find the gcc toolchain." + exit(1) + +def caculate_built_samples(args): + ''' Compute the sampels to be built + 'cpp' for short of all cpp samples + 'lua' for short of all lua smpleas + 'jsb' for short of all javascript samples + ''' + + if 'all' in args: + return ALL_SAMPLES + + targets = [] + if 'cpp' in args: + targets += CPP_SAMPLES + args.remove('cpp') + if 'lua' in args: + targets += LUA_SAMPLES + args.remove('lua') + if 'jsb' in args: + targets += JSB_SAMPLES + args.remove('jsb') + + targets += args + + # remove duplicate elements, for example + # python android-build.py cpp hellocpp + targets = set(targets) + return list(targets) + +def do_build(cocos_root, ndk_root, app_android_root, ndk_build_param): + + ndk_path = os.path.join(ndk_root, "ndk-build") + + # windows should use ";" to seperate module paths + platform = sys.platform + if platform == 'win32': + ndk_module_path = 'NDK_MODULE_PATH=%s;%s/external;%s/cocos' % (cocos_root, cocos_root, cocos_root) + else: + ndk_module_path = 'NDK_MODULE_PATH=%s:%s/external:%s/cocos' % (cocos_root, cocos_root, cocos_root) + + if ndk_build_param == None: + command = '%s -C %s %s' % (ndk_path, app_android_root, ndk_module_path) + else: + 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() + select_toolchain_version() + build_targets = caculate_built_samples(target) + + current_dir = os.getcwd() + cocos_root = os.path.join(current_dir, "..") + + app_android_root = '' + for target in build_targets: + if target == 'hellocpp': + app_android_root = os.path.join(cocos_root, 'samples/Cpp/HelloCpp/proj.android') + elif target == 'testcpp': + app_android_root = os.path.join(cocos_root, 'samples/Cpp/TestCpp/proj.android') + elif target == 'simplegame': + app_android_root = os.path.join(cocos_root, 'samples/Cpp/SimpleGame/proj.android') + elif target == 'assetsmanager': + app_android_root = os.path.join(cocos_root, 'samples/Cpp/AssetsManager/proj.android') + elif target == 'hellolua': + app_android_root = os.path.join(cocos_root, 'samples/Lua/HelloLua/proj.android') + elif target == 'testlua': + app_android_root = os.path.join(cocos_root, 'samples/Lua/TestLua/proj.android') + elif target == 'cocosdragon': + app_android_root = os.path.join(cocos_root, 'samples/JavaScript/CocosDragonJS/proj.android') + elif target == 'crystalcraze': + app_android_root = os.path.join(cocos_root, 'samples/JavaScript/CrystalCraze/proj.android') + elif target == 'moonwarriors': + app_android_root = os.path.join(cocos_root, 'samples/JavaScript/MoonWarriors/proj.android') + elif target == 'testjavascript': + app_android_root = os.path.join(cocos_root, 'samples/JavaScript/TestJavascript/proj.android') + elif target == 'watermelonwithme': + app_android_root = os.path.join(cocos_root, 'samples/JavaScript/WatermelonWithMe/proj.android') + else: + 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 -------------- +if __name__ == '__main__': + + #parse the params + parser = OptionParser() + parser.add_option("-n", "--ndk", dest="ndk_build_param", help='parameter for ndk-build') + (opts, args) = parser.parse_args() + + if len(args) == 0: + usage() + else: + build_samples(args, opts.ndk_build_param) diff --git a/samples/Cpp/AssetsManagerTest/proj.android/build_native.cmd b/samples/Cpp/AssetsManagerTest/proj.android/build_native.cmd deleted file mode 100644 index d397bbc901..0000000000 --- a/samples/Cpp/AssetsManagerTest/proj.android/build_native.cmd +++ /dev/null @@ -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 \ No newline at end of file diff --git a/samples/Cpp/AssetsManagerTest/proj.android/build_native.sh b/samples/Cpp/AssetsManagerTest/proj.android/build_native.sh deleted file mode 100755 index 30549e8869..0000000000 --- a/samples/Cpp/AssetsManagerTest/proj.android/build_native.sh +++ /dev/null @@ -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 diff --git a/samples/Cpp/HelloCpp/proj.android/build_native.cmd b/samples/Cpp/HelloCpp/proj.android/build_native.cmd deleted file mode 100644 index f18ac5f170..0000000000 --- a/samples/Cpp/HelloCpp/proj.android/build_native.cmd +++ /dev/null @@ -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 \ No newline at end of file diff --git a/samples/Cpp/HelloCpp/proj.android/build_native.sh b/samples/Cpp/HelloCpp/proj.android/build_native.sh deleted file mode 100755 index cfd49f5d79..0000000000 --- a/samples/Cpp/HelloCpp/proj.android/build_native.sh +++ /dev/null @@ -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 diff --git a/samples/Cpp/SimpleGame/proj.android/build_native.cmd b/samples/Cpp/SimpleGame/proj.android/build_native.cmd deleted file mode 100644 index 437e55298f..0000000000 --- a/samples/Cpp/SimpleGame/proj.android/build_native.cmd +++ /dev/null @@ -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 \ No newline at end of file diff --git a/samples/Cpp/SimpleGame/proj.android/build_native.sh b/samples/Cpp/SimpleGame/proj.android/build_native.sh deleted file mode 100755 index 8f09b2bb6b..0000000000 --- a/samples/Cpp/SimpleGame/proj.android/build_native.sh +++ /dev/null @@ -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" diff --git a/samples/Cpp/TestCpp/proj.android/build_native.cmd b/samples/Cpp/TestCpp/proj.android/build_native.cmd deleted file mode 100644 index d8eaaea7c7..0000000000 --- a/samples/Cpp/TestCpp/proj.android/build_native.cmd +++ /dev/null @@ -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 \ No newline at end of file diff --git a/samples/Cpp/TestCpp/proj.android/build_native.sh b/samples/Cpp/TestCpp/proj.android/build_native.sh deleted file mode 100755 index 69464cc437..0000000000 --- a/samples/Cpp/TestCpp/proj.android/build_native.sh +++ /dev/null @@ -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" diff --git a/samples/Javascript/CocosDragonJS/proj.android/build_native.cmd b/samples/Javascript/CocosDragonJS/proj.android/build_native.cmd deleted file mode 100644 index 76a9a7138f..0000000000 --- a/samples/Javascript/CocosDragonJS/proj.android/build_native.cmd +++ /dev/null @@ -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 diff --git a/samples/Javascript/CocosDragonJS/proj.android/build_native.sh b/samples/Javascript/CocosDragonJS/proj.android/build_native.sh deleted file mode 100755 index 768c2caf04..0000000000 --- a/samples/Javascript/CocosDragonJS/proj.android/build_native.sh +++ /dev/null @@ -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 diff --git a/samples/Javascript/CrystalCraze/proj.android/build_native.cmd b/samples/Javascript/CrystalCraze/proj.android/build_native.cmd deleted file mode 100644 index 22f5ad4442..0000000000 --- a/samples/Javascript/CrystalCraze/proj.android/build_native.cmd +++ /dev/null @@ -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 diff --git a/samples/Javascript/CrystalCraze/proj.android/build_native.sh b/samples/Javascript/CrystalCraze/proj.android/build_native.sh deleted file mode 100755 index 102eefa80f..0000000000 --- a/samples/Javascript/CrystalCraze/proj.android/build_native.sh +++ /dev/null @@ -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 diff --git a/samples/Javascript/MoonWarriors/proj.android/build_native.cmd b/samples/Javascript/MoonWarriors/proj.android/build_native.cmd deleted file mode 100644 index e2c1c82c7e..0000000000 --- a/samples/Javascript/MoonWarriors/proj.android/build_native.cmd +++ /dev/null @@ -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 diff --git a/samples/Javascript/MoonWarriors/proj.android/build_native.sh b/samples/Javascript/MoonWarriors/proj.android/build_native.sh deleted file mode 100755 index e97488b40c..0000000000 --- a/samples/Javascript/MoonWarriors/proj.android/build_native.sh +++ /dev/null @@ -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 diff --git a/samples/Javascript/TestJavascript/proj.android/build_native.cmd b/samples/Javascript/TestJavascript/proj.android/build_native.cmd deleted file mode 100644 index a0a5ec0785..0000000000 --- a/samples/Javascript/TestJavascript/proj.android/build_native.cmd +++ /dev/null @@ -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 \ No newline at end of file diff --git a/samples/Javascript/TestJavascript/proj.android/build_native.sh b/samples/Javascript/TestJavascript/proj.android/build_native.sh deleted file mode 100755 index 3378f4006a..0000000000 --- a/samples/Javascript/TestJavascript/proj.android/build_native.sh +++ /dev/null @@ -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 diff --git a/samples/Javascript/WatermelonWithMe/proj.android/build_native.cmd b/samples/Javascript/WatermelonWithMe/proj.android/build_native.cmd deleted file mode 100644 index a592025ff0..0000000000 --- a/samples/Javascript/WatermelonWithMe/proj.android/build_native.cmd +++ /dev/null @@ -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 diff --git a/samples/Javascript/WatermelonWithMe/proj.android/build_native.sh b/samples/Javascript/WatermelonWithMe/proj.android/build_native.sh deleted file mode 100755 index e976f1c2b2..0000000000 --- a/samples/Javascript/WatermelonWithMe/proj.android/build_native.sh +++ /dev/null @@ -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 diff --git a/samples/Lua/HelloLua/proj.android/build_native.cmd b/samples/Lua/HelloLua/proj.android/build_native.cmd deleted file mode 100644 index 4116608669..0000000000 --- a/samples/Lua/HelloLua/proj.android/build_native.cmd +++ /dev/null @@ -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 \ No newline at end of file diff --git a/samples/Lua/HelloLua/proj.android/build_native.sh b/samples/Lua/HelloLua/proj.android/build_native.sh deleted file mode 100755 index 0e0f3662f5..0000000000 --- a/samples/Lua/HelloLua/proj.android/build_native.sh +++ /dev/null @@ -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 diff --git a/samples/Lua/TestLua/proj.android/build_native.cmd b/samples/Lua/TestLua/proj.android/build_native.cmd deleted file mode 100644 index fa1fc0ad75..0000000000 --- a/samples/Lua/TestLua/proj.android/build_native.cmd +++ /dev/null @@ -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 \ No newline at end of file diff --git a/samples/Lua/TestLua/proj.android/build_native.sh b/samples/Lua/TestLua/proj.android/build_native.sh deleted file mode 100755 index 1774c62c32..0000000000 --- a/samples/Lua/TestLua/proj.android/build_native.sh +++ /dev/null @@ -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