nice changes unified a bunch of things, although of course windows
[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="$(dos_to_unix_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" | tr A-Z a-z | 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   local filena
62   for filena in "$DevEnvDir" "$VCINSTALLDIR/BIN" "$VSxTOOLS" "$VSxTOOLS/bin" "$FrameworkDir/$FrameworkVersion" "$FrameworkDir/v3.5" "$VCINSTALLDIR/VCPackages" "$VSINSTALLDIR/Common7/Tools" "$PLATFORM_DIR/bin"; do 
63     export PATH="$PATH:$(dos_to_unix_path $filena)"
64   done
65   #echo "path after is $PATH"
66   
67   export INCLUDE="$VCINSTALLDIR/ATLMFC/INCLUDE:$VCINSTALLDIR/INCLUDE:$PLATFORM_DIR/include"
68   #:$FrameworkSDKDir/include"
69   
70   export LIB="$VCINSTALLDIR/ATLMFC/LIB:$VCINSTALLDIR/LIB:$PLATFORM_DIR/lib"
71   #:$FrameworkSDKDir/lib"
72   
73   # convert framework dir back or things yell like hell.
74   export FrameworkDir=$(unix_to_dos_path $FrameworkDir)
75     # the redirection of stderr to null is to get around an obnoxious cygwin
76     # warning that seems to be erroneously complaining about backslashes.
77   
78   # convert all other relevant paths back to dos form, or visual studio barfs.
79   #export BUILD_SCRIPTS_DIR=$(unix_to_dos_path $BUILD_SCRIPTS_DIR)
80   #export BUILDING_HIERARCHY=$(unix_to_dos_path $BUILDING_HIERARCHY)
81   #export BUILDER_DIR=$(unix_to_dos_path $BUILDER_DIR)
82   #export BUILD_TOP=$(unix_to_dos_path $BUILD_TOP)
83   #export PRODUCTION_DIR=$(unix_to_dos_path $PRODUCTION_DIR)
84   #export LOGS_DIR=$(unix_to_dos_path $LOGS_DIR)
85   #export TOOL_SOURCES=$(unix_to_dos_path $TOOL_SOURCES)
86   #export BINARY_DIR=$(unix_to_dos_path $BINARY_DIR)
87   #export TARGETS_DIR=$(unix_to_dos_path $TARGETS_DIR)
88   #export INTERMEDIATE_EXE_DIR=$(unix_to_dos_path $INTERMEDIATE_EXE_DIR)
89   #export WASTE_DIR=$(unix_to_dos_path $WASTE_DIR)
90   
91   ##############
92   
93   #echo "common tools dir is \"$VSxTOOLS\""
94   #echo cleaned windir is $WINDIR
95   #echo cleaned comn tools is $VSxTOOLS 
96   #echo root of visual studio is $VSINSTALLDIR
97   #echo platform dir is $PLATFORM_DIR
98   #echo framedir now $FrameworkDir
99   
100   ##############
101 }
102
103 # run the above, very nasty, function.
104 setup_visual_studio_variables
105
106