-
Notifications
You must be signed in to change notification settings - Fork 9
/
generate-cmake-lists.py
60 lines (45 loc) · 1.91 KB
/
generate-cmake-lists.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import os
cocos2d_root = os.path.dirname(os.path.abspath(__file__))
cocos2dx_root = os.path.join(cocos2d_root, 'cocos2dx')
platform_linux_root = os.path.join(cocos2dx_root, 'platform', 'linux')
execfile(os.path.expanduser('~/.emscripten'))
execfile(os.path.join(EMSCRIPTEN_ROOT, 'tools', 'ports', 'cocos2d.py'))
sources = make_source_list(cocos2d_root, cocos2dx_root)
platform_linux_sources = [f for f in os.listdir(platform_linux_root) if f.endswith('.cpp')]
includes = make_incldues(cocos2d_root, cocos2dx_root)
sources_lines = ""
for source in sources:
if 'platform/emscripten' not in source:
sources_lines = sources_lines + "\n\t" + os.path.join(cocos2dx_root, "proj.emscripten", source)
for source in platform_linux_sources:
sources_lines = sources_lines + "\n\t" + os.path.join(platform_linux_root, source)
include_lines = ""
for include in includes:
include = include.replace('/platform/emscripten', '/platform/linux')
include = include.replace('/platform/third_party/emscripten', '/platform/third_party/linux')
include = include.replace('libtiff/include', 'libtiff')
include_lines = include_lines + "\n\t PUBLIC " + include
CMakeLists = """
#
# This part of CMakeLists.txt is autogenerated with (cocos2d-port for emscripten)
#
if(${EMSCRIPTEN})
add_definitions(-DEMSCRIPTEN -DCC_KEYBOARD_SUPPORT -DGL_ES=1)
else()
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
set(CMAKE_C_FLAGS "-g -w -O0 -Wall")
set(CMAKE_CXX_FLAGS "--std=c++11")
# set(CMAKE_EXE_LINKER_FLAGS "-Wl,--unresolved-symbols=ignore-all")
add_definitions(-DLINUX -DCC_KEYBOARD_SUPPORT -DGL_ES=1 -DCOCOS2D_DEBUG=1) # use DCOCOS2D_DEBUG=2 for full logs
set(COCOS2D_SOURCES %s
)
set(COCOS2D_INLCUDE_DIRECTORIES %s
)
set(COCOS2D_LIBS
X11 GL GLEW pthread jpeg freetype z png SDL2 SDL_mixer tiff webp fontconfig
)
endif()
# ===
""" % (sources_lines, include_lines)
print CMakeLists