dropped old variable reporting code.
[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' )"
39 #| sed -e 's/^\(.\):/\/\1/' )"
40   
41   export VIS_STU_ROOT="$(echo $VSxTOOLS | sed -e 's/^\(.*\)\/[^\/]*\/[^\/]*[\/]$/\1/' )"
42 #| sed -e 's/^\(.\):/\/\1/' )"
43   export VSINSTALLDIR="$VIS_STU_ROOT"
44   
45   export WINDIR="$(short_path "$WINDIR" | tr A-Z a-z | sed -e 's/\\/\//g' )"
46 #| sed -e 's/^\(.\):/\/\1/' )"
47   
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"
56   
57   export PLATFORM_DIR="$VCINSTALLDIR/PlatformSDK"
58   if [ ! -d "$PLATFORM_DIR" ]; then
59
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/' )"
62
63 export PLATFORM_DIR="c:\progra~2\micros~1\windows\v7.0a"
64
65   fi
66   export WindowsSdkDir="$PLATFORM_DIR"
67   
68   #echo "path before is $PATH"
69   local filena
70   for filena in "$DevEnvDir" "$VCINSTALLDIR/BIN" "$VSxTOOLS" "$VSxTOOLS/bin" "$FrameworkDir/$FrameworkVersion" "$FrameworkDir/v3.5" "$VCINSTALLDIR/VCPackages" "$VSINSTALLDIR/Common7/Tools" "$PLATFORM_DIR/bin"; do 
71     export PATH="$PATH:$(dos_to_unix_path $filena)"
72   done
73   #echo "path after is $PATH"
74   
75   export INCLUDE="$VCINSTALLDIR/ATLMFC/INCLUDE:$VCINSTALLDIR/INCLUDE:$PLATFORM_DIR/include"
76   #:$FrameworkSDKDir/include"
77   
78   export LIB="$VCINSTALLDIR/ATLMFC/LIB:$VCINSTALLDIR/LIB:$PLATFORM_DIR/lib"
79   #:$FrameworkSDKDir/lib"
80   
81   # convert framework dir back or things yell like hell.
82   export FrameworkDir=$(unix_to_dos_path $FrameworkDir)
83     # the redirection of stderr to null is to get around an obnoxious cygwin
84     # warning that seems to be erroneously complaining about backslashes.
85   
86   # convert all other relevant paths back to dos form, or visual studio barfs.
87   #export BUILD_SCRIPTS_DIR=$(unix_to_dos_path $BUILD_SCRIPTS_DIR)
88   #export BUILDING_HIERARCHY=$(unix_to_dos_path $BUILDING_HIERARCHY)
89   #export BUILDER_DIR=$(unix_to_dos_path $BUILDER_DIR)
90   #export BUILD_TOP=$(unix_to_dos_path $BUILD_TOP)
91   #export PRODUCTION_DIR=$(unix_to_dos_path $PRODUCTION_DIR)
92   #export LOGS_DIR=$(unix_to_dos_path $LOGS_DIR)
93   #export TOOL_SOURCES=$(unix_to_dos_path $TOOL_SOURCES)
94   #export BINARY_DIR=$(unix_to_dos_path $BINARY_DIR)
95   #export TARGETS_DIR=$(unix_to_dos_path $TARGETS_DIR)
96   #export INTERMEDIATE_EXE_DIR=$(unix_to_dos_path $INTERMEDIATE_EXE_DIR)
97   #export WASTE_DIR=$(unix_to_dos_path $WASTE_DIR)
98   
99   ##############
100   
101   echo "calculated variables for dos/windoze builds:"
102   var VIS_STU_ROOT VSxTOOLS WINDIR VSxTOOLS VSINSTALLDIR PLATFORM_DIR FrameworkDir
103   
104   ##############
105 }
106
107 # run the above, very nasty, function.
108 setup_visual_studio_variables
109
110