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 cStringIO
import re 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: try:
import PathUtils import PathUtils
except ImportError, e: 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 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 = ()): def gen_android_mk(mkfile, pathes, suffix = ("c", "cpp",), exclude = ()):
utils = PathUtils.PathUtils(COCOS_ROOT) utils = PathUtils.PathUtils(COCOS_ROOT)
@ -24,7 +36,7 @@ def gen_android_mk(mkfile, pathes, suffix = ("c", "cpp",), exclude = ()):
filestrio = cStringIO.StringIO() filestrio = cStringIO.StringIO()
for filename in filelst: for filename in filelst:
filestrio.write(' \\\n') 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') filestrio.write('\n')
# read mk file # read mk file
@ -65,7 +77,7 @@ def gen_android_mk(mkfile, pathes, suffix = ("c", "cpp",), exclude = ()):
mkstrio.close() mkstrio.close()
def main(): def main():
config = open("./config.py") config = open(CONFIG)
params = eval(config.read()) params = eval(config.read())
config.close() config.close()

View File

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