918b3de446d205605e3e559dfe41d58d0accabbd
[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 [[ "$1" =~ .*help.* ]]; then
16   print_usage
17   exit 0
18 fi
19
20 function setup_visual_studio_variables()
21 {
22   chmod 755 $PRODUCTION_DIR/win32_helper/*.exe
23   export PATH=$PRODUCTION_DIR/win32_helper:$PATH
24
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"
32     fi
33   fi
34   
35   if [ -z "$VSxTOOLS" ]; then
36     return 33
37   fi
38   export VSxTOOLS="$(short_path "$VSxTOOLS" | tr "A-Z" "a-z" | sed -e 's/\\/\//g' | sed -e 's/^\(.\):/\/\1/' )"
39   
40   export VIS_STU_ROOT="$(echo $VSxTOOLS | sed -e 's/^\(.*\)\/[^\/]*\/[^\/]*[\/]$/\1/' | sed -e 's/^\(.\):/\/\1/' )"
41   export VSINSTALLDIR="$VIS_STU_ROOT"
42   
43   export WINDIR="$(short_path "$WINDIR" | sed -e 's/\\/\//g' | sed -e 's/^\(.\):/\/\1/' )"
44   
45   export VCINSTALLDIR="$VSINSTALLDIR/VC"
46   export VSCOMMONROOT="$VSINSTALLDIR/Common7"
47   export VS_TOOLS_DIR="$VSCOMMONROOT/tools"
48   export DevEnvDir="$VSCOMMONROOT/IDE"
49   export MSVCDir="$VCINSTALLDIR"
50   export FrameworkDir="$WINDIR/Microsoft.NET/Framework"
51   export FrameworkVersion=v4.0.30319
52   #old export FrameworkSDKDir="$VSINSTALLDIR/SDK/v2.0"
53   
54   export PLATFORM_DIR="$VCINSTALLDIR/PlatformSDK"
55   if [ ! -d "$PLATFORM_DIR" ]; then
56     export PLATFORM_DIR="$(short_path "$PROGRAMFILES/Microsoft SDKs/Windows/v7.0A" | tr "A-Z" "a-z" | sed -e 's/^\(.*\)\/[^\/]*\/[^\/]*[\/]$/\1/' | sed -e 's/^\(.\):/\/\1/' )"
57   fi
58   export WindowsSdkDir="$PLATFORM_DIR"
59   
60   #echo "path before is $PATH"
61   export PATH="$DevEnvDir:$VCINSTALLDIR/BIN:$VSxTOOLS:$VSxTOOLS/bin:$FrameworkDir/$FrameworkVersion:$FrameworkDir/v3.5:$VCINSTALLDIR/VCPackages:$VSINSTALLDIR/Common7/Tools:$PLATFORM_DIR/bin:$PATH"
62   #echo "path after is $PATH"
63   
64   export INCLUDE="$VCINSTALLDIR/ATLMFC/INCLUDE:$VCINSTALLDIR/INCLUDE:$PLATFORM_DIR/include"
65   #:$FrameworkSDKDir/include"
66   
67   export LIB="$VCINSTALLDIR/ATLMFC/LIB:$VCINSTALLDIR/LIB:$PLATFORM_DIR/lib"
68   #:$FrameworkSDKDir/lib"
69   
70   # convert framework dir back or things yell like hell.
71   export FrameworkDir=$(unix_to_dos_path $FrameworkDir)
72     # the redirection of stderr to null is to get around an obnoxious cygwin
73     # warning that seems to be erroneously bitching about backslashes.
74   
75   # convert all other relevant paths back to dos form, or visual studio barfs.
76   #export BUILD_SCRIPTS_DIR=$(unix_to_dos_path $BUILD_SCRIPTS_DIR)
77   #export BUILDING_HIERARCHY=$(unix_to_dos_path $BUILDING_HIERARCHY)
78   #export BUILDER_DIR=$(unix_to_dos_path $BUILDER_DIR)
79   #export BUILD_TOP=$(unix_to_dos_path $BUILD_TOP)
80   #export PRODUCTION_DIR=$(unix_to_dos_path $PRODUCTION_DIR)
81   #export LOGS_DIR=$(unix_to_dos_path $LOGS_DIR)
82   #export TOOL_SOURCES=$(unix_to_dos_path $TOOL_SOURCES)
83   #export BINARY_DIR=$(unix_to_dos_path $BINARY_DIR)
84   #export TARGETS_DIR=$(unix_to_dos_path $TARGETS_DIR)
85   #export INTERMEDIATE_EXE_DIR=$(unix_to_dos_path $INTERMEDIATE_EXE_DIR)
86   #export WASTE_DIR=$(unix_to_dos_path $WASTE_DIR)
87   
88   ##############
89   
90   #echo "common tools dir is \"$VSxTOOLS\""
91   #echo cleaned windir is $WINDIR
92   #echo cleaned comn tools is $VSxTOOLS 
93   #echo root of visual studio is $VSINSTALLDIR
94   #echo platform dir is $PLATFORM_DIR
95   #echo framedir now $FrameworkDir
96   
97   ##############
98 }
99
100 # run the above, very nasty, function.
101 setup_visual_studio_variables
102
103