Christian Heimes | 4a7cae5 | 2007-11-08 23:55:45 +0000 | [diff] [blame] | 1 | @echo off |
Zachary Ware | e12fa65 | 2014-07-07 13:39:59 -0500 | [diff] [blame] | 2 | rem A batch program to build or rebuild a particular configuration, |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 3 | rem just for convenience. |
| 4 | |
Zachary Ware | e12fa65 | 2014-07-07 13:39:59 -0500 | [diff] [blame] | 5 | rem Arguments: |
| 6 | rem -c Set the configuration (default: Release) |
| 7 | rem -p Set the platform (x64 or Win32, default: Win32) |
| 8 | rem -r Target Rebuild instead of Build |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 9 | rem -t Set the target manually (Build, Rebuild, Clean, or CleanAll) |
Zachary Ware | e12fa65 | 2014-07-07 13:39:59 -0500 | [diff] [blame] | 10 | rem -d Set the configuration to Debug |
| 11 | rem -e Pull in external libraries using get_externals.bat |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 12 | rem -M Disable parallel build |
| 13 | rem -v Increased output messages |
Zachary Ware | e12fa65 | 2014-07-07 13:39:59 -0500 | [diff] [blame] | 14 | |
Christian Heimes | 4a7cae5 | 2007-11-08 23:55:45 +0000 | [diff] [blame] | 15 | setlocal |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 16 | set platf=Win32 |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 17 | set vs_platf=x86 |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 18 | set conf=Release |
Zachary Ware | e12fa65 | 2014-07-07 13:39:59 -0500 | [diff] [blame] | 19 | set target=Build |
Brian Curtin | 5c2725d | 2012-05-22 11:04:32 -0500 | [diff] [blame] | 20 | set dir=%~dp0 |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 21 | set parallel=/m |
| 22 | set verbose=/nologo /v:m |
Christian Heimes | 4a7cae5 | 2007-11-08 23:55:45 +0000 | [diff] [blame] | 23 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 24 | :CheckOpts |
Zachary Ware | c6f8c0a | 2014-07-31 23:58:27 -0500 | [diff] [blame] | 25 | if '%1'=='-c' (set conf=%2) & shift & shift & goto CheckOpts |
| 26 | if '%1'=='-p' (set platf=%2) & shift & shift & goto CheckOpts |
| 27 | if '%1'=='-r' (set target=Rebuild) & shift & goto CheckOpts |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 28 | if '%1'=='-t' (set target=%2) & shift & shift & goto CheckOpts |
Zachary Ware | c6f8c0a | 2014-07-31 23:58:27 -0500 | [diff] [blame] | 29 | if '%1'=='-d' (set conf=Debug) & shift & goto CheckOpts |
| 30 | if '%1'=='-e' call "%dir%get_externals.bat" & shift & goto CheckOpts |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 31 | if '%1'=='-M' (set parallel=) & shift & goto CheckOpts |
| 32 | if '%1'=='-v' (set verbose=/v:n) & shift & goto CheckOpts |
Christian Heimes | 4a7cae5 | 2007-11-08 23:55:45 +0000 | [diff] [blame] | 33 | |
Zachary Ware | c6f8c0a | 2014-07-31 23:58:27 -0500 | [diff] [blame] | 34 | if '%platf%'=='x64' (set vs_platf=x86_amd64) |
Zachary Ware | e12fa65 | 2014-07-07 13:39:59 -0500 | [diff] [blame] | 35 | |
| 36 | rem Setup the environment |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 37 | call "%dir%env.bat" %vs_platf% >nul |
Zachary Ware | e12fa65 | 2014-07-07 13:39:59 -0500 | [diff] [blame] | 38 | |
| 39 | rem Call on MSBuild to do the work, echo the command. |
| 40 | rem Passing %1-9 is not the preferred option, but argument parsing in |
| 41 | rem batch is, shall we say, "lackluster" |
| 42 | echo on |
Steve Dower | 65e4cb1 | 2014-11-22 12:54:57 -0800 | [diff] [blame] | 43 | msbuild "%dir%pcbuild.proj" /t:%target% %parallel% %verbose% /p:Configuration=%conf% /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9 |