(final)
| 22 | ports.fetch_project('cocos2d', f'https://github.com/emscripten-ports/Cocos2d/archive/{TAG}.zip', sha512hash=HASH) |
| 23 | |
| 24 | def create(final): |
| 25 | diagnostics.warning('experimental', 'cocos2d: library is experimental, do not expect that it will work out of the box') |
| 26 | |
| 27 | cocos2d_src = ports.get_dir('cocos2d') |
| 28 | cocos2d_root = os.path.join(cocos2d_src, 'Cocos2d-' + TAG) |
| 29 | cocos2dx_root = os.path.join(cocos2d_root, 'cocos2dx') |
| 30 | |
| 31 | srcs = make_source_list(cocos2d_root, cocos2dx_root) |
| 32 | includes = make_includes(cocos2d_root) |
| 33 | flags = [ |
| 34 | '-w', |
| 35 | '-D__CC_PLATFORM_FILEUTILS_CPP__', |
| 36 | '-DCC_ENABLE_CHIPMUNK_INTEGRATION', |
| 37 | '-DCC_KEYBOARD_SUPPORT', |
| 38 | '-DGL_ES=1', |
| 39 | '-DNDEBUG', # '-DCOCOS2D_DEBUG=1' 1 - error/warn, 2 - verbose |
| 40 | '-DCP_USE_DOUBLES=0', |
| 41 | '-sUSE_ZLIB', |
| 42 | '-sUSE_LIBPNG', |
| 43 | ] |
| 44 | |
| 45 | for dirname in includes: |
| 46 | target = os.path.join('cocos2d', os.path.relpath(dirname, cocos2d_root)) |
| 47 | ports.install_header_dir(dirname, target=target) |
| 48 | |
| 49 | ports.build_port(cocos2d_src, final, 'cocos2d', |
| 50 | flags=flags, |
| 51 | cxxflags=['-std=c++14'], |
| 52 | includes=includes, |
| 53 | srcs=srcs) |
| 54 | |
| 55 | return [shared.cache.get_lib('libcocos2d.a', create, what='port')] |
| 56 |
nothing calls this directly
no test coverage detected