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 # we try to use the most recent compiler location, and work backwards as
23 # needed for the supported range (10 = vs 2010, 9 = vs 2008, 8 = vs 2005).
24 export VSxTOOLS="$VS100COMNTOOLS"
25 if [ -z "$VSxTOOLS" ]; then
26 export VSxTOOLS="$VS90COMNTOOLS"
27 if [ -z "$VSxTOOLS" ]; then
28 export VSxTOOLS="$VS80COMNTOOLS"
32 if [ -z "$VSxTOOLS" ]; then
35 export VSxTOOLS="$(cygpath -w -s "$VSxTOOLS" | tr "A-Z" "a-z" | sed -e 's/\\/\//g' )"
36 #| sed -e 's/^\(.\):/\/\1/' )"
38 export VIS_STU_ROOT="$(echo $VSxTOOLS | sed -e 's/^\(.*\)\/[^\/]*\/[^\/]*[\/]$/\1/' )"
39 #| sed -e 's/^\(.\):/\/\1/' )"
40 export VSINSTALLDIR="$VIS_STU_ROOT"
42 export WINDIR="$(cygpath -w -s "$WINDIR" | tr A-Z a-z | sed -e 's/\\/\//g' )"
43 #| sed -e 's/^\(.\):/\/\1/' )"
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"
54 export PLATFORM_DIR="$VCINSTALLDIR/PlatformSDK"
55 if [ ! -d "$PLATFORM_DIR" ]; then
57 #on hold: export PLATFORM_DIR="$(cygpath -w -s "$PROGRAMFILES/Microsoft SDKs/Windows/v7.0A" | tr "A-Z" "a-z" | sed -e 's/^\(.*\)\/[^\/]*\/[^\/]*[\/]$/\1/' )"
58 ##| sed -e 's/^\(.\):/\/\1/' )"
60 # guess at where we can find this damned directory in its short form.
61 #hmmm: this is needed until there's a replacement for short path, or we can build again.
62 export PLATFORM_DIR="c:/progra~2/micros~1/windows/v7.0a"
63 if [ ! -d "$PLATFORM_DIR" ]; then
64 PLATFORM_DIR="c:/progra~1/micros~1/windows/v7.0a"
65 if [ ! -d "$PLATFORM_DIR" ]; then
66 PLATFORM_DIR="c:/progra~1/micros~2/windows/v7.0a"
67 if [ ! -d "$PLATFORM_DIR" ]; then
68 PLATFORM_DIR="c:/progra~2/micros~2/windows/v7.0a"
73 if [ ! -d "$PLATFORM_DIR" ]; then
74 echo "*** Failure to calculate the platform directory based on several attempts using c:\\program files\\microsoft sdks\\windows\\v7.0a as the basic pattern"
79 export WindowsSdkDir="$PLATFORM_DIR"
81 #echo "path before is $PATH"
83 for filena in "$DevEnvDir" "$VCINSTALLDIR/BIN" "$VSxTOOLS" "$VSxTOOLS/bin" "$FrameworkDir/$FrameworkVersion" "$FrameworkDir/v3.5" "$VCINSTALLDIR/VCPackages" "$VSINSTALLDIR/Common7/Tools" "$PLATFORM_DIR/bin"; do
84 export PATH="$PATH:$(dos_to_unix_path $filena)"
86 #echo "path after is $PATH"
88 export INCLUDE="$VCINSTALLDIR/ATLMFC/INCLUDE:$VCINSTALLDIR/INCLUDE:$PLATFORM_DIR/include"
89 #:$FrameworkSDKDir/include"
91 export LIB="$VCINSTALLDIR/ATLMFC/LIB:$VCINSTALLDIR/LIB:$PLATFORM_DIR/lib"
92 #:$FrameworkSDKDir/lib"
94 # convert framework dir back or things yell like hell.
95 export FrameworkDir=$(unix_to_dos_path $FrameworkDir)
96 # the redirection of stderr to null is to get around an obnoxious cygwin
97 # warning that seems to be erroneously complaining about backslashes.
101 echo "calculated variables for dos/windoze builds:"
102 var VIS_STU_ROOT VSxTOOLS WINDIR VSxTOOLS VSINSTALLDIR PLATFORM_DIR FrameworkDir
107 # run the above, very nasty, function.
108 setup_visual_studio_variables