blob: a7e9ba44e9bd3719f320ac6a9ea75333e614125a (
plain)
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
50
51
52
53
54
55
56
57
|
#!/bin/bash
# Wrapper that can be used as MONO_EXECUTABLE_WRAPPER in mono-wrapper when running MSVC build
# mono-sgen.exe. Simplify the setup of VS and MSVC toolchain, primarly when running MSVC build
# mono-sgen.exe as AOT compiler, since it needs to locate libraries as well as ClangC2 and linker
# from VS MSVC for corresponding architecture.
# NOTE, MSVC build mono-sgen.exe AOT compiler currently support 64-bit AMD codegen. mono-sgen-msvc.bat will ony setup
# amd64 versions of VS MSVC build environment and corresponding ClangC2 compiler.
# Optimization, only run full build environment when running mono-sgen.exe as AOT compiler.
# If not, just run mono-sgen.exe with supplied arguments.
function win32_format_path {
local formatted_path=$1
local host_win32_wsl=0
local host_win32_cygwin=0
host_uname="$(uname -a)"
case "$host_uname" in
*Microsoft*)
host_win32_wsl=1
;;
CYGWIN*)
host_win32_cygwin=1
;;
esac
if [[ $host_win32_wsl = 1 ]] && [[ $1 == "/mnt/"* ]]; then
formatted_path="$(wslpath -a -w "$1")"
elif [[ $host_win32_cygwin = 1 ]] && [[ $1 == "/cygdrive/"* ]]; then
formatted_path="$(cygpath -a -w "$1")"
fi
echo "$formatted_path"
}
MONO_SGEN_MSVC_SCRIPT_PATH=$(cd "$(dirname "$0")"; pwd)
MONO_AS_AOT_COMPILER=0
if [[ "$@" =~ .*--aot[^-a-zA-Z0-9].*|.*--aot$ ]]; then
MONO_AS_AOT_COMPILER=1
fi
if [[ $MONO_AS_AOT_COMPILER = 0 ]]; then
"$MONO_SGEN_MSVC_SCRIPT_PATH/mono-sgen.exe" "$@"
else
MONO_SGEN_MSVC_SCRIPT_PATH=$(win32_format_path "$MONO_SGEN_MSVC_SCRIPT_PATH/mono-sgen-msvc.bat")
WINDOWS_CMD=$(which cmd.exe)
if [ ! -f $WINDOWS_CMD ]; then
WINDOWS_CMD=$WINDIR/System32/cmd.exe
fi
export MONO_AS_AOT_COMPILER
"$WINDOWS_CMD" /c "$MONO_SGEN_MSVC_SCRIPT_PATH" "$@"
fi
|