Merge pull request #5150 from lihex/issue#3781

issue #3781: Update script for each platform bindings generating.
This commit is contained in:
James Chen 2014-01-21 19:57:19 -08:00
commit f3233cba61
6 changed files with 310 additions and 89 deletions

@ -1 +1 @@
Subproject commit 6fc3372cdfdbf39dd20bdcf1f60eb779773d32d7
Subproject commit ad6f6c781687b0dd471c4df53c0ba5925e43894d

View File

@ -0,0 +1,88 @@
@echo off
:: This script is used to generate jsbinding glue codes.
:: You should modify PYTHON_ROOT and NDK_ROOT to work under your environment.
:: Android ndk version must be at least ndk-r9b.
set PYTHON_ROOT=C:/Python27
set NDK_ROOT=G:/android/android-ndk-r9b
set NDK_LLVM_ROOT=%NDK_ROOT%/toolchains/llvm-3.3/prebuilt/windows-x86_64
set COCOS2DX_ROOT=%cd%/../..
set "COCOS2DX_ROOT=%COCOS2DX_ROOT:\=/%"
set CXX_GENERATOR_ROOT=%COCOS2DX_ROOT%/tools/bindings-generator
set TO_JS_ROOT=%COCOS2DX_ROOT%/tools/tojs
set "CXX_GENERATOR_ROOT=%CXX_GENERATOR_ROOT:\=/%"
set OUTPUT_DIR=%COCOS2DX_ROOT%/scripting/auto-generated/js-bindings
set "OUTPUT_DIR=%OUTPUT_DIR:/=\%"
set PATH=%PATH%;%CXX_GENERATOR_ROOT%/libclang;%CXX_GENERATOR_ROOT%/tools/win32;%PYTHON_ROOT%
:: write userconf.ini
set _CONF_INI_FILE=%cd%\userconf.ini
if exist %_CONF_INI_FILE% del /Q %_CONF_INI_FILE%
echo
echo generating userconf.ini...
echo ---
echo [DEFAULT] > %_CONF_INI_FILE%
echo androidndkdir=%NDK_ROOT% >> %_CONF_INI_FILE%
echo clangllvmdir=%NDK_LLVM_ROOT% >> %_CONF_INI_FILE%
echo cocosdir=%COCOS2DX_ROOT% >> %_CONF_INI_FILE%
echo cxxgeneratordir=%CXX_GENERATOR_ROOT% >> %_CONF_INI_FILE%
:: fixme: to fix parse error, we must difine __WCHAR_MAX__ and undefine __MINGW32__ .
echo extra_flags=-D__WCHAR_MAX__=0x7fffffff -U__MINGW32__ >> %_CONF_INI_FILE%
echo ---
:: Generate bindings for cocos2dx
echo Generating bindings for cocos2dx...
python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx.ini -s cocos2d-x -t spidermonkey -o %OUTPUT_DIR% -n js_cocos2dx_auto
if %errorlevel% neq 0 goto ERROR
echo "Generating bindings for cocos2dx_extension..."
python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx_extension.ini -s cocos2dx_extension -t spidermonkey -o %OUTPUT_DIR% -n js_cocos2dx_extension_auto
if %errorlevel% neq 0 goto ERROR
echo "Generating bindings for cocos2dx_builder..."
python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx_builder.ini -s cocos2dx_builder -t spidermonkey -o %OUTPUT_DIR% -n jsb_cocos2dx_builder_auto
if %errorlevel% neq 0 goto ERROR
echo "Generating bindings for cocos2dx_gui..."
python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx_gui.ini -s cocos2dx_gui -t spidermonkey -o %OUTPUT_DIR% -n js_cocos2dx_gui_auto
if %errorlevel% neq 0 goto ERROR
echo "Generating bindings for cocos2dx_studio..."
python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx_studio.ini -s cocos2dx_studio -t spidermonkey -o %OUTPUT_DIR% -n js_cocos2dx_studio_auto
if %errorlevel% neq 0 goto ERROR
echo "Generating bindings for cocos2dx_spine..."
python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx_spine.ini -s cocos2dx_spine -t spidermonkey -o %OUTPUT_DIR% -n js_cocos2dx_spine_auto
if %errorlevel% neq 0 goto ERROR
:: Change the generated file format from DOS to UNIX.
pushd "%OUTPUT_DIR%"
dos2unix *
popd
echo ---------------------------------
echo Generating bindings succeeds.
echo ---------------------------------
goto QUIT
:ERROR
echo ---------------------------------
echo Generating bindings fails.
echo ---------------------------------
:QUIT
pause

