-
Notifications
You must be signed in to change notification settings - Fork 55
/
build.cmd
214 lines (178 loc) · 4.52 KB
/
build.cmd
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
@rem start this file to compile project
@echo off
setlocal
set target=%1%
set build=%2%
set cwd=%cd%
set buildlog=%cwd%\build.log
if '%target%' == '' (
echo.
echo Error: Target is not set.
goto errhelp
)
if not '%target%' == 'Release' (
if not '%target%' == 'Debug' (
if not '%target%' == 'Release-Unicode' (
if not '%target%' == 'Debug-Unicode' (
if not '%target%' == '"Release|Win32"' (
if not '%target%' == '"Debug|Win32"' (
if not '%target%' == '"Release|x64"' (
if not '%target%' == '"Debug|x64"' (
if not '%target%' == '"Release-Unicode|Win32"' (
if not '%target%' == '"Debug-Unicode|Win32"' (
if not '%target%' == '"Release-Unicode|x64"' (
if not '%target%' == '"Debug-Unicode|x64"' (
echo.
echo Error: Invalid target set.
goto errhelp
)
)
)
)
)
)
)
)
)
)
)
)
)
)
if "%build%" == "" (
set build=rebuild
)
if not "%VS80COMNTOOLS%" == "" (
set VSVERSION=2005
set VSVARS="%VS80COMNTOOLS%..\..\VC\vcvarsall.bat"
goto vsdetected
)
if not "%VS90COMNTOOLS%" == "" (
set VSVERSION=2008
set VSVARS="%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
goto vsdetected
)
if not "%VS100COMNTOOLS%" == "" (
set VSVERSION=2010
set VSVARS="%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
goto vsdetected
)
echo Error: Cannot detect visual studio! >&2
goto errexit
:vsdetected
echo Detected Visual Studio %VSVERSION%
if "%VSINSTALLDIR%" == "" (
call %VSVARS%
if not ERRORLEVEL 0 (
echo Error: Failed to set Visual Studio %VSVERSION% environment. >&2
echo Try to run this file from ^"Visual Studio %VSVERSION% Command Prompt^" >&2
goto errexit
)
)
echo Build type: "%build%" >%buildlog%
if %VSVERSION% equ 2005 goto skip_upgrade
echo Upgrading solutions for Visual Studio %VSVERSION%
cd staff
devenv /upgrade staff.sln >%buildlog%
if %ERRORLEVEL% gtr 0 (
echo Failed to upgrade solution staff.sln >&2
echo Please see build.log >&2
goto errexit
)
cd ..\das
devenv /upgrade das.sln >%buildlog%
if %ERRORLEVEL% gtr 0 (
echo Failed to upgrade solution das.sln >&2
echo Please see build.log >&2
goto errexit
)
cd ..
:skip_upgrade
echo %build%ing %target% version...
rem VS target
set ConfigurationName=target
rem ========== staff ===========
echo %build%ing staff...
echo %build%ing staff... >>%buildlog%
cd staff
devenv /%build% %target% staff.sln >>%buildlog%
if %ERRORLEVEL% gtr 0 (
echo Error while building staff >&2
echo Please see build.log >&2
goto errexit
)
echo staff %build%ing complete
rem ========== das ===========
echo %build%ing das...
echo %build%ing das... >>%buildlog%
cd ..\das
devenv /%build% %target% das.sln >>%buildlog%
if %ERRORLEVEL% gtr 0 (
echo Error while building das >&2
echo Please see build.log >&2
goto errexit
)
if "%POSTGRESQL_HOME%" == "" (
echo Skipping Postgresql provider compilation: POSTGRESQL_HOME is not set
goto skip_postgres
)
cd providers\postgres
devenv /%build% %target% postgres.vcproj >>%buildlog%
if %ERRORLEVEL% gtr 0 (
echo Error while building das postgres provider >&2
echo Please see build.log >&2
goto errexit
)
cd ..\..
:skip_postgres
if "%MYSQL_HOME%" == "" (
echo Skipping MySql provider compilation: MYSQL_HOME is not set
goto skip_mysql
)
cd providers\mysql
devenv /%build% %target% mysql.vcproj >>%buildlog%
if %ERRORLEVEL% gtr 0 (
echo Error while building das mysql provider >&2
echo Please see build.log >&2
goto errexit
)
cd ..\..
:skip_mysql
echo das %build%ing complete
cd ..
if "%build%" == "rebuild" goto buildok
if "%build%" == "build" goto buildok
goto exit
:buildok
set arch=Win32
if '%target%' == '"Release|x64"' (
set arch=x64
)
if '%target%' == '"Debug|x64"' (
set arch=x64
)
if '%target%' == '"Release-Unicode|x64"' (
set arch=x64
)
if '%target%' == '"Debug-Unicode|x64"' (
set arch=x64
)
echo.
echo.
echo Project successfuly built.
echo Start `install %arch%` to install project.
echo.
goto exit
:errhelp
echo.
echo Start this script as
echo %0% TARGET BUILD
echo where TARGET is one of `Release`, `Debug`, `"Release|Win32"`, `"Debug|Win32"`, `"Release|x64"`, `"Debug|x64"`
echo `Release-Unicode`, `Debug-Unicode`, `"Release-Unicode|Win32"`, `"Debug-Unicode|Win32"`, `"Release-Unicode|x64"`, `"Debug-Unicode|x64"`
echo and BUILD is `build`, `rebuild`, `clean` or empty ^(defaults is rebuild^)
goto errexit
:errexit
pause
set ERRORLEVEL=1
:exit
endlocal