- Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathcreate-android-project.bat
More file actions
Latest commit
52 lines (40 loc) · 2.38 KB
/
Copy pathcreate-android-project.bat
File metadata and controls
52 lines (40 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@echooff
:: 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.
setlocal
:: Check if it was run under cocos2d-x root
ifnotexist"%cd%\create-android-project.bat"echo Error!!! You should run it under cocos2dx root &pause&exit2
ifnotexist"%~dpn0.sh"echo Script "%~dpn0.sh" not found &pause&exit3
:: modify it to work under your environment
set_CYGBIN=e:\cygwin\bin
ifnotexist"%_CYGBIN%"echo Couldn't find Cygwin at "%_CYGBIN%"&pause&exit4
:: modify it to work under your environment
set_ANDROIDTOOLS=e:\android\android-sdk\tools
ifnotexist"%_ANDROIDTOOLS%"echo Couldn't find android sdk tools at "%_ANDROIDTOOLS%"&pause&exit5
:: modify it to work under your environment
set_NDKROOT=e:\android\android-ndk-r8
ifnotexist"%_NDKROOT%"echo Couldn't find ndk at "%_NDKROOT%"&pause&exit6
:: create android project
set /P _PACKAGEPATH=Please enter your package path. For example: org.cocos2dx.example:
set /P _PROJECTNAME=Please enter your project name:
ifexist"%CD%\%_PROJECTNAME%"echo"%_PROJECTNAME%" exists, please use another name &pause&exit7
echo"Now cocos2d-x suppurts Android 2.1-update1, 2.2, 2.3 & 3.0"
echo"Other versions have not tested."
call"%_ANDROIDTOOLS%\android.bat" list targets
set /P _TARGETID=Please input target id:
set_PROJECTDIR=%CD%\%_PROJECTNAME%
echo Create android project
mkdir%_PROJECTDIR%
echo Create Android project inside proj.android
call"%_ANDROIDTOOLS%\android.bat" create project -n %_PROJECTNAME% -t %_TARGETID% -k %_PACKAGEPATH% -a %_PROJECTNAME% -p %_PROJECTDIR%\proj.android
call"%_ANDROIDTOOLS%\android.bat" update project -l ../../cocos2dx/platform/android/java -p %_PROJECTDIR%\proj.android
:: Resolve ___.sh to /cygdrive based *nix path and store in %_CYGSCRIPT%
for /f "delims="%%Ain ('%_CYGBIN%\cygpath.exe "%~dpn0.sh"') doset_CYGSCRIPT=%%A
:: Resolve current dir to cygwin path
for /f "delims="%%Ain ('%_CYGBIN%\cygpath.exe "%cd%"') doset_CURRENTDIR=%%A
:: Resolve ndk dir to cygwin path
for /f "delims="%%Ain ('%_CYGBIN%\cygpath.exe "%_NDKROOT%"') doset_NDKROOT=%%A
:: Throw away temporary env vars and invoke script, passing any args that were passed to us
endlocal&%_CYGBIN%\bash --login "%_CYGSCRIPT%"%_CURRENTDIR%%_PROJECTNAME%%_NDKROOT%%_PACKAGEPATH%"windows"
pause