-
Notifications
You must be signed in to change notification settings - Fork 26
/
make_product.bat
378 lines (302 loc) · 12.2 KB
/
make_product.bat
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
@echo off
REM Set to the name of the sub-directories for the output files
SET PRODUCTDIR=___Product___\Release
SET DEBUGPRODDIR=___Product___\Debug
SET "PPJOYDIR=%~dp0"
ECHO Building PPJoy...
REM ============ Build options for customised PPJoy setup =======================
rem rem SET INSTALLBAT=PPJoy.bat
rem rem SET PPJOYZIP=PPJoySetup.zip
REM =============================================================================
REM ============ Compiler config ==============================
SET "DDKROOT=C:\WinDDK\7600.16385.1"
SET "VSROOT=C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE"
SET "VSE2005ROOT=C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE"
SET "VSE2005CMD=VCExpress.exe"
REM ===========================================================
echo.
echo Starting build process
echo ======================
echo.
PUSHD %PPJOYDIR%
@If Exist "%PPJOYDIR%\%PRODUCTDIR%" RD /s /Q "%PPJOYDIR%\%PRODUCTDIR%"
@If Exist "%PPJOYDIR%\%DEBUGPRODDIR%" RD /s /Q "%PPJOYDIR%\%DEBUGPRODDIR%"
@If Exist "%PPJOYDIR%\Scripts" RD /s /Q "%PPJOYDIR%\Scripts"
MD "%PPJOYDIR%\%PRODUCTDIR%"
MD "%PPJOYDIR%\%PRODUCTDIR%\__Support__"
MD "%PPJOYDIR%\%DEBUGPRODDIR%"
MD "%PPJOYDIR%\%DEBUGPRODDIR%\__Support__"
MD "%PPJOYDIR%\Scripts"
echo.
echo =====================================================
echo Building checked (debug) version of PPJoy drivers
echo =====================================================
echo.
SETLOCAL
call "%DDKROOT%\bin\setenv.bat" %DDKROOT% chk wxp
CD /D "%PPJOYDIR%"
build /c
ENDLOCAL
echo.
echo ====================================================
echo Building free (release) version of PPJoy drivers
echo ====================================================
echo.
SETLOCAL
call "%DDKROOT%\bin\setenv.bat" %DDKROOT% fre wxp
CD /D "%PPJOYDIR%"
build /c
ENDLOCAL
echo.
echo ============================================================
echo Building checked (debug) 64 bit version of PPJoy drivers
echo ============================================================
echo.
SETLOCAL
call "%DDKROOT%\bin\setenv.bat" %DDKROOT% chk x64 WLH
CD /D "%PPJOYDIR%"
build /c
ENDLOCAL
echo.
echo ===========================================================
echo Building free (release) 64 bit version of PPJoy drivers
echo ===========================================================
echo.
SETLOCAL
call "%DDKROOT%\bin\setenv.bat" %DDKROOT% fre x64 WLH
CD /D "%PPJOYDIR%"
build /c
ENDLOCAL
echo.
echo ==================================================
echo Building setup helper plugin (legacy platform)
echo ==================================================
echo.
SETLOCAL
call "%VSE2005ROOT%\..\..\VC\bin\vcvars32.bat"
SET "INCLUDE=%INCLUDE%%DDKROOT%\inc\api"
SET "LIB=%LIB%;%DDKROOT%\lib\wxp\i386"
cd /D "%PPJOYDIR%\SetupHelper"
"%VSE2005ROOT%\%VSE2005CMD%" /useenv SetupHelper.sln /rebuild "Debug|Win32"
"%VSE2005ROOT%\%VSE2005CMD%" /useenv SetupHelper.sln /rebuild "Release|Win32"
REM output is only in Buildlog.html - make plan later
ENDLOCAL
SETLOCAL
REM Set env variables for command line compiler - will use is some cases
call "%VSROOT%"..\..\..\VC\bin\vcvars32.bat
SET INCLUDE=%INCLUDE%;"%DDKROOT%\inc\api
REM for some strange reason the wxp directory is missing the dxguid.lib library so we tack the Win 2003 srv dir on to the end.
SET LIB=%LIB%;"%DDKROOT%\lib\wxp\i386;"%DDKROOT%\lib\wnet\i386
echo.
echo ====================================
echo Creating additional script files
echo ====================================
echo.
cd /D "%PPJOYDIR%\CreateBAT"
"%VSROOT%\devenv" CreateBAT.sln /rebuild "Release|Win32" /UseEnv
cd /D "%PPJOYDIR%\Scripts"
"%PPJOYDIR%\CreateBAT\Release\CreateBAT"
echo.
echo =====================================
echo Creating Device Driver INF Files
echo =====================================
echo.
cd /D "%PPJOYDIR%\CreateINF"
"%VSROOT%\devenv" CreateINF.sln /rebuild "Release|Win32" /UseEnv
cd /D "%PPJOYDIR%\%PRODUCTDIR%"
"%PPJOYDIR%\CreateINF\Release\CreateINF"
cd /D "%PPJOYDIR%\%DEBUGPRODDIR%
"%PPJOYDIR%\CreateINF\Release\CreateINF"
echo.
echo =====================================
echo Building AddJoyDrivers helper dll
echo =====================================
echo.
cd /D "%PPJOYDIR%\AddJoyDrivers"
"%VSROOT%\devenv" AddJoyDrivers.sln /rebuild "Debug|Win32" /UseEnv
"%VSROOT%\devenv" AddJoyDrivers.sln /rebuild "Release|Win32" /UseEnv
echo.
echo =====================================
echo Building Helper64 x64 helper
echo =====================================
echo.
REM Don't use environment override for x64 - we set 32 it env vars
cd /D "%PPJOYDIR%\Helper64"
"%VSROOT%\devenv" Helper64.sln /rebuild "Debug|x64"
"%VSROOT%\devenv" Helper64.sln /rebuild "Release|x64"
echo.
echo =====================================
echo Building UnInst64 x64 helper
echo =====================================
echo.
REM Don't use environment override for x64 - we set 32 it env vars
cd /D "%PPJOYDIR%\UnInst64"
"%VSROOT%\devenv" UnInst64.sln /rebuild "Debug|x64"
"%VSROOT%\devenv" UnInst64.sln /rebuild "Release|x64"
echo.
echo =====================================
echo Building ViseHelper helper dll
echo =====================================
echo.
cd /D "%PPJOYDIR%\ViseHelper"
"%VSROOT%\devenv" ViseHelper.sln /rebuild "Debug|Win32" /UseEnv
"%VSROOT%\devenv" ViseHelper.sln /rebuild "Release|Win32" /UseEnv
echo.
echo =====================================
echo Building PPJoyAPI library
echo =====================================
echo.
cd /D "%PPJOYDIR%\PPJoyAPI"
"%VSROOT%\devenv" PPJoyAPI.sln /rebuild "Debug|Win32" /UseEnv
"%VSROOT%\devenv" PPJoyAPI.sln /rebuild "Release|Win32" /UseEnv
echo.
echo =========================================
echo Building IOCTLSample test application
echo =========================================
echo.
cd /D "%PPJOYDIR%\IOCTLSample"
copy /y "%PPJOYDIR%\Scripts\ppjioctl_devname.h"
"%VSROOT%\devenv" IOCTLSample.sln /rebuild "Release|Win32" /UseEnv
echo.
echo ============================================
echo Building PPJoy Control Panel application
echo ============================================
echo.
cd /D "%PPJOYDIR%\PPJoyCpl"
"%VSROOT%\devenv" PPJoyCpl.sln /rebuild "Debug|Win32" /UseEnv
"%VSROOT%\devenv" PPJoyCpl.sln /rebuild "Release|Win32" /UseEnv
echo.
echo =================================
echo Building PPJoyCOM application
echo =================================
echo.
cd /D "%PPJOYDIR%\PPJoyCOM"
"%VSROOT%\devenv" PPJoyCOM.sln /rebuild "Debug|Win32" /UseEnv
"%VSROOT%\devenv" PPJoyCOM.sln /rebuild "Release|Win32" /UseEnv
echo.
echo =================================
echo Building PPJoyDLL application
echo =================================
echo.
cd /D "%PPJOYDIR%\PPJoyDLL"
"%VSROOT%\devenv" PPJoyDLL.sln /rebuild "Debug|Win32" /UseEnv
"%VSROOT%\devenv" PPJoyDLL.sln /rebuild "Release|Win32" /UseEnv
echo.
echo =================================
echo Building PPJoyJoy application
echo =================================
echo.
cd /D "%PPJOYDIR%\PPJoyJoy"
"%VSROOT%\devenv" PPJoyJoy.sln /rebuild "Debug|Win32" /UseEnv
"%VSROOT%\devenv" PPJoyJoy.sln /rebuild "Release|Win32" /UseEnv
echo.
echo =================================
echo Building PPJoyKey application
echo =================================
echo.
cd /D "%PPJOYDIR%\PPJoyKey"
"%VSROOT%\devenv" PPJoyKey.sln /rebuild "Debug|Win32" /UseEnv
"%VSROOT%\devenv" PPJoyKey.sln /rebuild "Release|Win32" /UseEnv
echo.
echo =================================
echo Building PPJoyMouse application
echo =================================
echo.
cd /D "%PPJOYDIR%\PPJoyMouse"
"%VSROOT%\devenv" PPJoyMouse.sln /rebuild "Debug|Win32" /UseEnv
"%VSROOT%\devenv" PPJoyMouse.sln /rebuild "Release|Win32" /UseEnv
echo.
echo =====================================
echo Building input .DLLs for PPJoyDLL
echo =====================================
echo.
cd /D "%PPJOYDIR%\RCCallbackDLLs"
"%VSROOT%\devenv" RCCallbackDLLs.sln /rebuild "Debug Futaba_PCM|Win32" /UseEnv
"%VSROOT%\devenv" RCCallbackDLLs.sln /rebuild "Debug Futaba_PPM|Win32" /UseEnv
"%VSROOT%\devenv" RCCallbackDLLs.sln /rebuild "Debug JR_PCM|Win32" /UseEnv
"%VSROOT%\devenv" RCCallbackDLLs.sln /rebuild "Debug JR_PPM|Win32" /UseEnv
"%VSROOT%\devenv" RCCallbackDLLs.sln /rebuild "Release Futaba_PCM|Win32" /UseEnv
"%VSROOT%\devenv" RCCallbackDLLs.sln /rebuild "Release Futaba_PPM|Win32" /UseEnv
"%VSROOT%\devenv" RCCallbackDLLs.sln /rebuild "Release JR_PCM|Win32" /UseEnv
"%VSROOT%\devenv" RCCallbackDLLs.sln /rebuild "Release JR_PPM|Win32" /UseEnv
echo.
echo ===============================================
echo Copying compiled files to product directory
echo ===============================================
echo.
cd /D "%PPJOYDIR%"
call Scripts\CopyProducts.bat %PRODUCTDIR% %DEBUGPRODDIR%
REM use for test certificate in a PFX exported file. DO NOT EXPORT real certificate to a PFX file
call Scripts\SignDriverFiles.bat %DDKROOT% /f TestSign\TestCertificate.pfx %PRODUCTDIR% %DEBUGPRODDIR%
REM
REM For real certificates use:
REM call Scripts\SignDriverFiles.bat %DDKROOT% /s <CertStoreName> %PRODUCTDIR% %DEBUGPRODDIR%
REM
copy /y IOCTLSample\Release\IOCTLSample.exe %PRODUCTDIR%\__Support__
copy /y IOCTLSample\Release\IOCTLSample.exe %DEBUGPRODDIR%\__Support__
copy /y AddJoyDrivers\Release\AddJoyDrivers.dll %PRODUCTDIR%\__Support__
copy /y AddJoyDrivers\Debug\AddJoyDrivers.dll %DEBUGPRODDIR%\__Support__
copy /y ViseHelper\Release\ViseHelper.dll %PRODUCTDIR%\__Support__
copy /y ViseHelper\Debug\ViseHelper.dll %DEBUGPRODDIR%\__Support__
copy /y SetupHelper\Release\SetupHelper.dll %PRODUCTDIR%\__Support__
copy /y SetupHelper\Debug\SetupHelper.dll %DEBUGPRODDIR%\__Support__
copy /y Helper64\x64\Release\Helper64.exe %PRODUCTDIR%\__Support__
copy /y Helper64\x64\Debug\Helper64.exe %DEBUGPRODDIR%\__Support__
copy /y UnInst64\x64\Release\UnInst64.exe %PRODUCTDIR%\__Support__
copy /y UnInst64\x64\Debug\UnInst64.exe %DEBUGPRODDIR%\__Support__
copy /y PPJoyAPI\Release\PPJoyAPI.lib %PRODUCTDIR%\__Support__
copy /y PPJoyAPI\Debug\PPJoyAPI.lib %DEBUGPRODDIR%\__Support__
copy /y PPJoyAPI\PPJoyAPI.h %PRODUCTDIR%\__Support__
copy /y Tools\AddDriversTest\AddDriversTest.c %PRODUCTDIR%\__Support__
copy /y PPJoyCOM\Release\PPJoyCOM.exe %PRODUCTDIR%
copy /y PPJoyCOM\Debug\PPJoyCOM.exe %DEBUGPRODDIR%
copy /y PPJoyDLL\Release\PPJoyDLL.exe %PRODUCTDIR%
copy /y PPJoyDLL\Debug\PPJoyDLL.exe %DEBUGPRODDIR%
copy /y PPJoyJoy\Release\PPJoyJoy.exe %PRODUCTDIR%
copy /y PPJoyJoy\Debug\PPJoyJoy.exe %DEBUGPRODDIR%
copy /y PPJoyKey\Release\PPJoyKey.exe %PRODUCTDIR%
copy /y PPJoyKey\Debug\PPJoyKey.exe %DEBUGPRODDIR%
copy /y PPJoyMouse\Release\PPJoyMouse.exe %PRODUCTDIR%
copy /y PPJoyMouse\Debug\PPJoyMouse.exe %DEBUGPRODDIR%
copy /y RCCallbackDLLs\Release\*.dll %PRODUCTDIR%
copy /y RCCallbackDLLs\Debug\*.dll %DEBUGPRODDIR%
zip -9 -X -j %PPJOYDIR%\Docs\Diagrams\Virtual\IOCTLSample.zip %PPJOYDIR%\IOCTLSample\*
zip -9 -X -j %PPJOYDIR%\Docs\Diagrams\Virtual\RCCallbackDLLs.zip %PPJOYDIR%\RCCallbackDLLs\*
xcopy /s /i docs %PRODUCTDIR%\docs
echo.
echo ======================================================
echo Building PPJoyInstaller
echo ======================================================
echo.
"C:\Program Files (x86)\NSIS\makensis.exe" Installer\PPJoyInstaller.nsi
echo.
echo ======================================================
echo Build Done, Digitally signing final executable
echo ======================================================
echo.
REM use for test certificate in a PFX exported file. DO NOT EXPORT real certificate to a PFX file
call Scripts\SignDriverFiles.bat %DDKROOT% /f TestSign\TestCertificate.pfx %PRODUCTDIR% %DEBUGPRODDIR% PPJoySetup*.exe
REM
REM For real certificates use:
REM call Scripts\SignDriverFiles.bat %DDKROOT% /s <CertStoreName> %PRODUCTDIR% %DEBUGPRODDIR% PPJoySetup*.exe
REM
If NOT Exist "%PRODUCTDIR%\..\PPJoySetup*.exe" Goto ERROR
cd /D "%PPJOYDIR%"
cd "%PRODUCTDIR%\.."
SET "BINDIR=%CD%"
cd /D "%PPJOYDIR%"
@echo.
echo Final built executable is at:
FOR %%G IN (%BINDIR%\PPJoySetup*.exe) DO echo %%G
cd %PPJOYDIR%
echo.
echo Process complete!
Goto END
:ERROR
@echo.
echo Process failed!!!
Goto END
:END
@echo.
ENDLOCAL
POPD