mirror of https://github.com/axmolengine/axmol.git
Add argument --ios to compile Mac & iOS platforms separately.
This commit is contained in:
parent
761ba4f7cb
commit
f27b370b94
|
@ -45,6 +45,7 @@ class CocosLibsCompiler(object):
|
|||
self.clean = args.clean
|
||||
self.build_win = args.win
|
||||
self.build_mac = args.mac
|
||||
self.build_ios = args.ios
|
||||
self.build_android = args.android
|
||||
self.disable_strip = args.disable_strip
|
||||
self.repo_x = args.repo_x
|
||||
|
@ -53,6 +54,7 @@ class CocosLibsCompiler(object):
|
|||
if args.all:
|
||||
self.build_win = True
|
||||
self.build_mac = True
|
||||
self.build_ios = True
|
||||
self.build_android = True
|
||||
|
||||
if args.app_abi is None:
|
||||
|
@ -87,7 +89,7 @@ class CocosLibsCompiler(object):
|
|||
self.clean_libs()
|
||||
if self.build_win:
|
||||
self.compile_win()
|
||||
if self.build_mac:
|
||||
if self.build_mac or self.build_ios:
|
||||
self.compile_mac_ios()
|
||||
if self.build_android:
|
||||
self.compile_android()
|
||||
|
@ -229,36 +231,38 @@ class CocosLibsCompiler(object):
|
|||
xcode_proj_info = self.cfg_info[CocosLibsCompiler.KEY_XCODE_PROJS_INFO]
|
||||
|
||||
XCODE_CMD_FMT = "xcodebuild -project \"%s\" -configuration Release -target \"%s\" %s CONFIGURATION_BUILD_DIR=%s"
|
||||
ios_out_dir = os.path.join(self.lib_dir, "ios")
|
||||
mac_out_dir = os.path.join(self.lib_dir, "mac")
|
||||
ios_sim_libs_dir = os.path.join(ios_out_dir, "simulator")
|
||||
ios_dev_libs_dir = os.path.join(ios_out_dir, "device")
|
||||
for key in xcode_proj_info.keys():
|
||||
proj_path = os.path.join(self.repo_x, key)
|
||||
ios_out_dir = os.path.join(self.lib_dir, "ios")
|
||||
mac_out_dir = os.path.join(self.lib_dir, "mac")
|
||||
ios_sim_libs_dir = os.path.join(ios_out_dir, "simulator")
|
||||
ios_dev_libs_dir = os.path.join(ios_out_dir, "device")
|
||||
|
||||
target = xcode_proj_info[key][CocosLibsCompiler.KEY_XCODE_TARGETS]
|
||||
|
||||
# compile ios simulator
|
||||
build_cmd = XCODE_CMD_FMT % (proj_path, "%s iOS" % target, "-sdk iphonesimulator ARCHS=\"i386 x86_64\" VALID_ARCHS=\"i386 x86_64\"", ios_sim_libs_dir)
|
||||
retVal = utils_cocos.execute_command(build_cmd)
|
||||
if 0 != retVal:
|
||||
print("[ERROR] compile ios simulator fail")
|
||||
return retVal
|
||||
if self.build_mac:
|
||||
# compile mac
|
||||
build_cmd = XCODE_CMD_FMT % (proj_path, "%s Mac" % target, "", mac_out_dir)
|
||||
retVal = utils_cocos.execute_command(build_cmd)
|
||||
if 0 != retVal:
|
||||
print("[ERROR] compile mac fail")
|
||||
return retVal
|
||||
|
||||
# compile ios device
|
||||
build_cmd = XCODE_CMD_FMT % (proj_path, "%s iOS" % target, "-sdk iphoneos", ios_dev_libs_dir)
|
||||
retVal = utils_cocos.execute_command(build_cmd)
|
||||
if 0 != retVal:
|
||||
print("[ERROR] compile ios device fail")
|
||||
return retVal
|
||||
if self.build_ios:
|
||||
# compile ios simulator
|
||||
build_cmd = XCODE_CMD_FMT % (proj_path, "%s iOS" % target, "-sdk iphonesimulator ARCHS=\"i386 x86_64\" VALID_ARCHS=\"i386 x86_64\"", ios_sim_libs_dir)
|
||||
retVal = utils_cocos.execute_command(build_cmd)
|
||||
if 0 != retVal:
|
||||
print("[ERROR] compile ios simulator fail")
|
||||
return retVal
|
||||
|
||||
# compile mac
|
||||
build_cmd = XCODE_CMD_FMT % (proj_path, "%s Mac" % target, "", mac_out_dir)
|
||||
retVal = utils_cocos.execute_command(build_cmd)
|
||||
if 0 != retVal:
|
||||
print("[ERROR] compile mac fail")
|
||||
return retVal
|
||||
# compile ios device
|
||||
build_cmd = XCODE_CMD_FMT % (proj_path, "%s iOS" % target, "-sdk iphoneos", ios_dev_libs_dir)
|
||||
retVal = utils_cocos.execute_command(build_cmd)
|
||||
if 0 != retVal:
|
||||
print("[ERROR] compile ios device fail")
|
||||
return retVal
|
||||
|
||||
if self.build_ios:
|
||||
# generate fat libs for iOS
|
||||
for lib in os.listdir(ios_sim_libs_dir):
|
||||
sim_lib = os.path.join(ios_sim_libs_dir, lib)
|
||||
|
@ -272,10 +276,12 @@ class CocosLibsCompiler(object):
|
|||
utils_cocos.rmdir(ios_sim_libs_dir)
|
||||
utils_cocos.rmdir(ios_dev_libs_dir)
|
||||
|
||||
if not self.disable_strip:
|
||||
# strip the libs
|
||||
if not self.disable_strip:
|
||||
# strip the libs
|
||||
if self.build_ios:
|
||||
ios_strip_cmd = "xcrun -sdk iphoneos strip -S %s/*.a" % ios_out_dir
|
||||
utils_cocos.execute_command(ios_strip_cmd)
|
||||
if self.build_mac:
|
||||
mac_strip_cmd = "xcrun strip -S %s/*.a" % mac_out_dir
|
||||
utils_cocos.execute_command(mac_strip_cmd)
|
||||
|
||||
|
@ -378,7 +384,8 @@ if __name__ == "__main__":
|
|||
parser.add_argument('-c', dest='clean', action="store_true", help='clean libs folder')
|
||||
parser.add_argument('-all', dest='all', action="store_true", help='compile all platform')
|
||||
parser.add_argument('--win', dest='win', action="store_true", help='compile windows platform')
|
||||
parser.add_argument('--mac', dest='mac', action="store_true", help='compile mac platform')
|
||||
parser.add_argument('--mac', dest='mac', action="store_true", help='compile Mac platform')
|
||||
parser.add_argument('--ios', dest='ios', action="store_true", help='compile iOS platform')
|
||||
parser.add_argument('--android', dest='android', action="store_true",help='complile android platform')
|
||||
parser.add_argument('--dis-strip', "--disable-strip", dest='disable_strip', action="store_true", help='Disable the strip of the generated libs.')
|
||||
parser.add_argument('--vs', dest='vs_version', type=int, help='visual studio version, such as 2013.', default=None)
|
||||
|
|
Loading…
Reference in New Issue