-
Notifications
You must be signed in to change notification settings - Fork 41
/
build_pvpgn.bat
519 lines (408 loc) · 16.9 KB
/
build_pvpgn.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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
@echo off
setlocal enabledelayedexpansion
TITLE PvPGN Magic Builder for Windows
color 1f
echo.
echo *:*:*:*:*:*:*:*:*- P v P G N M a g i c B u i l d e r -*:*:*:*:*:*:*:*:*:*:*
echo * *
echo * Copyright 2011-2022, HarpyWar ([email protected]) *
echo * https://pvpgn.pro *
echo * *
echo *:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*
@call module\config.inc.bat
:: disallow invalid characters in the path (otherwise cmake fails configuration)
for /f "delims=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789:\-_." %%a in ("%CURRENT_PATH%") do set invalid_path=true
if [%invalid_path%]==[true] (
echo.
call %i18n% 0_0
echo.
call %i18n% 0_1
echo.
call %i18n% 0_2 C:\pvpgn-magic-builder\
goto THEEND
)
:: PARAMETERS TO REBUILD
:: !order is important!
set PARAM_REBUILD=%1
set PARAM_VS=%2
set PARAM_INTERFACE=%3
set PARAM_DBTYPE=%4
set PARAM_LUA=%5
set PARAM_BUILDTYPE=%6
:: build type can be Debug or Release
if "%PARAM_BUILDTYPE%"=="Debug" (
@set PVPGN_RELEASE=debug\
echo.
echo Debug build type is selected
echo.
) else (
rem [default] RelWithDebInfohe binaries are optimized as if they were built as Release
rem but they also contain debug information and generate .pdb files like Debug does
if "%PARAM_BUILDTYPE%"=="" set PARAM_BUILDTYPE=RelWithDebInfo
:: directory with ready files
set PVPGN_RELEASE=release\
)
:: {PARAMETER}, if not empty, skip autoupdate
if not [%PARAM_REBUILD%]==[] goto :select_vs
:: ----------- SETUP ------------
echo.
echo ______________________________[ U P D A T E ]___________________________________
:: check for update
@call module\autoupdate\check_for_update.inc.bat %URL_UPDATE%
echo.
:: ----------- SETUP ------------
echo.
echo _______________________________[ S E T U P ]____________________________________
:select_vs
:: try to find a visual studio
@call module\select_generator.inc.bat
if [%VS_NOT_INSTALLED%]==[true] (
call %i18n% 1_0
echo Free install from https://visualstudio.microsoft.com/vs/community/
echo (dont forget to enable checkbox "Desktop environment with C++"^)
goto THEEND
)
echo.
echo --------------------------------------------------------------------------------
:: {PARAMETER}, if not empty, skip GIT update
if not [%PARAM_REBUILD%]==[] goto :choose_interface
call %i18n% 1_3 "source"
choice
if %errorlevel%==2 ( set CHOICE_GIT=n) else ( set CHOICE_GIT=y)
:: if not "n", set to "y"
if not [%CHOICE_GIT%]==[n] (
@call module\select_branch.inc.bat
call %i18n% 1_4 "!BRANCH!"
) else (
call %i18n% 1_5
)
echo.
echo --------------------------------------------------------------------------------
:choose_interface
:: {PARAMETER}, if not empty replace value and skip choice
if not [%PARAM_INTERFACE%]==[] set CHOICE_INTERFACE=%PARAM_INTERFACE%& goto :interface_chosen
call %i18n% 1_6
call %i18n% 1_7
call %i18n% 1_8
call %i18n% 1_7_1
call %i18n% 1_8_1
echo.
call %i18n% 1_9
choice /c:1234
set CHOICE_INTERFACE=%errorlevel%
set PARAM_INTERFACE=%CHOICE_INTERFACE%
:: gui or console has choosen
:interface_chosen
set ARCH=Win32
set WITH_GUI=false
if [%CHOICE_INTERFACE%]==[1] (
call %i18n% 1_10
set exe_postfix=Console
)
if [%CHOICE_INTERFACE%]==[2] (
call %i18n% 1_11
set WITH_GUI=true
)
if [%CHOICE_INTERFACE%]==[3] (
call %i18n% 1_10_1
set exe_postfix=Console
set ARCH=x64
)
if [%CHOICE_INTERFACE%]==[4] (
call %i18n% 1_11_1
set WITH_GUI=true
set ARCH=x64
)
:: update tools and libs versions for x64
if [%ARCH%]==[x64] (
set CMAKE_VERSION=%CMAKE_VERSION_64%
set URL_TOOL_CMAKE=%URL_TOOL_CMAKE_64%
set ZLIB_PATH=%ZLIB_PATH_64%
set LUA_PATH=%LUA_PATH_64%
set CURL_PATH=%CURL_PATH_64%
)
echo.
echo --------------------------------------------------------------------------------
:: {PARAMETER}, if not empty replace value and skip choice
if not [%PARAM_DBTYPE%]==[] set CHOICE_DBTYPE=%PARAM_DBTYPE%& goto :dbtype_chosen
:choose_dbtype
call %i18n% 1_12
call %i18n% 1_13
echo 2) MySQL
echo 3) PostgreSQL
echo 4) SQLite3
echo 5) ODBC
echo.
call %i18n% 1_9
choice /c:12345
set CHOICE_DBTYPE=%errorlevel%
set PARAM_DBTYPE=%CHOICE_DBTYPE%
:dbtype_chosen
:: if not any db selected, use plain
if not [%CHOICE_DBTYPE%]==[2] if not [%CHOICE_DBTYPE%]==[3] if not [%CHOICE_DBTYPE%]==[4] if not [%CHOICE_DBTYPE%]==[5] set CHOICE_DBTYPE=1
:: Plain
if [%CHOICE_DBTYPE%]==[1] (
call %i18n% 1_15
)
:: MySQL
if [%CHOICE_DBTYPE%]==[2] (
set _dbpath=module\include\mysql\
if [%ARCH%]==[x64] set _dbpath=!_dbpath!%ARCH%\
echo.
@call module\dbchoice.inc.bat MySQL !_dbpath! %ARCH%
:: path to directory with db headers and libs
set DB_PATH=!_dbpath!!DB_VERSION!\
:: lib filename without extension (.lib and .dll)
set DB_LIB=libmysql
:: cmake vars to add to command line
set CMAKE_VARS=-D MYSQL_INCLUDE_DIR=!DB_PATH! -D MYSQL_LIBRARY=!DB_PATH!!DB_LIB!.lib -D WITH_MYSQL=true -D WITH_ANSI=false
)
:: PostgreSQL
if [%CHOICE_DBTYPE%]==[3] (
set _dbpath=module\include\pgsql\
if [%ARCH%]==[x64] set _dbpath=!_dbpath!!ARCH!\
echo.
@call module\dbchoice.inc.bat PostgreSQL !_dbpath! !ARCH!
:: path to directory with db headers and libs
set DB_PATH=!_dbpath!!DB_VERSION!\
:: lib filename without extension (.lib and .dll)
set DB_LIB=libpq
:: cmake vars to add to command line
set CMAKE_VARS=-D PGSQL_INCLUDE_DIR=!DB_PATH! -D PGSQL_LIBRARY=!DB_PATH!!DB_LIB!.lib -D WITH_PGSQL=true
)
:: SQLite
if [%CHOICE_DBTYPE%]==[4] (
set _dbpath=module\include\sqlite\
if [%ARCH%]==[x64] set _dbpath=!_dbpath!!ARCH!\
echo.
@call module\dbchoice.inc.bat SQLite !_dbpath! !ARCH!
:: path to directory with db headers and libs
set DB_PATH=!_dbpath!!DB_VERSION!\
:: lib filename without extension (.lib and .dll)
set DB_LIB=sqlite3
:: cmake vars to add to command line
set CMAKE_VARS=-D SQLITE3_INCLUDE_DIR=!DB_PATH! -D SQLITE3_LIBRARY=!DB_PATH!!DB_LIB!.lib -D WITH_SQLITE3=true
)
:: ODBC
if [%CHOICE_DBTYPE%]==[5] (
set _dbpath=module\include\odbc\
if [%ARCH%]==[x64] set _dbpath=!_dbpath!!ARCH!\
echo.
@call module\dbchoice.inc.bat ODBC !_dbpath! !ARCH!
:: path to directory with db headers and libs
set DB_PATH=!_dbpath!!DB_VERSION!\
:: lib filename without extension (.lib, ODBC does not need a dll, because it already exists in the system32)
set DB_LIB=odbc32
:: cmake vars to add to command line
set CMAKE_VARS=-D ODBC_INCLUDE_DIR=!DB_PATH! -D ODBC_LIBRARY=!DB_PATH!!DB_LIB!.lib -D WITH_ODBC=true
)
echo.
echo --------------------------------------------------------------------------------
:: {PARAMETER}, if not empty replace value and skip choice
if not [%PARAM_LUA%]==[] set CHOICE_LUA=%PARAM_LUA%& goto :lua_chosen
call %i18n% 4_1
choice
if %errorlevel%==2 ( set CHOICE_LUA=n) else ( set CHOICE_LUA=y)
set PARAM_LUA=%CHOICE_LUA%
:: lua has choosen or not
:lua_chosen
if not [%CHOICE_LUA%]==[n] (
call %i18n% 4_2
set CMAKE_VARS=%CMAKE_VARS% -D LUA_INCLUDE_DIR=%LUA_PATH% -D LUA_LIBRARY=%LUA_PATH%lua5.1.lib -D WITH_LUA=true
) else (
call %i18n% 4_3
)
:: ZLIB
set CMAKE_VARS=%CMAKE_VARS% -D ZLIB_ROOT=%ZLIB_PATH% -D ZLIB_INCLUDE_DIR=%ZLIB_PATH% -D ZLIB_LIBRARY=%ZLIB_PATH%zdll.lib
:: CURL
set CMAKE_VARS=%CMAKE_VARS% -D CURL_INCLUDE_DIR=%CURL_PATH%
if [%ARCH%]==[x64] (
set CMAKE_VARS=%CMAKE_VARS% -D CURL_LIBRARY=%CURL_PATH%libcurl-x64.lib
) else (
set CMAKE_VARS=%CMAKE_VARS% -D CURL_LIBRARY=%CURL_PATH%libcurl.lib
)
echo.
echo _____________________[ P V P G N S O U R C E C O D E]_________________________
:: ----------- DOWNLOAD ------------
:: {PARAMETER}, if empty then download source code
if [%PARAM_REBUILD%]==[] (
if [%LOG%]==[true] set _zip_log=^>download.log
if not exist %PVPGN_SOURCE% mkdir %PVPGN_SOURCE%
if not [%CHOICE_GIT%]==[n] (
set PVPGN_ZIP=%PVPGN_PATH%!BRANCH!.zip
:: download source.zip
call %EXEC_TOOL% wget.exe -O source.zip --no-check-certificate !PVPGN_ZIP! %_zip_log%
:: extract files into current directory (pvpgn-server-master directory is in archive)
call %EXEC_TOOL% unzip.exe -o source.zip %_zip_log%
:: copy files from pvpgn-master to source
xcopy /E /R /K /Y pvpgn-server-!BRANCH! source\ %_zip_log%
:: remove pvpgn-master
rmdir /Q /S pvpgn-server-!BRANCH!\
:: remove downloaded zip
del /F /Q source.zip
)
)
:: replace custom source code files
@call :backup_conf
:: {PARAMETER}, if not empty | "auto" | "cmake_only" then skip CMake configuration
if not [%PARAM_REBUILD%]==[] if not [%PARAM_REBUILD%]==[auto] if not [%PARAM_REBUILD%]==[cmake_only] goto :build
:: ----------- MAKE ------------
echo.
echo ______________________[ C M A K E C O N F I G U R E ]__________________________
:: show visual studio paths to get more details
call %EXEC_TOOL% vswhere.exe
if [%LOG%]==[true] set _cmake_log= ^>cmake.log
if not exist "%PVPGN_BUILD%" mkdir "%PVPGN_BUILD%"
@call :clean_build_release
:: delete cmake cache
if exist "%PVPGN_BUILD%CMakeCache.txt" del %PVPGN_BUILD%CMakeCache.txt
:: set cmake compiler flags
if "%PARAM_BUILDTYPE%"=="Debug" (
set CMAKE_FLAGS=-D CMAKE_CXX_FLAGS_DEBUG="/MTd"
) else (
set CMAKE_FLAGS=-D CMAKE_CXX_FLAGS_RELEASE="/MT /Od"
)
set CMAKE_VARS=%CMAKE_VARS% %CMAKE_FLAGS%
:: configure and generate solution
set cmake_exec=cmake.exe -Wno-dev -G "%GENERATOR%" -A "%ARCH%" %CMAKE_VARS% -D CMAKE_CONFIGURATION_TYPES="Debug;Release;RelWithDebInfo" -D CMAKE_SUPPRESS_REGENERATION=true -D WITH_WIN32_GUI=%WITH_GUI% -H%PVPGN_SOURCE% -B%PVPGN_BUILD% %_cmake_log%
:: print command
echo %cmake_exec%
:: execute command
call %EXEC_TOOL% %cmake_exec%
:: Stop after cmake and setting env vars (feature for appveyor)
:: Example: build_pvpgn.bat cmake_only 6 2 1 y
if [%PARAM_REBUILD%]==[cmake_only] exit
:: ----------- BUILD ------------
echo.
echo ______________[ B U I L D W I T H V I S U A L S T U D I O ]__________________
:build
if [%LOG%]==[true] set _vs_log=^>visualstudio.log
:: check solution for exists
IF NOT EXIST "%PVPGN_BUILD%pvpgn.sln" echo. & call %i18n% 1_16 & goto THEEND
set vars_arch=32
if [%ARCH%]==[x64] set vars_arch=64
:: load visual studio variables (new and old vs has different batch files with vars)
if not ["%VSVER%"]==["v100"] if not ["%VSVER%"]==["v110"] if not ["%VSVER%"]==["v120"] if not ["%VSVER%"]==["v140"] (
@call "%VSCOMNTOOLS%vcvars%vars_arch%.bat"
) else (
@call "%VSCOMNTOOLS%vsvars%vars_arch%.bat"
)
:: atlmfc include dir for VC Express version
set INCLUDE=%ATLMFC_INCLUDE_PATH%;%INCLUDE%
set msbuild_exec=MSBuild.exe "%PVPGN_BUILD%pvpgn.sln" /t:Rebuild /p:Configuration=%PARAM_BUILDTYPE% /p:Platform=%ARCH% /p:UseEnv=true /consoleloggerparameters:Summary;PerformanceSummary;Verbosity=minimal /maxcpucount %_vs_log%
:: print command
echo %msbuild_exec%
:: compile the solution
%msbuild_exec%
:: ----------- RELEASE ------------
echo.
echo ______________________________[ R E L E A S E ]_________________________________
:: restore unix configs (only after build! because it uses source directory while compile)
:: restore custom source files
@call :restore_conf
:: check pvpgn exe for exists
if not exist "%PVPGN_BUILD%src\bnetd\%PARAM_BUILDTYPE%\bnetd.exe" goto :FAIL
@call :save_rebuild_config
if not exist "%PVPGN_RELEASE%" mkdir "%PVPGN_RELEASE%"
:: copy conf directory
if not exist "%PVPGN_RELEASE%conf" mkdir "%PVPGN_RELEASE%conf"
@copy /Y "%PVPGN_BUILD%conf\*.conf" "%PVPGN_RELEASE%conf"
@copy /Y "%PVPGN_BUILD%conf\*.txt" "%PVPGN_RELEASE%conf"
@copy /Y "%PVPGN_BUILD%conf\*.json" "%PVPGN_RELEASE%conf"
@copy /Y "%PVPGN_BUILD%conf\bnetd_default_user.plain" "%PVPGN_RELEASE%conf"
@copy /Y "%PVPGN_SOURCE%conf\bnetd_default_user.cdb" "%PVPGN_RELEASE%conf"
:: replace main configs with win32 versions
@copy /Y "%PVPGN_SOURCE%conf\bnetd.conf.win32" "%PVPGN_RELEASE%conf\bnetd.conf"
@copy /Y "%PVPGN_SOURCE%conf\d2cs.conf.win32" "%PVPGN_RELEASE%conf\d2cs.conf"
@copy /Y "%PVPGN_SOURCE%conf\d2dbs.conf.win32" "%PVPGN_RELEASE%conf\d2dbs.conf"
:: copy libraries to release directory, without prompt
@copy /B /Y "%ZLIB_PATH%*.dll" "%PVPGN_RELEASE%"
@copy /B /Y "%CURL_PATH%*.dll" "%PVPGN_RELEASE%"
if not [%DB_LIB%]==[] @copy /B /Y "%DB_PATH%*.dll" "%PVPGN_RELEASE%"
if not [%CHOICE_LUA%]==[n] (
@copy /B /Y "%LUA_PATH%*.dll" "%PVPGN_RELEASE%"
@xcopy /E /R /K /Y "%PVPGN_SOURCE%lua" "%PVPGN_RELEASE%lua\"
)
:: copy release binaries
@copy /B /Y "%PVPGN_BUILD%src\bnetd\%PARAM_BUILDTYPE%\bnetd.exe" "%PVPGN_RELEASE%PvPGN%exe_postfix%.exe"
@copy /B /Y "%PVPGN_BUILD%src\bnetd\%PARAM_BUILDTYPE%\bnetd.pdb" "%PVPGN_RELEASE%PvPGN%exe_postfix%.pdb"
@copy /B /Y "%PVPGN_BUILD%src\d2cs\%PARAM_BUILDTYPE%\d2cs.exe" "%PVPGN_RELEASE%D2CS%exe_postfix%.exe"
@copy /B /Y "%PVPGN_BUILD%src\d2cs\%PARAM_BUILDTYPE%\d2cs.pdb" "%PVPGN_RELEASE%D2CS%exe_postfix%.pdb"
@copy /B /Y "%PVPGN_BUILD%src\d2dbs\%PARAM_BUILDTYPE%\d2dbs.exe" "%PVPGN_RELEASE%D2DBS%exe_postfix%.exe"
@copy /B /Y "%PVPGN_BUILD%src\d2dbs\%PARAM_BUILDTYPE%\d2dbs.pdb" "%PVPGN_RELEASE%D2DBS%exe_postfix%.pdb"
@copy /B /Y "%PVPGN_BUILD%src\bniutils\%PARAM_BUILDTYPE%\bni2tga.exe" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bniutils\%PARAM_BUILDTYPE%\bni2tga.pdb" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bniutils\%PARAM_BUILDTYPE%\bnibuild.exe" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bniutils\%PARAM_BUILDTYPE%\bnibuild.pdb" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bniutils\%PARAM_BUILDTYPE%\bniextract.exe" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bniutils\%PARAM_BUILDTYPE%\bniextract.pdb" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bniutils\%PARAM_BUILDTYPE%\bnilist.exe" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bniutils\%PARAM_BUILDTYPE%\bnilist.pdb" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bniutils\%PARAM_BUILDTYPE%\tgainfo.exe" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bniutils\%PARAM_BUILDTYPE%\tgainfo.pdb" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bnpass\%PARAM_BUILDTYPE%\bnpass.exe" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bnpass\%PARAM_BUILDTYPE%\bnpass.pdb" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bnpass\%PARAM_BUILDTYPE%\sha1hash.exe" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bnpass\%PARAM_BUILDTYPE%\sha1hash.pdb" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\client\%PARAM_BUILDTYPE%\bnbot.exe" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\client\%PARAM_BUILDTYPE%\bnbot.pdb" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\client\%PARAM_BUILDTYPE%\bnchat.exe" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\client\%PARAM_BUILDTYPE%\bnchat.pdb" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\client\%PARAM_BUILDTYPE%\bnftp.exe" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\client\%PARAM_BUILDTYPE%\bnftp.pdb" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\client\%PARAM_BUILDTYPE%\bnstat.exe" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\client\%PARAM_BUILDTYPE%\bnstat.pdb" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bntrackd\%PARAM_BUILDTYPE%\bntrackd.exe" "%PVPGN_RELEASE%"
@copy /B /Y "%PVPGN_BUILD%src\bntrackd\%PARAM_BUILDTYPE%\bntrackd.pdb" "%PVPGN_RELEASE%"
:: copy var directories (they're empty)
@xcopy "%PVPGN_BUILD%\files\var\*" "%PVPGN_RELEASE%\var\" /E
:: copy files directory
if not exist "%PVPGN_RELEASE%files" mkdir "%PVPGN_RELEASE%files"
@copy /Y "%PVPGN_SOURCE%files" "%PVPGN_RELEASE%files"
@del "%PVPGN_RELEASE%files\CMakeLists.txt"
:: copy i18n and lua files with subdirectories
@xcopy /E /R /K /Y "%PVPGN_SOURCE%conf\i18n" "%PVPGN_RELEASE%conf\i18n\"
@del "%PVPGN_RELEASE%lua\CMakeLists.txt"
@del "%PVPGN_RELEASE%conf\i18n\CMakeLists.txt"
:: replace "storage_path"
if ["%CHOICE_DB_CONF%"]==["y"] (
for /f "delims=" %%a in ('cscript "%TOOLS_PATH%replace_line.vbs" "%PVPGN_RELEASE%conf\bnetd.conf" "storage_path" "!CONF_storage_path!"') do set res=%%a
if ["!res!"]==["ok"] ( echo storage_path updated in bnetd.conf ) else ( echo Error: storage_path was not updated in bnetd.conf )
)
goto THEEND
:: erase build and release directories
:clean_build_release
@erase /S /Q "%PVPGN_RELEASE%*.*">nul
@erase /S /Q "%PVPGN_BUILD%*.*">nul
exit /b 0
:backup_conf
@call %TOOLS_PATH%recursive_copy.bat module\include\source_replace\ ..\..\..\source\ backup
exit /b 0
:restore_conf
@call %TOOLS_PATH%recursive_copy.bat module\include\source_replace\ ..\..\..\source\ restore
exit /b 0
:save_rebuild_config
set fileName=rebuild_pvpgn.bat
:: if DB_ENGINE is not empty
if not [%DB_ENGINE%]==[] set fileName=rebuild_pvpgn_with_%DB_ENGINE%.bat
:: save to file
echo @echo off>!fileName!
echo build_pvpgn.bat rebuild !PARAM_VS! !PARAM_INTERFACE! !PARAM_DBTYPE! !PARAM_LUA!>>!fileName!
rem *** the same for debug ***
set fileName=rebuild_pvpgn_debug.bat
:: if DB_ENGINE is not empty
if not [%DB_ENGINE%]==[] set fileName=rebuild_pvpgn_with_%DB_ENGINE%_debug.bat
:: save to file
echo @echo off>!fileName!
echo build_pvpgn.bat rebuild !PARAM_VS! !PARAM_INTERFACE! !PARAM_DBTYPE! !PARAM_LUA! Debug>>!fileName!
exit /b 0
:FAIL
echo SOMETHING GONE WRONG :-(
if not [%PARAM_REBUILD%]==[auto] pause
exit /b 1
goto :eof
:THEEND
echo.
echo ___________________________[ C O M P L E T E ]__________________________________
:: wait for any key
if not [%PARAM_REBUILD%]==[auto] pause