3 # this file attempts to provide all of the variables needed for compiling
4 # with the microsoft visual studio compiler (dot net version). it requires
5 # one environment variable (called VSxCOMNTOOLS) be set that points at the
6 # location of the common tools in the visual studio installation.
7 # The value of x can be 80, 90 or 100.
10 echo "The VS80COMNTOOLS, VS90COMNTOOLS and VS100COMNTOOLS variables are not set."
11 echo "This usually means that the Visual Studio compiler is not installed."
15 if [[ "$1" =~ .*help.* ]]; then
20 function setup_visual_studio_variables()
22 chmod 755 $PRODUCTION_DIR/win32_helper/*.exe
23 export PATH="$(dos_to_unix_path $PRODUCTION_DIR)/win32_helper:$PATH"
25 # we try to use the most recent compiler location, and work backwards as
26 # needed for the supported range (10 = vs 2010, 9 = vs 2008, 8 = vs 2005).
27 export VSxTOOLS="$VS100COMNTOOLS"
28 if [ -z "$VSxTOOLS" ]; then
29 export VSxTOOLS="$VS90COMNTOOLS"
30 if [ -z "$VSxTOOLS" ]; then
31 export VSxTOOLS="$VS80COMNTOOLS"
35 if [ -z "$VSxTOOLS" ]; then
38 export VSxTOOLS="$(short_path "$VSxTOOLS" | tr "A-Z" "a-z" | sed -e 's/\\/\//g' )"
39 #| sed -e 's/^\(.\):/\/\1/' )"
41 export VIS_STU_ROOT="$(echo $VSxTOOLS | sed -e 's/^\(.*\)\/[^\/]*\/[^\/]*[\/]$/\1/' )"
42 #| sed -e 's/^\(.\):/\/\1/' )"
43 export VSINSTALLDIR="$VIS_STU_ROOT"
45 export WINDIR="$(short_path "$WINDIR" | tr A-Z a-z | sed -e 's/\\/\//g' )"
46 #| sed -e 's/^\(.\):/\/\1/' )"
48 export VCINSTALLDIR="$VSINSTALLDIR/VC"
49 export VSCOMMONROOT="$VSINSTALLDIR/Common7"
50 export VS_TOOLS_DIR="$VSCOMMONROOT/tools"
51 export DevEnvDir="$VSCOMMONROOT/IDE"
52 export MSVCDir="$VCINSTALLDIR"
53 export FrameworkDir="$WINDIR/Microsoft.NET/Framework"
54 export FrameworkVersion=v4.0.30319
55 #old export FrameworkSDKDir="$VSINSTALLDIR/SDK/v2.0"
57 export PLATFORM_DIR="$VCINSTALLDIR/PlatformSDK"
58 if [ ! -d "$PLATFORM_DIR" ]; then
60 #on hold: export PLATFORM_DIR="$(short_path "$PROGRAMFILES/Microsoft SDKs/Windows/v7.0A" | tr "A-Z" "a-z" | sed -e 's/^\(.*\)\/[^\/]*\/[^\/]*[\/]$/\1/' )"
61 ##| sed -e 's/^\(.\):/\/\1/' )"
63 # guess at where we can find this damned directory in its short form.
64 #hmmm: this is needed until there's a replacement for short path, or we can build again.
65 export PLATFORM_DIR="c:/progra~2/micros~1/windows/v7.0a"
66 if [ ! -d "$PLATFORM_DIR" ]; then
67 PLATFORM_DIR="c:/progra~1/micros~1/windows/v7.0a"
68 if [ ! -d "$PLATFORM_DIR" ]; then
69 PLATFORM_DIR="c:/progra~1/micros~2/windows/v7.0a"
70 if [ ! -d "$PLATFORM_DIR" ]; then
71 PLATFORM_DIR="c:/progra~2/micros~2/windows/v7.0a"
76 if [ ! -d "$PLATFORM_DIR" ]; then
77 echo "*** Failure to calculate the platform directory based on several attempts using c:\\program files\\microsoft sdks\\windows\\v7.0a as the basic pattern"
82 export WindowsSdkDir="$PLATFORM_DIR"
84 #echo "path before is $PATH"
86 for filena in "$DevEnvDir" "$VCINSTALLDIR/BIN" "$VSxTOOLS" "$VSxTOOLS/bin" "$FrameworkDir/$FrameworkVersion" "$FrameworkDir/v3.5" "$VCINSTALLDIR/VCPackages" "$VSINSTALLDIR/Common7/Tools" "$PLATFORM_DIR/bin"; do
87 export PATH="$PATH:$(dos_to_unix_path $filena)"
89 #echo "path after is $PATH"
91 export INCLUDE="$VCINSTALLDIR/ATLMFC/INCLUDE:$VCINSTALLDIR/INCLUDE:$PLATFORM_DIR/include"
92 #:$FrameworkSDKDir/include"
94 export LIB="$VCINSTALLDIR/ATLMFC/LIB:$VCINSTALLDIR/LIB:$PLATFORM_DIR/lib"
95 #:$FrameworkSDKDir/lib"
97 # convert framework dir back or things yell like hell.
98 export FrameworkDir=$(unix_to_dos_path $FrameworkDir)
99 # the redirection of stderr to null is to get around an obnoxious cygwin
100 # warning that seems to be erroneously complaining about backslashes.
104 echo "calculated variables for dos/windoze builds:"
105 var VIS_STU_ROOT VSxTOOLS WINDIR VSxTOOLS VSINSTALLDIR PLATFORM_DIR FrameworkDir
110 # run the above, very nasty, function.
111 setup_visual_studio_variables