Free cookie consent management tool by TermsFeed Policy Generator

source: branches/ChangeDatasetOfRegressionModel/Build.cmd @ 11082

Last change on this file since 11082 was 7087, checked in by abeham, 13 years ago

#1653

  • Changed Build.cmd to default build Release instead of Debug
File size: 2.4 KB
Line 
1@ECHO OFF
2
3SET CLEANBEFOREBUILD=0
4
5SET SELECTED=
6SET CONFIGURATION=
7SET PLATFORM=
8
9IF "%~1"=="" GOTO :prompt_solution
10
11SET SELECTED=%1
12IF NOT EXIST %SELECTED% (
13  ECHO Solution file %SELECTED% could not be found.
14  GOTO :end
15)
16ECHO Building solution %SELECTED% ...
17GOTO :config_selection
18
19:prompt_solution
20SET /A COUNT=0
21FOR /F "tokens=*" %%A IN ('dir /B *.sln') DO (
22  CALL :forloopbody "%%A"
23)
24
25IF "%COUNT%"=="1" (
26  SET SELECTED=%SOLUTIONS.1%
27  ECHO Building %SOLUTIONS.1% as it is the only solution that was found ...
28  GOTO :config_selection
29)
30
31ECHO Found the following solutions:
32FOR /F "tokens=2* delims=.=" %%A IN ('SET SOLUTIONS.') DO ECHO %%A = %%B
33ECHO.
34SET /P SOLUTIONINDEX=Which solution to build? Type the number:
35
36SET SELECTED=""
37FOR /F "tokens=2* delims=.=" %%A IN ('SET SOLUTIONS.') DO (
38  IF "%%A"=="%SOLUTIONINDEX%" SET SELECTED=%%B
39)
40
41IF %SELECTED%=="" GOTO :eof
42
43:config_selection
44IF "%~2"==""  GOTO :prompt_config
45
46SET CONFIGURATION=%~2
47ECHO Building configuration %CONFIGURATION% ...
48GOTO :platform_selection
49
50:prompt_config
51SET /P CONFIGURATION=Which configuration to build [Release]:
52IF "%CONFIGURATION%"=="" SET CONFIGURATION=Release
53
54:platform_selection
55IF "%~3"=="" GOTO :prompt_platform
56 
57SET PLATFORM=%~3
58ECHO Building platform %PLATFORM% ...
59GOTO :main
60
61:prompt_platform
62SET /P PLATFORM=Which platform to build [Any CPU]:
63IF "%PLATFORM%"=="" SET PLATFORM=Any CPU
64
65:main
66REM First find the path to the msbuild.exe by performing a registry query
67FOR /F "tokens=1,3 delims=   " %%A IN ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0"') DO (
68  IF "%%A"=="MSBuildToolsPath" SET MSBUILDPATH=%%B)
69
70REM Then execute msbuild to clean and build the solution
71REM Disable that msbuild creates a cache file of the solution
72SET MSBuildUseNoSolutionCache=1
73REM Run msbuild to clean and then build
74IF "%CLEANBEFOREBUILD%"=="1" (
75  ECHO Cleaning ...
76  %MSBUILDPATH%msbuild.exe %SELECTED% /target:Clean /p:Configuration="%CONFIGURATION%",Platform="%PLATFORM%" /m:2 /nologo /verbosity:q /clp:ErrorsOnly
77)
78ECHO Building ...
79%MSBUILDPATH%msbuild.exe %SELECTED% /target:Rebuild /p:Configuration="%CONFIGURATION%",Platform="%PLATFORM%" /m:2 /nologo /verbosity:q /clp:ErrorsOnly
80
81ECHO.
82ECHO DONE.
83
84:end
85
86PAUSE
87
88GOTO :eof
89
90REM This workaround is necessary so that COUNT gets reevaluated
91:forloopbody
92SET /A COUNT+=1
93SET SOLUTIONS.%COUNT%=%1
94GOTO :eof
Note: See TracBrowser for help on using the repository browser.