3 # Set up build environment and build LLVM using MSVC and msbuild targets in mono.sln.
6 # -------------------------------------------------------
7 # $1 Visual Studio target, build|clean, default build
8 # $2 Host CPU architecture, x86_64|i686, default x86_64
9 # $3 Visual Studio configuration, debug|release, default release
10 # $4 Mono MSVC source folder.
11 # $5 LLVM build directory.
12 # $6 LLVM install directory.
13 # $7 Additional arguments passed to msbuild, needs to be quoted if multiple.
14 # -------------------------------------------------------
16 function win32_format_path
{
17 local formatted_path
=$1
18 local host_win32_wsl
=0
19 local host_win32_cygwin
=0
21 host_uname
="$(uname -a)"
31 if [[ $host_win32_wsl = 1 ]] && [[ $1 == "/mnt/"* ]]; then
32 formatted_path
="$(wslpath -a -w "$1")"
33 elif [[ $host_win32_cygwin = 1 ]] && [[ $1 == "/cygdrive/"* ]]; then
34 formatted_path
="$(cygpath -a -w "$1")"
37 echo "$formatted_path"
40 BUILD_LLVM_MSBUILD_SCRIPT_PATH
=$
(cd "$(dirname "$0")"; pwd)
42 BUILD_LLVM_MSBUILD_SCRIPT_PATH
=$
(win32_format_path
"$BUILD_LLVM_MSBUILD_SCRIPT_PATH/build_llvm_msbuild.bat")
43 MONO_MSVC_SOURCE_DIR
=$
(win32_format_path
"$4")
44 MONO_LLVM_BUILD_DIR
=$
(win32_format_path
"$5")
45 MONO_LLVM_INSTALL_DIR
=$
(win32_format_path
"$6")
47 WINDOWS_CMD
=$
(which cmd.exe
)
48 if [ ! -f $WINDOWS_CMD ]; then
49 WINDOWS_CMD
=$WINDIR/System32
/cmd.exe
52 "$WINDOWS_CMD" /c
"$BUILD_LLVM_MSBUILD_SCRIPT_PATH" "$1" "$2" "$3" "$MONO_MSVC_SOURCE_DIR" "$MONO_LLVM_BUILD_DIR" "$MONO_LLVM_INSTALL_DIR" "$7"