-
Notifications
You must be signed in to change notification settings - Fork 3
/
msvc_install.bat
49 lines (42 loc) · 1.7 KB
/
msvc_install.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
@echo off
if "%VSCMD_ARG_HOST_ARCH%"=="x64" goto pass_ver
echo Execute in the x64 Native tools command prompt.
echo "msvc_install.bat <DIR>"
echo DIR is optional and points to the install dir, defaults defined in GnuInstallDirs where the find_package should find it.
echo Warning: if a DIR is a relative directory, it refers to msvc_build folder.
goto exit
:pass_ver
SET ONOFF=OFF
if "%1"=="-all" set ONOFF=ON
if "%2"=="-all" set ONOFF=ON
set PREFIX=
if "%1"=="" goto no_pre1
if NOT "%1"=="-all" set PREFIX=-DCMAKE_INSTALL_PREFIX=%1
:no_pre1
if "%2"=="" goto no_pre2
if NOT "%2"=="-all" set PREFIX=-DCMAKE_INSTALL_PREFIX=%2
:no_pre2
echo Build all is %ONOFF%
if not exist "msvc_build" mkdir msvc_build
pushd msvc_build
if exist "install.log" del install.log
cmake .. -DCMAKE_BUILD_TYPE=Debug -DHAS_AFFILIATES=%ONOFF% -DHAS_TEST=%ONOFF% -DHAS_EXAMPLES=%ONOFF% %PREFIX%
if %ERRORLEVEL% NEQ 0 popd && exit /b %ERRORLEVEL%
cmake --build . --config Debug
if %ERRORLEVEL% NEQ 0 popd && exit /b %ERRORLEVEL%
set BUILD_PATH=%CD%
popd
echo Start an elevated prompt for an install.
powershell -Command "Start-Process scripts\win_inst.bat -Verb RunAs -ArgumentList "%BUILD_PATH%,Debug"
pushd msvc_build
cmake .. -DCMAKE_BUILD_TYPE=Release -DHAS_AFFILIATES=%ONOFF% -DHAS_TEST=%ONOFF% -DHAS_EXAMPLES=%ONOFF% %PREFIX%
cmake --build . --config Release
set BUILD_PATH=%CD%
popd
echo Start an elevated prompt for an install.
start /wait powershell.exe -Command "Start-Process scripts\win_inst.bat -Verb RunAs -ArgumentList %BUILD_PATH%"
echo "Run install test"
call test\install_test\msvc_test.bat
if %ERRORLEVEL% NEQ 0 echo "An error (%ERRORLEVEL%) was found for test\install_test\msvc_test.bat" && exit /b %ERRORLEVEL%
echo done
:exit