diff options
author | Johan Lorensson <lateralusx.github@gmail.com> | 2018-10-29 01:18:28 +0300 |
---|---|---|
committer | Ludovic Henry <luhenry@microsoft.com> | 2018-10-29 01:18:28 +0300 |
commit | 1ec7ac543849ebf1e91aeb47890c91041d3fc27a (patch) | |
tree | bacdb43239df3d56ccc31a960d5eb89355a50d30 /msvc/run-msbuild.bat | |
parent | 668933de7f65767d17dcf684f78d2f17824575f9 (diff) |
Add option to integrate msvc build into regular make build. (#11343)
* Integrate msvc build into make build system.
Add support to perform msvc build as part of regular make build. By default
msvc build will not automatically be done and needs to be enabled using
--with-msvc argument passed to ./autogen.sh. Doing msvc build as part of
regular make will automatically set MONO_EXECUTABLE to build msvc build
Mono runtime used in BCL and Test build as well as runtime used when running
tests.
* Add support to install msvc build mono runtime.
* Disable --with-msvc argument for none Windows builds.
* Fix VS2015 Build Tools build environment.
* Updated with review feedback switching to --enable-msvc.
Diffstat (limited to 'msvc/run-msbuild.bat')
-rw-r--r-- | msvc/run-msbuild.bat | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/msvc/run-msbuild.bat b/msvc/run-msbuild.bat new file mode 100644 index 00000000000..b7edfee3e75 --- /dev/null +++ b/msvc/run-msbuild.bat @@ -0,0 +1,64 @@ +:: Set up build environment and run execute msbuild with all supplied arguments.
+@echo off
+setlocal
+
+set BUILD_RESULT=1
+
+set VS_2015_DEV_CMD=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\Tools\VsMSBuildCmd.bat
+set VS_2015_BUILD_TOOLS_CMD=%ProgramFiles(x86)%\Microsoft Visual C++ Build Tools\vcbuildtools_msbuild.bat
+set VSWHERE_TOOLS_BIN=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
+set VS_2017_DEV_CMD=
+set VS_2017_BUILD_TOOLS_CMD=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsMSBuildCmd.bat
+set VS_PLATFORM_TOOLSET=/p:PlatformToolset=v140
+
+:: Visual Studio 2015 == 14.0
+:: Visual Studio 2017 == 15.0
+if "%VisualStudioVersion%" == "15.0" (
+ goto SETUP_VS_2017
+)
+
+:SETUP_VS_2015
+
+if exist "%VS_2015_DEV_CMD%" (
+ echo Setting up VS2015 build environment.
+ call "%VS_2015_DEV_CMD%" && (
+ goto ON_BUILD
+ )
+)
+
+if exist "%VS_2015_BUILD_TOOLS_CMD%" (
+ echo Setting up VS2015 build environment.
+ call "%VS_2015_BUILD_TOOLS_CMD%" && (
+ goto ON_BUILD
+ )
+)
+
+:SETUP_VS_2017
+
+if exist "%VSWHERE_TOOLS_BIN%" (
+ for /f "tokens=*" %%a in ('"%VSWHERE_TOOLS_BIN%" -latest -property installationPath') do (
+ set VS_2017_DEV_CMD=%%a\Common7\Tools\VsMSBuildCmd.bat
+ )
+)
+
+if exist "%VS_2017_DEV_CMD%" (
+ echo Setting up VS2017 build environment.
+ call "%VS_2017_DEV_CMD%"
+ set VS_PLATFORM_TOOLSET=/p:PlatformToolset=v141
+)
+
+if exist "%VS_2017_BUILD_TOOLS_CMD%" (
+ echo Setting up VS2017 build environment.
+ call "%VS_2017_BUILD_TOOLS_CMD%"
+ set VS_PLATFORM_TOOLSET=/p:PlatformToolset=v141
+)
+
+:ON_BUILD
+
+call msbuild.exe %VS_PLATFORM_TOOLSET% %* "%~dp0mono.sln" && (
+ set BUILD_RESULT=0
+)
+
+exit /b %BUILD_RESULT%
+
+@echo on
|