View File

@ -1,4 +1,9 @@
#!/bin/bash
#
# Usage:
# export NDK_ROOT=/path/to/ndk-r9b
# ./genbindings.sh
#
# exit this script if any commmand fails
set -e
@ -6,10 +11,12 @@ set -e
# read user.cfg if it exists and is readable
_CFG_FILE=$(dirname "$0")"/user.cfg"
if [ -f "$_CFG_FILE" ]
if [ -f "$_CFG_FILE" ];
then
[ -r "$_CFG_FILE" ] || die "Fatal Error: $_CFG_FILE exists but is unreadable"
. "$_CFG_FILE"
if [ ! -r "$_CFG_FILE" ]; then
echo "Fatal Error: $_CFG_FILE exists but is unreadable"
exit 1
fi
fi
# paths
@ -19,11 +26,6 @@ if [ -z "${NDK_ROOT+aaa}" ]; then
NDK_ROOT="$HOME/bin/android-ndk"
fi
if [ -z "${CLANG_ROOT+aaa}" ]; then
# ... if CLANG_ROOT is not set, use "$HOME/bin/clang+llvm-3.3"
CLANG_ROOT="$HOME/bin/clang+llvm-3.3"
fi
if [ -z "${PYTHON_BIN+aaa}" ]; then
# ... if PYTHON_BIN is not set, use "/usr/bin/python2.7"
PYTHON_BIN="/usr/bin/python2.7"
@ -35,7 +37,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# paths with defaults hardcoded to relative paths
if [ -z "${COCOS2DX_ROOT+aaa}" ]; then
COCOS2DX_ROOT="$DIR/../../"
COCOS2DX_ROOT="$DIR/../.."
fi
if [ -z "${CXX_GENERATOR_ROOT+aaa}" ]; then
@ -43,16 +45,59 @@ if [ -z "${CXX_GENERATOR_ROOT+aaa}" ]; then
fi
if [ -z "${TOJS_ROOT+aaa}" ]; then
TO_JS_ROOT="$COCOS2DX_ROOT/tools/tojs"
TOJS_ROOT="$COCOS2DX_ROOT/tools/tojs"
fi
# set output dir
OUTPUT_DIR=${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings
echo "Paths"
echo " NDK_ROOT: $NDK_ROOT"
echo " CLANG_ROOT: $CLANG_ROOT"
echo " PYTHON_BIN: $PYTHON_BIN"
echo " COCOS2DX_ROOT: $COCOS2DX_ROOT"
echo " CXX_GENERATOR_ROOT: $CXX_GENERATOR_ROOT"
echo " TO_JS_ROOT: $TO_JS_ROOT"
echo " TOJS_ROOT: $TOJS_ROOT"
# check NDK version, must be r9b
if ! grep -q r9b $NDK_ROOT/RELEASE.TXT
then
echo " Fatal Error: NDK r9b must be required!"
exit 1
fi
# check clang include path
OS_NAME=$('uname')
NDK_LLVM_ROOT=$NDK_ROOT/toolchains/llvm-3.3/prebuilt
case "$OS_NAME" in
Darwin | darwin)
echo "in darwin"
if [ -d "$NDK_LLVM_ROOT/darwin-x86_64" ]; then
NDK_LLVM_ROOT=$NDK_LLVM_ROOT/darwin-x86_64
elif [ -d "$NDK_LLVM_ROOT/darwin-x86" ]; then
NDK_LLVM_ROOT=$NDK_LLVM_ROOT/darwin-x86
else
echo $NDK_LLVM_ROOT
echo " Fatal Error: $NDK_LLVM_ROOT doesn't contains prebuilt llvm 3.3"
exit 1
fi
;;
Linux | linux)
echo "in linux"
if [ -d "$NDK_LLVM_ROOT/linux-x86_64" ]; then
NDK_LLVM_ROOT=$NDK_LLVM_ROOT/linux-x86_64
elif [ -d "$NDK_LLVM_ROOT/linux-x86" ]; then
NDK_LLVM_ROOT=$NDK_LLVM_ROOT/linux-x86
else
echo " Fatal Error: $NDK_LLVM_ROOT doesn't contains prebuilt llvm 3.3"
exit 1
fi
;;
*)
echo " Fatal Error: Please run this script in linux or mac osx."
exit 1
;;
esac
# write userconf.ini
@ -65,7 +110,7 @@ fi
_CONTENTS=""
_CONTENTS+="[DEFAULT]"'\n'
_CONTENTS+="androidndkdir=$NDK_ROOT"'\n'
_CONTENTS+="clangllvmdir=$CLANG_ROOT"'\n'
_CONTENTS+="clangllvmdir=$NDK_LLVM_ROOT"'\n'
_CONTENTS+="cocosdir=$COCOS2DX_ROOT"'\n'
_CONTENTS+="cxxgeneratordir=$CXX_GENERATOR_ROOT"'\n'
_CONTENTS+="extra_flags="'\n'
@ -80,19 +125,20 @@ echo ---
# Generate bindings for cocos2dx
echo "Generating bindings for cocos2dx..."
set -x
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx.ini -s cocos2d-x -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_auto
LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOJS_ROOT}/cocos2dx.ini -s cocos2d-x -t spidermonkey -o ${OUTPUT_DIR} -n jsb_cocos2dx_auto
echo "Generating bindings for cocos2dx_extension..."
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_extension.ini -s cocos2dx_extension -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_extension_auto
LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOJS_ROOT}/cocos2dx_extension.ini -s cocos2dx_extension -t spidermonkey -o ${OUTPUT_DIR} -n jsb_cocos2dx_extension_auto
echo "Generating bindings for cocos2dx_builder..."
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_builder.ini -s cocos2dx_builder -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_builder_auto
LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOJS_ROOT}/cocos2dx_builder.ini -s cocos2dx_builder -t spidermonkey -o ${OUTPUT_DIR} -n jsb_cocos2dx_builder_auto
echo "Generating bindings for cocos2dx_gui..."
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_gui.ini -s cocos2dx_gui -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_gui_auto
LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOJS_ROOT}/cocos2dx_gui.ini -s cocos2dx_gui -t spidermonkey -o ${OUTPUT_DIR} -n jsb_cocos2dx_gui_auto
echo "Generating bindings for cocos2dx_studio..."
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_studio.ini -s cocos2dx_studio -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_studio_auto
LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOJS_ROOT}/cocos2dx_studio.ini -s cocos2dx_studio -t spidermonkey -o ${OUTPUT_DIR} -n jsb_cocos2dx_studio_auto
echo "Generating bindings for cocos2dx_spine..."
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_spine.ini -s cocos2dx_spine -t spidermonkey -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/js-bindings -n jsb_cocos2dx_spine_auto
LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOJS_ROOT}/cocos2dx_spine.ini -s cocos2dx_spine -t spidermonkey -o ${OUTPUT_DIR} -n jsb_cocos2dx_spine_auto

