2013-11-04 16:48:17 +08:00
#!/usr/bin/python
# build_native.py
# Build native codes
2014-12-30 16:24:16 +08:00
#
# Please use cocos console instead
2013-11-04 16:48:17 +08:00
import sys
import os , os . path
import shutil
2013-12-25 11:01:23 +08:00
from optparse import OptionParser
2013-11-04 16:48:17 +08:00
2014-12-30 16:24:16 +08:00
def build ( build_mode ) :
2014-01-18 15:27:59 +08:00
2013-11-04 16:48:17 +08:00
current_dir = os . path . dirname ( os . path . realpath ( __file__ ) )
2013-12-24 09:42:37 +08:00
cocos_root = os . path . join ( current_dir , " ../cocos2d " )
2013-11-04 16:48:17 +08:00
2014-12-30 16:24:16 +08:00
app_android_root = os . path . join ( current_dir , " ../ " )
2013-12-25 11:01:23 +08:00
if build_mode is None :
build_mode = ' debug '
elif build_mode != ' release ' :
build_mode = ' debug '
2014-12-30 16:24:16 +08:00
command = ' cocos compile -p android -s %s -m %s ' % ( app_android_root , build_mode )
if os . system ( command ) != 0 :
raise Exception ( " Build dynamic library for project [ " + app_android_root + " ] fails! " )
2013-11-04 16:48:17 +08:00
# -------------- main --------------
if __name__ == ' __main__ ' :
2013-12-25 11:01:23 +08:00
parser = OptionParser ( )
2014-12-30 16:24:16 +08:00
parser . add_option ( " -n " , " --ndk " , dest = " ndk_build_param " , help = ' it is not used ' , action = " append " )
2013-12-25 11:01:23 +08:00
parser . add_option ( " -p " , " --platform " , dest = " android_platform " ,
2014-12-30 16:24:16 +08:00
help = ' it is not used ' )
2013-12-25 11:01:23 +08:00
parser . add_option ( " -b " , " --build " , dest = " build_mode " ,
help = ' the build mode for java project,debug[default] or release.Get more information,please refer to http://developer.android.com/tools/building/building-cmdline.html ' )
( opts , args ) = parser . parse_args ( )
2014-12-30 16:24:16 +08:00
print " Please use cocos console instead. \n "
2014-11-27 21:56:06 +08:00
2014-12-30 16:24:16 +08:00
build ( opts . build_mode )