It’s my first time to contribute to cocos2d-x, I’ve submitted a pull request, it didn’t pass the ci. The test fails on some error of lua library, but I didn’t modified any code of it, the diff proved that.
By the way, my own test case runs, but some of them are not since I cloned the repo.
cmake test failed like this: C:\projects\cocos2d-x\cocos\scripting\lua-bindings\auto\lua_cocos2dx_auto.cpp(101214): error C2770: invalid explicit template argument(s) for 'void object_to_luaval(lua_State *,const char *,T *)' [C:\projects\cocos2d-x\win32-build\engine\cocos\lua-bindings\luacocos2d.vcxproj]
sln test failed like this: 10>..\auto\jsb_cocos2dx_auto.cpp(65491): error C2672: 'js_get_or_create_jsobject': no matching overloaded function found [C:\projects\cocos2d-x\cocos\scripting\js-bindings\proj.win32\libjscocos2d.vcxproj]
and lua test failed like this: C:/projects/cocos2d-x/cocos/scripting/lua-bindings/proj.android/../auto/lua_cocos2dx_auto.cpp:101214:9: error: no matching function for call to 'object_to_luaval'
and Travis-CI reports that kind of errors too:
/Users/travis/build/cocos2d/cocos2d-x/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp:101214:9: no matching function for call to ‘object_to_luaval’
or:
/Users/travis/build/cocos2d/cocos2d-x/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp:65491:37: no matching function for call to ‘js_get_or_create_jsobject’
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<std::map<unsigned int, std::vectorcocos2d::Vec2>&>(cx, (std::map<unsigned int, std::vectorcocos2d::Vec2>&)ret));
^~~
All errors are about script bindings, especially lua. I didn’t modified any thing about it, only applied cpp code, the diff proved that. What I wondered is, is there anything I must do to lua and js bindings since I commited cpp codes?
Finally here’s the last problem for passing CI: 9>libluacocos2d.lib(lua_cocos2dx_auto.obj) : error LNK2019: unresolved external symbol "public: void __thiscall cocos2d::TMXTileAnimManager::stop(void)" (?stop@TMXTileAnimManager@cocos2d@@QAEXXZ) referenced in function "int __cdecl lua_cocos2dx_TMXTileAnimManager_stop(struct lua_State *)" (?lua_cocos2dx_TMXTileAnimManager_stop@@YAHPAUlua_State@@@Z) [C:\projects\cocos2d-x\tests\lua-empty-test\project\proj.win32\lua-empty-test.vcxproj]
It seems those API i applied can not be locate by lua or sth?
I’m sorry that I have no windows device to test that for now, I’ll try to find one
The instructions seem to be for Linux, but they’re pretty much the same for any other OS. The only thing to note is that you should use NDK 16 to do this (NDK20 causes errors). I’m not sure if any other newer NDK works, but it doesn’t matter, since NDK 16 does the job.
You’ll need Python 2.7 x86, not x64 (at least from my experience).
To generate the bindings, just go into cocosdir/tools/tojs/ and type:
py ./genbindings.py
Then do the same for LUA in cocosdir/tools/tolua/.
Fix any errors that appear, and once it generates them successfully, you should open the JS and LUA test projects in the test folder, and run them to make sure they work.
Thanks so much! I’ve been tried NDK 20 and it caused error exactly, I’ll try 16 now.
But what confused me is, the test on AppVeyor seems will re-generate bindings, but only cmake test passed and sln is not…
If it’s this that is failing, tests\lua-tests\project\proj.win32, then one thing you can try to do is generate a Visual Studio solution using CMake, and then do a file comparison of the new vcxproj file (which works) with this one that doesn’t work, tests\lua-tests\project\proj.win32\lua-tests.win32.vcxproj. You may be able to see what is missing in it.
I tried… but they quite different… I tested some settings but the original sln and vcxproject files still won’t work, those generated by cmake runs well… This is the last error in CIs but I think it’s too hard for me…
Is there any workflow about what to do after modified C++ API? I’ve already re-generated script bindings, but now lua-test project reports LNK2019 unresolved symbol about new functions that I added into TMXLayer.h and .cpp. But those functions it originally contains won’t cause that error.
The issue isn’t related to the project files, and while the CMake Win32 generated project files worked, it was a bit misleading. The symbols we’re being exported for the TMXTileAnimManager and TMXTileAnimTask classes, so add CC_DLL to them and that should sort it all out.
class CC_DLL TMXTileAnimTask
{
...
}
class CC_DLL TMXTileAnimManager : public Ref
{
...
}
You may need to regenerate the JS and LUA bindings after you do this.