2013-03-17 14:07:41 +08:00
|
|
|
@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-r8d.
|
|
|
|
|
|
|
|
set PYTHON_ROOT=C:/Python27
|
2013-03-17 14:48:00 +08:00
|
|
|
set NDK_ROOT=C:/android-ndk-r8d
|
2013-03-17 14:07:41 +08:00
|
|
|
|
|
|
|
set PATH=%PATH%;%cd%/win32;%PYTHON_ROOT%
|
|
|
|
set COCOS2DX_ROOT=%cd%/../..
|
|
|
|
set "COCOS2DX_ROOT=%COCOS2DX_ROOT:\=/%"
|
2013-04-09 13:47:12 +08:00
|
|
|
set CXX_GENERATOR_ROOT=%COCOS2DX_ROOT%/tools/bindings-generator
|
2013-03-17 14:07:41 +08:00
|
|
|
set TO_JS_ROOT=%COCOS2DX_ROOT%/tools/tojs
|
|
|
|
set "CXX_GENERATOR_ROOT=%CXX_GENERATOR_ROOT:\=/%"
|
|
|
|
set OUTPUT_DIR=%COCOS2DX_ROOT%/scripting/javascript/bindings/generated
|
2013-03-17 14:48:00 +08:00
|
|
|
set "OUTPUT_DIR=%OUTPUT_DIR:/=\%"
|
2013-03-17 14:07:41 +08:00
|
|
|
set CLANG_ROOT=%NDK_ROOT%/toolchains/llvm-3.1/prebuilt/windows
|
|
|
|
|
|
|
|
:: 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=%CLANG_ROOT% >> %_CONF_INI_FILE%
|
|
|
|
echo cocosdir=%COCOS2DX_ROOT% >> %_CONF_INI_FILE%
|
|
|
|
echo cxxgeneratordir=%CXX_GENERATOR_ROOT% >> %_CONF_INI_FILE%
|
2013-03-17 14:11:15 +08:00
|
|
|
echo extra_flags=-D__ARM_EABI__ -D__GNUC__=2 >> %_CONF_INI_FILE%
|
2013-03-17 14:07:41 +08:00
|
|
|
echo ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:: Generate bindings for cocos2dx
|
|
|
|
echo Generating bindings for cocos2dx...
|
|
|
|
|
|
|
|
python %CXX_GENERATOR_ROOT%/generator.py %TO_JS_ROOT%/cocos2dx.ini -s cocos2d-x -o %OUTPUT_DIR% -n jsb_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 -o %OUTPUT_DIR% -n jsb_cocos2dx_extension_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
|
|
|
|
|