1 :: Set up build environment and build LLVM using MSVC and msbuild targets in mono.sln.
4 :: -------------------------------------------------------
5 :: %1 Visual Studio target, build|clean, default build
6 :: %2 Host CPU architecture, x86_64|i686, default x86_64
7 :: %3 Visual Studio configuration, debug|release, default release
8 :: %4 Mono MSVC source folder.
9 :: %5 LLVM build directory.
10 :: %6 LLVM install directory.
11 :: %7 Additional arguments passed to msbuild, needs to be quoted if multiple.
12 :: -------------------------------------------------------
19 :: Get path for current running script.
20 set RUN_BUILD_LLVM_MSBUILD_SCRIPT_PATH=%~dp0
22 :: Configure all known build arguments.
25 if /i "%~1" == "clean" (
31 if /i "%~1" == "i686" (
32 set VS_PLATFORM="Win32"
34 if /i "%~1" == "win32" (
35 set VS_PLATFORM="Win32"
39 set VS_CONFIGURATION=Release
40 if /i "%~1" == "debug" (
41 set VS_CONFIGURATION="Debug"
45 set MONO_MSVC_SOURCE_DIR=%RUN_BUILD_LLVM_MSBUILD_SCRIPT_PATH%..\msvc\
47 set MONO_MSVC_SOURCE_DIR=%~1
51 set MONO_LLVM_BUILD_DIR=
53 set MONO_LLVM_BUILD_DIR=%~1
57 set MONO_LLVM_INSTALL_DIR=
59 set MONO_LLVM_INSTALL_DIR=%~1
63 set VS_ADDITIONAL_ARGUMENTS=
65 set VS_ADDITIONAL_ARGUMENTS=%~1
68 :: Setup Windows environment.
69 call %MONO_MSVC_SOURCE_DIR%setup-windows-env.bat
71 :: Setup VS msbuild environment.
72 call %MONO_MSVC_SOURCE_DIR%setup-vs-msbuild-env.bat
74 if "%VS_ADDITIONAL_ARGUMENTS%" == "" (
75 set "VS_ADDITIONAL_ARGUMENTS=/p:PlatformToolset=%VS_DEFAULT_PLATFORM_TOOL_SET% /p:MONO_TARGET_GC=sgen"
78 if not "%MONO_LLVM_BUILD_DIR%" == "" (
79 set VS_BUILD_ARGS=/p:_LLVMBuildDir="%MONO_LLVM_BUILD_DIR%"
82 if not "%MONO_LLVM_INSTALL_DIR%" == "" (
83 set VS_BUILD_ARGS=%VS_BUILD_ARGS% /p:_LLVMInstallDir="%MONO_LLVM_INSTALL_DIR%"
86 set VS_BUILD_ARGS=%VS_BUILD_ARGS% /p:MONO_ENABLE_LLVM=true /p:Configuration=%VS_CONFIGURATION% /p:Platform=%VS_PLATFORM% %VS_ADDITIONAL_ARGUMENTS% /t:%VS_TARGET% /m
87 call msbuild.exe %VS_BUILD_ARGS% "%MONO_MSVC_SOURCE_DIR%build-external-llvm.vcxproj" && (
91 if not %ERRORLEVEL% == 0 (
92 set BUILD_RESULT=%ERRORLEVEL%
96 exit /b %BUILD_RESULT%