axmol/tools/tolua++/build.xml

46 lines
1.9 KiB
XML

<project name="Cocos2d-xToLua" default="create-lua-bindings" basedir=".">
<description>
Utilises tolua++ to create the lua bindings to expose cocos2d-x functionality to lua
</description>
<property name="tolua++" location="tolua++.exe"/>
<target name="cocos2d-x-bindings">
<echo message="Calling tolua++" />
<exec executable="${tolua++}">
<arg value="-L" />
<arg value="basic.lua" />
<arg value="-o"/>
<arg value="LuaCocos2d.cpp"/>
<arg value="Cocos2d.pkg"/>
</exec>
<echo message="Patching resultant lua bindings" />
<replace file="LuaCocos2d.cpp">
<replacetoken><![CDATA[tolua_pushusertype_ccobject(tolua_S,(void*)tolua_ret]]></replacetoken>
<replacevalue><![CDATA[tolua_pushusertype_ccobject(tolua_S, &tolua_ret->m_refId, (void*)tolua_ret]]></replacevalue>
</replace>
<replace file="LuaCocos2d.cpp">
<replacetoken><![CDATA[unsigned void* tolua_ret = (unsigned void*) self->getTiles();]]></replacetoken>
<replacevalue><![CDATA[unsigned int* tolua_ret = (unsigned int*) self->getTiles();]]></replacevalue>
</replace>
<replace file="LuaCocos2d.cpp">
<replacetoken><![CDATA[ccColor3B color = *((ccColor3B*) tolua_tousertype(tolua_S,4,(void*)&(const ccColor3B)ccBLACK));]]></replacetoken>
<replacevalue><![CDATA[const ccColor3B clr = ccBLACK;
ccColor3B color = *((ccColor3B*) tolua_tousertype(tolua_S,4,(void*)&clr));]]></replacevalue>
</replace>
<replace file="LuaCocos2d.cpp">
<replacetoken><![CDATA[#include "LuaCocos2d.h"]]></replacetoken>
<replacevalue><![CDATA[#include "LuaCocos2d.h"
using namespace cocos2d;]]></replacevalue>
</replace>
<echo message="Copying new bindings to target location" />
<move file="LuaCocos2d.cpp" todir="../../lua/cocos2dx_support/"/>
</target>
<target name="create-lua-bindings" depends="cocos2d-x-bindings" />
</project>