View File

@ -0,0 +1,89 @@
@echo off
:: This script is used to generate luabinding glue codes.
:: You should modify PYTHON_ROOT and NDK_ROOT to work under your environment.
:: Android ndk version must be at least ndk-r9b.
set PYTHON_ROOT=C:/Python27
set NDK_ROOT=G:/android/android-ndk-r9b
set NDK_LLVM_ROOT=%NDK_ROOT%/toolchains/llvm-3.3/prebuilt/windows-x86_64
set COCOS2DX_ROOT=%cd%/../..
set "COCOS2DX_ROOT=%COCOS2DX_ROOT:\=/%"
set CXX_GENERATOR_ROOT=%COCOS2DX_ROOT%/tools/bindings-generator
set TO_LUA_ROOT=%COCOS2DX_ROOT%/tools/tolua
set "CXX_GENERATOR_ROOT=%CXX_GENERATOR_ROOT:\=/%"
set OUTPUT_DIR=%COCOS2DX_ROOT%/scripting/auto-generated/lua-bindings
set "OUTPUT_DIR=%OUTPUT_DIR:/=\%"
set PATH=%PATH%;%CXX_GENERATOR_ROOT%/libclang;%CXX_GENERATOR_ROOT%/tools/win32;%PYTHON_ROOT%
:: write userconf.ini
set _CONF_INI_FILE=%cd%\userconf.ini
if exist %_CONF_INI_FILE% del /Q %_CONF_INI_FILE%
echo
echo generating userconf.ini...
echo ---
echo [DEFAULT] > %_CONF_INI_FILE%
echo androidndkdir=%NDK_ROOT% >> %_CONF_INI_FILE%
echo clangllvmdir=%NDK_LLVM_ROOT% >> %_CONF_INI_FILE%
echo cocosdir=%COCOS2DX_ROOT% >> %_CONF_INI_FILE%
echo cxxgeneratordir=%CXX_GENERATOR_ROOT% >> %_CONF_INI_FILE%
:: fixme: to fix parse error, we must difine __WCHAR_MAX__ and undefine __MINGW32__ .
echo extra_flags=-D__WCHAR_MAX__=0x7fffffff -U__MINGW32__ >> %_CONF_INI_FILE%
echo ---
:: Generate bindings for cocos2dx
echo Generating bindings for cocos2dx...
python %CXX_GENERATOR_ROOT%/generator.py %TO_LUA_ROOT%/cocos2dx.ini -s cocos2d-x -t lua -o %OUTPUT_DIR% -n lua_cocos2dx_auto
if %errorlevel% neq 0 goto ERROR
echo "Generating bindings for cocos2dx_extension..."
python %CXX_GENERATOR_ROOT%/generator.py %TO_LUA_ROOT%/cocos2dx_extension.ini -s cocos2dx_extension -t lua -o %OUTPUT_DIR% -n lua_cocos2dx_extension_auto
if %errorlevel% neq 0 goto ERROR
echo "Generating bindings for cocos2dx_gui..."
python %CXX_GENERATOR_ROOT%/generator.py %TO_LUA_ROOT%/cocos2dx_gui.ini -s cocos2dx_gui -t lua -o %OUTPUT_DIR% -n lua_cocos2dx_gui_auto
if %errorlevel% neq 0 goto ERROR
echo "Generating bindings for cocos2dx_studio..."
python %CXX_GENERATOR_ROOT%/generator.py %TO_LUA_ROOT%/cocos2dx_studio.ini -s cocos2dx_studio -t lua -o %OUTPUT_DIR% -n lua_cocos2dx_studio_auto
if %errorlevel% neq 0 goto ERROR
echo "Generating bindings for cocos2dx_spine..."
python %CXX_GENERATOR_ROOT%/generator.py %TO_LUA_ROOT%/cocos2dx_spine.ini -s cocos2dx_spine -t lua -o %OUTPUT_DIR% -n lua_cocos2dx_spine_auto
if %errorlevel% neq 0 goto ERROR
echo "Generating bindings for cocos2dx_physics..."
python %CXX_GENERATOR_ROOT%/generator.py %TO_LUA_ROOT%/cocos2dx_physics.ini -s cocos2dx_physics -t lua -o %OUTPUT_DIR% -n lua_cocos2dx_physics_auto
if %errorlevel% neq 0 goto ERROR
:: Change the generated file format from DOS to UNIX.
pushd "%OUTPUT_DIR%"
dos2unix *
popd
echo ---------------------------------
echo Generating bindings succeeds.
echo ---------------------------------
goto QUIT
:ERROR
echo ---------------------------------
echo Generating bindings fails.
echo ---------------------------------
:QUIT
pause

