2011-03-23 09:42:23 +08:00
|
|
|
@echo off
|
2011-03-23 15:01:00 +08:00
|
|
|
:: This script is used to create an android project.
|
|
|
|
:: You should modify _ANDROIDTOOLS _CYGBIN _NDKROOT to work under your environment.
|
|
|
|
:: Don't change it until you know what you do.
|
|
|
|
|
2011-03-23 09:42:23 +08:00
|
|
|
setlocal
|
2011-03-23 15:01:00 +08:00
|
|
|
|
|
|
|
:: Check if it was run under cocos2d-x root
|
|
|
|
if not exist "%cd%\create-android-project.bat" echo Error!!! You should run it under cocos2dx root & pause & exit 2
|
|
|
|
|
|
|
|
if not exist "%~dpn0.sh" echo Script "%~dpn0.sh" not found & pause & exit 3
|
2011-03-23 09:42:23 +08:00
|
|
|
|
2011-03-23 14:30:14 +08:00
|
|
|
:: modify it to work under your environment
|
2012-06-28 11:05:34 +08:00
|
|
|
set _CYGBIN=e:\cygwin\bin
|
2011-03-23 15:01:00 +08:00
|
|
|
if not exist "%_CYGBIN%" echo Couldn't find Cygwin at "%_CYGBIN%" & pause & exit 4
|
2011-03-23 09:42:23 +08:00
|
|
|
|
2011-03-23 14:30:14 +08:00
|
|
|
:: modify it to work under your environment
|
2012-06-28 11:05:34 +08:00
|
|
|
set _ANDROIDTOOLS=e:\android\android-sdk\tools
|
2011-03-23 15:01:00 +08:00
|
|
|
if not exist "%_ANDROIDTOOLS%" echo Couldn't find android sdk tools at "%_ANDROIDTOOLS%" & pause & exit 5
|
2011-03-23 14:30:14 +08:00
|
|
|
|
|
|
|
:: modify it to work under your environment
|
2012-06-28 11:05:34 +08:00
|
|
|
set _NDKROOT=e:\android\android-ndk-r8
|
2011-03-23 15:01:00 +08:00
|
|
|
if not exist "%_NDKROOT%" echo Couldn't find ndk at "%_NDKROOT%" & pause & exit 6
|
2011-03-23 09:42:23 +08:00
|
|
|
|
|
|
|
:: create android project
|
2011-12-29 10:39:46 +08:00
|
|
|
set /P _PACKAGEPATH=Please enter your package path. For example: org.cocos2dx.example:
|
2011-03-23 09:42:23 +08:00
|
|
|
set /P _PROJECTNAME=Please enter your project name:
|
2011-12-29 10:39:46 +08:00
|
|
|
if exist "%CD%\%_PROJECTNAME%" echo "%_PROJECTNAME%" exists, please use another name & pause & exit 7
|
2011-06-25 14:13:08 +08:00
|
|
|
echo "Now cocos2d-x suppurts Android 2.1-update1, 2.2, 2.3 & 3.0"
|
2011-03-24 13:48:05 +08:00
|
|
|
echo "Other versions have not tested."
|
2011-12-19 13:50:20 +08:00
|
|
|
call "%_ANDROIDTOOLS%\android.bat" list targets
|
2011-03-24 13:48:05 +08:00
|
|
|
set /P _TARGETID=Please input target id:
|
2011-03-23 09:42:23 +08:00
|
|
|
set _PROJECTDIR=%CD%\%_PROJECTNAME%
|
|
|
|
|
|
|
|
echo Create android project
|
2012-05-24 05:02:56 +08:00
|
|
|
mkdir %_PROJECTDIR%
|
|
|
|
echo Create Android project inside proj.android
|
2012-06-28 11:05:34 +08:00
|
|
|
call "%_ANDROIDTOOLS%\android.bat" create project -n %_PROJECTNAME% -t %_TARGETID% -k %_PACKAGEPATH% -a %_PROJECTNAME% -p %_PROJECTDIR%\proj.android
|
2011-03-23 09:42:23 +08:00
|
|
|
|
|
|
|
:: Resolve ___.sh to /cygdrive based *nix path and store in %_CYGSCRIPT%
|
|
|
|
for /f "delims=" %%A in ('%_CYGBIN%\cygpath.exe "%~dpn0.sh"') do set _CYGSCRIPT=%%A
|
|
|
|
|
|
|
|
:: Resolve current dir to cygwin path
|
|
|
|
for /f "delims=" %%A in ('%_CYGBIN%\cygpath.exe "%cd%"') do set _CURRENTDIR=%%A
|
|
|
|
|
2011-03-23 14:30:14 +08:00
|
|
|
:: Resolve ndk dir to cygwin path
|
|
|
|
for /f "delims=" %%A in ('%_CYGBIN%\cygpath.exe "%_NDKROOT%"') do set _NDKROOT=%%A
|
2011-03-23 09:42:23 +08:00
|
|
|
|
|
|
|
:: Throw away temporary env vars and invoke script, passing any args that were passed to us
|
2012-03-02 15:39:03 +08:00
|
|
|
endlocal & %_CYGBIN%\bash --login "%_CYGSCRIPT%" %_CURRENTDIR% %_PROJECTNAME% %_NDKROOT% %_PACKAGEPATH% "windows"
|
2011-05-09 15:21:08 +08:00
|
|
|
|
|
|
|
pause
|