-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_v142_x64.cmd
44 lines (36 loc) · 1.3 KB
/
build_v142_x64.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
@echo off
setlocal
:: Check input arguments.
if not "%1" == "Debug" if not "%1" == "Release" (
echo Usage:
echo %~nx0 ^<Debug^|Release^>
goto eof
)
:: Options.
set BUILD_TYPE=%1
:: Remove build directory.
if exist "build/%BUILD_TYPE%" rmdir /s /q "build/%BUILD_TYPE%"
:: Set MSBuild environment variables.
set VSWHERE="%ProgramFiles(x86)%/Microsoft Visual Studio/Installer/vswhere.exe"
set VSWHEREOPT=-version ^^^[16.0^^^,17.0^^^) -requires Microsoft.Component.MSBuild -property installationPath
for /f "usebackq tokens=*" %%i in (`%VSWHERE% %VSWHEREOPT%`) do (
if exist "%%i" set VS2019INSTALLDIR=%%i
)
:: Setup developer command prompt for Visual Studio.
call "%VS2019INSTALLDIR%/Common7/Tools/VsDevCmd.bat" -arch=x64
:: Build.
cmake -S "." -B "build/%BUILD_TYPE%" -G "Visual Studio 16 2019" -A x64 -T host=x64 ^
-DCMAKE_CONFIGURATION_TYPES:STRING="Debug;Release" ^
-DCMAKE_BUILD_TYPE:STRING=%BUILD_TYPE% ^
-DBUILD_SHARED_LIBS:BOOL=ON ^
-DBUILD_TESTS:BOOL=OFF ^
-DCMAKE_INSTALL_PREFIX:PATH="%cd%/build/%BUILD_TYPE%/install"
cmake --build "build/%BUILD_TYPE%" --config %BUILD_TYPE% --parallel 4
cmake --install "build/%BUILD_TYPE%" --config %BUILD_TYPE% --strip
:: Pack.
cd "build/%BUILD_TYPE%"
"%ProgramFiles%/CMake/bin/cpack.exe" -G ZIP -C %BUILD_TYPE%
:eof
endlocal
pause
exit /b %ERRORLEVEL%