aboutsummaryrefslogtreecommitdiff
path: root/make-msvc.bat
diff options
context:
space:
mode:
authorLadislav Zezula <ladislav.zezula@avast.com>2021-12-18 08:15:55 +0100
committerLadislav Zezula <ladislav.zezula@avast.com>2021-12-18 08:15:55 +0100
commit103d908385af18e29b03f2110f1ead44bd1f15fe (patch)
tree075e84fb1898ac5490b5a456e07d0cd07b930fab /make-msvc.bat
parentd08272c37c1e85ac606d0d3c19e20d4c0cd3fa11 (diff)
Improved build file
Diffstat (limited to 'make-msvc.bat')
-rw-r--r--make-msvc.bat65
1 files changed, 35 insertions, 30 deletions
diff --git a/make-msvc.bat b/make-msvc.bat
index 099fc19..805f4a3 100644
--- a/make-msvc.bat
+++ b/make-msvc.bat
@@ -20,7 +20,11 @@ if exist "%PROGRAM_FILES_DIR%\Microsoft Visual Studio\2019\Community\VC\Auxiliar
if exist "%PROGRAM_FILES_DIR%\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat" set VCVARS_2019=%PROGRAM_FILES_DIR%\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat
if exist "%PROGRAM_FILES_DIR%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" set VCVARS_2019=%PROGRAM_FILES_DIR%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat
-::Build all libraries using Visual Studio 2008 and 2017
+:: Copy the public headers
+xcopy.exe /Y /D .\src\StormLib.h ..\aaa\inc >nul
+xcopy.exe /Y /D .\src\StormPort.h ..\aaa\inc >nul
+
+:: Build all libraries using Visual Studio 2008 and 2017
call :BuildLibs "%VCVARS_2008%" x86 %LIB_NAME%_vs08.sln \vs2008
call :BuildLibs "%VCVARS_2008%" x64 %LIB_NAME%_vs08.sln \vs2008
call :BuildLibs "%VCVARS_2019%" x86 %LIB_NAME%_vs19.sln
@@ -34,43 +38,26 @@ goto:eof
::
:: %1 Full path to the VCVARS.BAT file
:: %2 Target build platform (x86 or x64)
-:: %3 Plain name of the /sln solution file
+:: %3 Plain name of the .sln solution file ("StormLib_vs19.sln")
:: %4 Subdirectory for the target folder of the library ("\vs2008" or "")
::
:BuildLibs
+if not exist %1 goto:eof
call %1 %2
if "%2" == "x86" set SLN_TRG=Win32
-if "%2" == "x86" set LIB_TRG=lib32
+if "%2" == "x86" set LIB_TRG=lib32%4
if "%2" == "x64" set SLN_TRG=x64
-if "%2" == "x64" set LIB_TRG=lib64
-
-xcopy.exe /Y /D .\src\StormLib.h ..\aaa\inc
-xcopy.exe /Y /D .\src\StormPort.h ..\aaa\inc
-
-devenv.com %3 /project "%LIB_NAME%" /rebuild "DebugAD|%SLN_TRG%"
-xcopy.exe /Y /D .\bin\StormLib\%SLN_TRG%\DebugAD\*.lib ..\aaa\%LIB_TRG%%4
-
-devenv.com %3 /project "%LIB_NAME%" /rebuild "DebugAS|%SLN_TRG%"
-xcopy.exe /Y /D .\bin\StormLib\%SLN_TRG%\DebugAS\*.lib ..\aaa\%LIB_TRG%%4
-
-devenv.com %3 /project "%LIB_NAME%" /rebuild "DebugUD|%SLN_TRG%"
-xcopy.exe /Y /D .\bin\StormLib\%SLN_TRG%\DebugUD\*.lib ..\aaa\%LIB_TRG%%4
-
-devenv.com %3 /project "%LIB_NAME%" /rebuild "DebugUS|%SLN_TRG%"
-xcopy.exe /Y /D .\bin\StormLib\%SLN_TRG%\DebugUS\*.lib ..\aaa\%LIB_TRG%%4
-
-devenv.com %3 /project "%LIB_NAME%" /rebuild "ReleaseAD|%SLN_TRG%"
-xcopy.exe /Y /D .\bin\StormLib\%SLN_TRG%\ReleaseAD\*.lib ..\aaa\%LIB_TRG%%4
-
-devenv.com %3 /project "%LIB_NAME%" /rebuild "ReleaseAS|%SLN_TRG%"
-xcopy.exe /Y /D .\bin\StormLib\%SLN_TRG%\ReleaseAS\*.lib ..\aaa\%LIB_TRG%%4
-
-devenv.com %3 /project "%LIB_NAME%" /rebuild "ReleaseUD|%SLN_TRG%"
-xcopy.exe /Y /D .\bin\StormLib\%SLN_TRG%\ReleaseUD\*.lib ..\aaa\%LIB_TRG%%4
+if "%2" == "x64" set LIB_TRG=lib64%4
-devenv.com %3 /project "%LIB_NAME%" /rebuild "ReleaseUS|%SLN_TRG%"
-xcopy.exe /Y /D .\bin\StormLib\%SLN_TRG%\ReleaseUS\*.lib ..\aaa\%LIB_TRG%%4
+call :BuildAndCopyLib %3 %SLN_TRG% %LIB_TRG% DebugAD
+call :BuildAndCopyLib %3 %SLN_TRG% %LIB_TRG% DebugAS
+call :BuildAndCopyLib %3 %SLN_TRG% %LIB_TRG% DebugUD
+call :BuildAndCopyLib %3 %SLN_TRG% %LIB_TRG% DebugUS
+call :BuildAndCopyLib %3 %SLN_TRG% %LIB_TRG% ReleaseAD
+call :BuildAndCopyLib %3 %SLN_TRG% %LIB_TRG% ReleaseAS
+call :BuildAndCopyLib %3 %SLN_TRG% %LIB_TRG% ReleaseUD
+call :BuildAndCopyLib %3 %SLN_TRG% %LIB_TRG% ReleaseUS
:: Restore environment variables to the old level
set INCLUDE=%SAVE_INCLUDE%
@@ -80,3 +67,21 @@ set VSINSTALLDIR=
set VCINSTALLDIR=
set DevEnvDir=
goto:eof
+
+::-----------------------------------------------------------------------------
+:: Build and update a particular subvariant of the library
+::
+:: Parameters:
+::
+:: %1 Plain name of the .sln solution file ("StormLib_vs19.sln")
+:: %2 Target build platform ("Win32" or "x64")
+:: %3 Target directory for the library ("lib32", "lib32\vs2008", "lib64" or "lib64\vs2008")
+:: %4 Subvariant of the library ("DebugAD", "ReleaseUS", ...)
+::
+
+:BuildAndCopyLib
+if not exist %1 goto:eof
+devenv.com %1 /project "%LIB_NAME%" /rebuild "%4|%2"
+if not exist ..\aaa goto:eof
+xcopy.exe /Y /D .\bin\StormLib\%2\%4\*.lib ..\aaa\%3 >nul
+goto:eof