[interp] fix op_explicit for cast from nfloat to nint and vice versa (#14201)
[mono-project.git] / msvc / winsetup.bat
blob28f1bbd2f1f33717ab809171723bc04a713a5b4a
1 @echo off
2 setlocal
4 set BUILD_RESULT=1
6 :: Make sure we can restore current working directory after setting up environment.
7 :: Some of the VS scripts can change the current working directory.
8 set CALLER_WD=%CD%
10 :: Visual Studio 2015 == 14.0
11 if "%VisualStudioVersion%" == "14.0" (
12     goto SETUP_VS_2015
15 :: Visual Studio 2017 == 15.0
16 if "%VisualStudioVersion%" == "15.0" (
17     goto SETUP_VS_2017
20 :SETUP_VS_2015
22 :SETUP_VS_2015_BUILD_TOOLS
24 :: Try to locate VS2015 build tools installation.
25 set VS_2015_BUILD_TOOLS_CMD=%ProgramFiles(x86)%\Microsoft Visual C++ Build Tools\vcbuildtools_msbuild.bat
27 :: Setup VS2015 VC development environment using build tools installation.
28 call :setup_build_env "%VS_2015_BUILD_TOOLS_CMD%" "%CALLER_WD%" && (
29     goto ON_BUILD
32 :SETUP_VS_2015_VC
34 :: Try to locate installed VS2015 VC environment.
35 set VS_2015_DEV_CMD=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\Tools\VsMSBuildCmd.bat
37 :: Setup VS2015 VC development environment using VS installation.
38 call :setup_build_env "%VS_2015_DEV_CMD%" "%CALLER_WD%" && (
39     goto ON_BUILD
42 :SETUP_VS_2017
44 :SETUP_VS_2017_BUILD_TOOLS
46 :: Try to locate VS2017 build tools installation.
47 set VS_2017_BUILD_TOOLS_CMD=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsMSBuildCmd.bat
49 :: Setup VS2017 VC development environment using build tools installation.
50 call :setup_build_env "%VS_2017_BUILD_TOOLS_CMD%" "%CALLER_WD%" && (
51     goto ON_BUILD
54 :SETUP_VS_2017_VC
56 :: VS2017 includes vswhere.exe that can be used to locate current VS2017 installation.
57 set VSWHERE_TOOLS_BIN=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
58 set VS_2017_DEV_CMD=
60 :: Try to locate installed VS2017 VC environment.
61 if exist "%VSWHERE_TOOLS_BIN%" (
62     for /f "tokens=*" %%a in ('"%VSWHERE_TOOLS_BIN%" -latest -property installationPath') do (
63         set VS_2017_DEV_CMD=%%a\Common7\Tools\VsMSBuildCmd.bat
64     )
67 :: Setup VS2017 VC development environment using VS installation.
68 call :setup_build_env "%VS_2017_DEV_CMD%" "%CALLER_WD%" && (
69     goto ON_BUILD
72 :ON_ENV_ERROR
74 echo Warning, failed to setup build environment needed by msbuild.exe.
75 echo Incomplete build environment can cause build error's due to missing compiler, linker and platform libraries.
77 :ON_BUILD
79 call "msbuild.exe" /t:RunWinConfigSetup mono.winconfig.targets && (
80     set BUILD_RESULT=0
81 ) || (
82     set BUILD_RESULT=1
83     if not %ERRORLEVEL% == 0 (
84         set BUILD_RESULT=%ERRORLEVEL%
85     )
88 exit /b %BUILD_RESULT%
90 :setup_build_env
92 :: Check if VS build environment script exists.
93 if not exist "%~1" (
94     goto setup_build_env_error
97 :: Run VS build environment script.
98 call "%~1" > NUL
100 :: Restore callers working directory in case it has been changed by VS scripts.
101 cd /d "%~2"
103 goto setup_build_env_exit
105 :setup_build_env_error
106 exit /b 1
108 :setup_build_env_exit
109 goto :EOF
111 @echo on