config android_mk_generator

This commit is contained in:
lite3 2013-10-29 22:53:01 +08:00
parent 5c8424423e
commit 2e3b3be125
2 changed files with 18 additions and 10 deletions

View File

@ -6,15 +6,27 @@ import os.path
import cStringIO
import re
def get_cur_dir():
path = sys.path[0]
if os.path.isdir(path):
return path
elif os.path.isfile(path):
return os.path.dirname(path)
CUR_DIR = get_cur_dir()
COCOS_ROOT = os.path.abspath(os.path.join(CUR_DIR, "../../"))
CONFIG = os.path.abspath(os.path.join(CUR_DIR, "./config.py"))
print 'CONFIG:' + CONFIG
print 'COCOS_ROOT:' + COCOS_ROOT
try:
import PathUtils
except ImportError, e:
sys.path.append(os.path.abspath(os.path.join(os.curdir, "../pylib")))
sys.path.append(os.path.abspath(os.path.join(CUR_DIR, "../pylib")))
import PathUtils
COCOS_ROOT = "../../"
COCOS_ROOT = os.path.abspath(os.path.join(os.curdir, COCOS_ROOT))
def gen_android_mk(mkfile, pathes, suffix = ("c", "cpp",), exclude = ()):
utils = PathUtils.PathUtils(COCOS_ROOT)
@ -24,7 +36,7 @@ def gen_android_mk(mkfile, pathes, suffix = ("c", "cpp",), exclude = ()):
filestrio = cStringIO.StringIO()
for filename in filelst:
filestrio.write(' \\\n')
filestrio.write("$(LOCAL_PATH)/"+os.path.relpath(filename, os.path.dirname(os.path.join(COCOS_ROOT, mkfile))))
filestrio.write(os.path.relpath(filename, os.path.dirname(os.path.join(COCOS_ROOT, mkfile))))
filestrio.write('\n')
# read mk file
@ -65,7 +77,7 @@ def gen_android_mk(mkfile, pathes, suffix = ("c", "cpp",), exclude = ()):
mkstrio.close()
def main():
config = open("./config.py")
config = open(CONFIG)
params = eval(config.read())
config.close()

View File

@ -20,9 +20,5 @@
{
'mkfile' : 'external/chipmunk/Android.mk',
'pathes' : ("external/chipmunk/",),
},
{
'mkfile' : 'cocos2dx/platform/android/Android.mk',
'pathes' : ('cocos2dx/platform/android/',),
},
}
]