|
1 @echo off |
|
2 |
|
3 rem DOS batch file for building host-side libraries |
|
4 |
|
5 if '%EPOCROOT%'=='' goto PRINTUSAGE |
|
6 |
|
7 rem Set default values |
|
8 set SIMULATOR_EXTENSIONS=ON |
|
9 set TOOLCHAIN_VARIANT=vs2005 |
|
10 set CMAKE_BUILD_TARGET=Release |
|
11 set VISUAL_STUDIO_SOLUTION=OFF |
|
12 set BUILD=ON |
|
13 set EPOCROOTX=%EPOCROOT:\=/% |
|
14 |
|
15 :PARSECOMMANDLINE |
|
16 IF '%1'=='/h' goto PRINTUSAGE |
|
17 IF '%1'=='/H' goto PRINTUSAGE |
|
18 IF '%1'=='/?' goto PRINTUSAGE |
|
19 IF '%1'=='/nosimext' goto DISABLE_SIMULATOR_EXTENSIONS |
|
20 IF '%1'=='/NOSIMEXT' goto DISABLE_SIMULATOR_EXTENSIONS |
|
21 IF '%1'=='/vs' goto SETVISUALSTUDIOVERSION |
|
22 IF '%1'=='/VS' goto SETVISUALSTUDIOVERSION |
|
23 IF '%1'=='/solution' goto ENABLESOLUTION |
|
24 IF '%1'=='/SOLUTION' goto ENABLESOLUTION |
|
25 IF '%1'=='/debug' goto ENABLEDEBUG |
|
26 IF '%1'=='/DEBUG' goto ENABLEDEBUG |
|
27 IF '%1'=='/nobuild' goto DISABLEBUILD |
|
28 IF '%1'=='/NOBUILD' goto DISABLEBUILD |
|
29 |
|
30 if "%VISUAL_STUDIO_SOLUTION%"=="ON" ( |
|
31 set GENERATOR=Visual Studio 8 2005 |
|
32 if '%TOOLCHAIN_VARIANT%'=='2008' set GENERATOR=Visual Studio 9 2008 |
|
33 ) else ( |
|
34 set GENERATOR=NMake Makefiles |
|
35 ) |
|
36 |
|
37 rem Print out options |
|
38 echo. |
|
39 echo SIMULATOR_EXTENSIONS = %SIMULATOR_EXTENSIONS% |
|
40 echo TOOLCHAIN_VARIANT = %TOOLCHAIN_VARIANT% |
|
41 echo GENERATOR = %GENERATOR% |
|
42 echo CMAKE_BUILD_TARGET = %CMAKE_BUILD_TARGET% |
|
43 echo BUILD = %BUILD% |
|
44 echo EPOCROOT (modified) = %EPOCROOTX% |
|
45 echo. |
|
46 |
|
47 rem Execute |
|
48 echo on |
|
49 rmdir /s /q build |
|
50 mkdir build |
|
51 cd build |
|
52 cmake -DEPOCROOT=%EPOCROOTX% -DSIMULATOR_EXTENSIONS:Bool=%SIMULATOR_EXTENSIONS% -DTOOLCHAIN_VARIANT:String=%TOOLCHAIN_VARIANT% -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TARGET% -G "%GENERATOR%" .. |
|
53 @echo off |
|
54 if "%BUILD%"=="ON" ( |
|
55 if "%GENERATOR%"=="NMake Makefiles" ( |
|
56 echo on |
|
57 nmake |
|
58 @echo off |
|
59 ) |
|
60 ) |
|
61 @echo off |
|
62 cd .. |
|
63 |
|
64 goto END |
|
65 |
|
66 :PRINTUSAGE |
|
67 echo Usage: build.bat [options] |
|
68 echo Options:" |
|
69 echo [/H,/?] print this message and exit |
|
70 echo [/VS VERSION] set Visual Studio version |
|
71 echo supported versions = 2005, 2008 (default: 2005) |
|
72 echo [/SOLUTION] just generate VIsual Studio solution files |
|
73 echo (default: generate NMake makefiles and build) |
|
74 echo [/DEBUG] configure for debug build (default: release) |
|
75 echo [/NOBUILD] call cmake but do not call nmake |
|
76 echo note: has no effect if /SOLUTION is specified |
|
77 echo. |
|
78 echo Note: EPOCROOT must be defined to be the directory containing the epoc32 tree. |
|
79 goto END |
|
80 |
|
81 :DISABLE_SIMULATOR_EXTENSIONS |
|
82 set SIMULATOR_EXTENSIONS=OFF |
|
83 shift |
|
84 goto PARSECOMMANDLINE |
|
85 |
|
86 :SETVISUALSTUDIOVERSION |
|
87 set TOOLCHAIN_VARIANT=vs%2 |
|
88 shift |
|
89 shift |
|
90 goto PARSECOMMANDLINE |
|
91 |
|
92 :ENABLESOLUTION |
|
93 set VISUAL_STUDIO_SOLUTION=ON |
|
94 shift |
|
95 goto PARSECOMMANDLINE |
|
96 |
|
97 :ENABLEDEBUG |
|
98 set CMAKE_BUILD_TARGET=Debug |
|
99 shift |
|
100 goto PARSECOMMANDLINE |
|
101 |
|
102 :DISABLEBUILD |
|
103 set BUILD=OFF |
|
104 shift |
|
105 goto PARSECOMMANDLINE |
|
106 |
|
107 :END |