7dce596746f8f44983521f7ed9f0a939fc3575e2
[feisty_meow.git] / scripts / generator / vis_stu_vars.sh
1 #!/bin/bash
2
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.
8
9 function print_usage {
10   echo "The VS80COMNTOOLS, VS90COMNTOOLS and VS100COMNTOOLS variables are not set."
11   echo "This usually means that the Visual Studio compiler is not installed."
12   echo ""
13 }
14
15 if [ "$OPERATING_SYSTEM" == "WIN32" ]; then
16   export PATH=$PRODUCTION_DIR/win32_help:$PATH
17 fi
18
19 # we try to use the most recent compiler location, and work backwards as
20 # needed for the supported range (10 = vs 2010, 9 = vs 2008, 8 = vs 2005).
21 export VSxTOOLS="$VS100COMNTOOLS"
22 if [ -z "$VSxTOOLS" ]; then
23   export VSxTOOLS="$VS90COMNTOOLS"
24   if [ -z "$VSxTOOLS" ]; then
25     export VSxTOOLS="$VS80COMNTOOLS"
26   fi
27 fi
28
29 if [ -z "$VSxTOOLS" ]; then
30   print_usage
31   return 33
32 fi
33 #echo "common tools dir is \"$VSxTOOLS\""
34 export VSxTOOLS="$(short_path "$VSxTOOLS" | tr "A-Z" "a-z" | sed -e 's/\\/\//g' | sed -e 's/^\(.\):/\/\1/' )"
35 #echo cleaned comn tools is $VSxTOOLS 
36
37 export VIS_STU_ROOT="$(echo $VSxTOOLS | sed -e 's/^\(.*\)\/[^\/]*\/[^\/]*[\/]$/\1/' | sed -e 's/^\(.\):/\/\1/' )"
38 export VSINSTALLDIR="$VIS_STU_ROOT"
39 #echo root of visual studio is $VSINSTALLDIR
40
41 export WINDIR="$(short_path "$WINDIR" | sed -e 's/\\/\//g' | sed -e 's/^\(.\):/\/\1/' )"
42 #echo cleaned windir is $WINDIR
43
44 #echo "prior path is $PATH"
45
46 export VCINSTALLDIR="$VSINSTALLDIR/VC"
47 export VSCOMMONROOT="$VSINSTALLDIR/Common7"
48 export VS_TOOLS_DIR="$VSCOMMONROOT/tools"
49 export DevEnvDir="$VSCOMMONROOT/IDE"
50 export MSVCDir="$VCINSTALLDIR"
51 export FrameworkDir="$WINDIR/Microsoft.NET/Framework"
52 export FrameworkVersion=v4.0.30319
53 #old export FrameworkSDKDir="$VSINSTALLDIR/SDK/v2.0"
54
55 export PLATFORM_DIR="$VCINSTALLDIR/PlatformSDK"
56 if [ ! -d "$PLATFORM_DIR" ]; then
57   export PLATFORM_DIR="$(short_path "$PROGRAMFILES/Microsoft SDKs/Windows/v7.0A" | tr "A-Z" "a-z" | sed -e 's/^\(.*\)\/[^\/]*\/[^\/]*[\/]$/\1/' | sed -e 's/^\(.\):/\/\1/' )"
58 fi
59 export WindowsSdkDir="$PLATFORM_DIR"
60 #echo platform dir is $PLATFORM_DIR
61
62 #echo "path before is $PATH"
63 export PATH="$DevEnvDir:$VCINSTALLDIR/BIN:$VSxTOOLS:$VSxTOOLS/bin:$FrameworkDir/$FrameworkVersion:$FrameworkDir/v3.5:$VCINSTALLDIR/VCPackages:$VSINSTALLDIR/Common7/Tools:$PLATFORM_DIR/bin:$PATH"
64 #echo "path after is $PATH"
65
66 export INCLUDE="$VCINSTALLDIR/ATLMFC/INCLUDE:$VCINSTALLDIR/INCLUDE:$PLATFORM_DIR/include"
67 #:$FrameworkSDKDir/include"
68
69 export LIB="$VCINSTALLDIR/ATLMFC/LIB:$VCINSTALLDIR/LIB:$PLATFORM_DIR/lib"
70 #:$FrameworkSDKDir/lib"
71
72 # convert framework dir back or things yell like hell.
73 export FrameworkDir="$(echo $FrameworkDir | sed -e 's/^\/\(.\)[\\\/]\(.*\)$/\1:\\\2/' | tr "/" "\\" 2>/dev/null )"
74   # the redirection of stderr to null is to get around an obnoxious cygwin
75   # warning that seems to be erroneously bitching about backslashes.
76 #echo framedir now $FrameworkDir
77
78