View File

@ -1,4 +1,9 @@
#!/bin/bash
#
# Usage:
# export NDK_ROOT=/path/to/ndk-r9b
# ./genbindings.sh
#
# exit this script if any commmand fails
set -e
@ -6,10 +11,12 @@ set -e
# read user.cfg if it exists and is readable
_CFG_FILE=$(dirname "$0")"/user.cfg"
if [ -f "$_CFG_FILE" ]
if [ -f "$_CFG_FILE" ];
then
[ -r "$_CFG_FILE" ] || die "Fatal Error: $_CFG_FILE exists but is unreadable"
. "$_CFG_FILE"
if [ ! -r "$_CFG_FILE" ]; then
echo "Fatal Error: $_CFG_FILE exists but is unreadable"
exit 1
fi
fi
# paths
@ -19,11 +26,6 @@ if [ -z "${NDK_ROOT+aaa}" ]; then
NDK_ROOT="$HOME/bin/android-ndk"
fi
if [ -z "${CLANG_ROOT+aaa}" ]; then
# ... if CLANG_ROOT is not set, use "$HOME/bin/clang+llvm-3.3"
CLANG_ROOT="$HOME/bin/clang+llvm-3.3"
fi
if [ -z "${PYTHON_BIN+aaa}" ]; then
# ... if PYTHON_BIN is not set, use "/usr/bin/python2.7"
PYTHON_BIN="/usr/bin/python2.7"
@ -35,24 +37,67 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# paths with defaults hardcoded to relative paths
if [ -z "${COCOS2DX_ROOT+aaa}" ]; then
COCOS2DX_ROOT="$DIR/../../"
COCOS2DX_ROOT="$DIR/../.."
fi
if [ -z "${CXX_GENERATOR_ROOT+aaa}" ]; then
CXX_GENERATOR_ROOT="$COCOS2DX_ROOT/tools/bindings-generator"
fi
if [ -z "${TOJS_ROOT+aaa}" ]; then
TO_JS_ROOT="$COCOS2DX_ROOT/tools/tolua"
if [ -z "${TOLUA_ROOT+aaa}" ]; then
TOLUA_ROOT="$COCOS2DX_ROOT/tools/tolua"
fi
# set output dir
OUTPUT_DIR=${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings
echo "Paths"
echo " NDK_ROOT: $NDK_ROOT"
echo " CLANG_ROOT: $CLANG_ROOT"
echo " PYTHON_BIN: $PYTHON_BIN"
echo " COCOS2DX_ROOT: $COCOS2DX_ROOT"
echo " CXX_GENERATOR_ROOT: $CXX_GENERATOR_ROOT"
echo " TO_JS_ROOT: $TO_JS_ROOT"
echo " TOLUA_ROOT: $TOLUA_ROOT"
# check NDK version, must be r9b
if ! grep -q r9b $NDK_ROOT/RELEASE.TXT
then
echo " Fatal Error: NDK r9b must be required!"
exit 1
fi
# check clang include path
OS_NAME=$('uname')
NDK_LLVM_ROOT=$NDK_ROOT/toolchains/llvm-3.3/prebuilt
case "$OS_NAME" in
Darwin | darwin)
echo "in darwin"
if [ -d "$NDK_LLVM_ROOT/darwin-x86_64" ]; then
NDK_LLVM_ROOT=$NDK_LLVM_ROOT/darwin-x86_64
elif [ -d "$NDK_LLVM_ROOT/darwin-x86" ]; then
NDK_LLVM_ROOT=$NDK_LLVM_ROOT/darwin-x86
else
echo $NDK_LLVM_ROOT
echo " Fatal Error: $NDK_LLVM_ROOT doesn't contains prebuilt llvm 3.3"
exit 1
fi
;;
Linux | linux)
echo "in linux"
if [ -d "$NDK_LLVM_ROOT/linux-x86_64" ]; then
NDK_LLVM_ROOT=$NDK_LLVM_ROOT/linux-x86_64
elif [ -d "$NDK_LLVM_ROOT/linux-x86" ]; then
NDK_LLVM_ROOT=$NDK_LLVM_ROOT/linux-x86
else
echo " Fatal Error: $NDK_LLVM_ROOT doesn't contains prebuilt llvm 3.3"
exit 1
fi
;;
*)
echo " Fatal Error: Please run this script in linux or mac osx."
exit 1
;;
esac
# write userconf.ini
@ -65,7 +110,7 @@ fi
_CONTENTS=""
_CONTENTS+="[DEFAULT]"'\n'
_CONTENTS+="androidndkdir=$NDK_ROOT"'\n'
_CONTENTS+="clangllvmdir=$CLANG_ROOT"'\n'
_CONTENTS+="clangllvmdir=$NDK_LLVM_ROOT"'\n'
_CONTENTS+="cocosdir=$COCOS2DX_ROOT"'\n'
_CONTENTS+="cxxgeneratordir=$CXX_GENERATOR_ROOT"'\n'
_CONTENTS+="extra_flags="'\n'
@ -80,19 +125,20 @@ echo ---
# Generate bindings for cocos2dx
echo "Generating bindings for cocos2dx..."
set -x
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx.ini -s cocos2d-x -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_auto
LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOLUA_ROOT}/cocos2dx.ini -s cocos2d-x -t lua -o ${OUTPUT_DIR} -n lua_cocos2dx_auto
echo "Generating bindings for cocos2dx_extension..."
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_extension.ini -s cocos2dx_extension -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_extension_auto
LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOLUA_ROOT}/cocos2dx_extension.ini -s cocos2dx_extension -t lua -o ${OUTPUT_DIR} -n lua_cocos2dx_extension_auto
echo "Generating bindings for cocos2dx_gui..."
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_gui.ini -s cocos2dx_gui -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_gui_auto
LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOLUA_ROOT}/cocos2dx_gui.ini -s cocos2dx_gui -t lua -o ${OUTPUT_DIR} -n lua_cocos2dx_gui_auto
echo "Generating bindings for cocos2dx_studio..."
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_studio.ini -s cocos2dx_studio -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_studio_auto
LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOLUA_ROOT}/cocos2dx_studio.ini -s cocos2dx_studio -t lua -o ${OUTPUT_DIR} -n lua_cocos2dx_studio_auto
echo "Generating bindings for cocos2dx_spine..."
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_spine.ini -s cocos2dx_spine -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_spine_auto
LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOLUA_ROOT}/cocos2dx_spine.ini -s cocos2dx_spine -t lua -o ${OUTPUT_DIR} -n lua_cocos2dx_spine_auto
echo "Generating bindings for cocos2dx_physics..."
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_physics.ini -s cocos2dx_physics -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_physics_auto
LD_LIBRARY_PATH=${CXX_GENERATOR_ROOT}/libclang $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TOLUA_ROOT}/cocos2dx_physics.ini -s cocos2dx_physics -t lua -o ${OUTPUT_DIR} -n lua_cocos2dx_physics_auto

View File

@ -6,9 +6,6 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
COCOS2DX_ROOT="$DIR"/../..
HOST_NAME=""
LLVM_VERSION=""
LLVM_PACKAGE=""
LLVM_PACKAGE_SUFFIX=""
mkdir -p $HOME/bin
cd $HOME/bin
@ -29,47 +26,6 @@ install_android_ndk()
mv android-ndk-r9b android-ndk
}
install_llvm()
{
LLVM_VERSION="3.3"
if [ "$PLATFORM"x = "ios"x ]; then
LLVM_PACKAGE="clang+llvm-3.3-x86_64-apple-darwin12"
LLVM_PACKAGE_SUFFIX=".tar.gz"
else
LLVM_PACKAGE="clang+llvm-3.3-Ubuntu-13.04-x86_64-linux-gnu"
LLVM_PACKAGE_SUFFIX=".tar.bz2"
fi
# Download llvm
echo "Download ${LLVM_PACKAGE} ..."
curl -O http://llvm.org/releases/${LLVM_VERSION}/${LLVM_PACKAGE}${LLVM_PACKAGE_SUFFIX}
echo "Decompress ${LLVM_PACKAGE} ..."
if [ "$PLATFORM"x = "ios"x ]; then
tar xzf ${LLVM_PACKAGE}${LLVM_PACKAGE_SUFFIX}
else
tar xjf ${LLVM_PACKAGE}${LLVM_PACKAGE_SUFFIX}
fi
# Rename llvm
mv ${LLVM_PACKAGE} clang+llvm-${LLVM_VERSION}
}
install_llvm_3_2()
{
if [ "$PLATFORM"x = "ios"x ]; then
HOST_NAME="apple-darwin11"
else
HOST_NAME="linux-ubuntu-12.04"
fi
# Download llvm3.2
echo "Download clang+llvm-3.2-x86_64-${HOST_NAME}.tar.gz"
curl -O http://llvm.org/releases/3.2/clang+llvm-3.2-x86_64-${HOST_NAME}.tar.gz
echo "Decompress clang+llvm-3.2-x86_64-${HOST_NAME}.tar.gz ..."
tar xzf clang+llvm-3.2-x86_64-${HOST_NAME}.tar.gz
# Rename llvm
mv clang+llvm-3.2-x86_64-${HOST_NAME} clang+llvm-3.2
}
install_nacl_sdk()
{
# NaCl compilers are built for 32-bit linux so we need to install
@ -92,7 +48,6 @@ if [ "$GEN_JSB"x = "YES"x ]; then
exit 0
fi
install_android_ndk
install_llvm
elif [ "$PLATFORM"x = "linux"x ]; then
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
# OpenMW team provides SDL2 package.
@ -104,19 +59,15 @@ elif [ "$PLATFORM"x = "linux"x ]; then
g++ --version
bash $COCOS2DX_ROOT/build/install-deps-linux.sh
install_android_ndk
install_llvm
elif [ "$PLATFORM"x = "nacl"x ]; then
install_nacl_sdk
elif [ "$PLATFORM"x = "android"x ]; then
install_android_ndk
install_llvm
elif [ "$PLATFORM"x = "emscripten"x ]; then
sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm
install_android_ndk
install_llvm_3_2
elif [ "$PLATFORM"x = "ios"x ]; then
install_android_ndk
install_llvm
pushd $COCOS2DX_ROOT
git submodule add https://github.com/facebook/xctool.git ./xctool
@ -127,3 +78,4 @@ else
echo "Unknown \$PLATFORM: '$PLATFORM'"
exit 1
fi