diff options
-rwxr-xr-x | msvc-11 | 6 | ||||
-rwxr-xr-x | msvc-12 | 6 | ||||
-rwxr-xr-x | msvc-14 | 12 | ||||
-rwxr-xr-x | msvc-14u2 | 17 | ||||
-rwxr-xr-x | msvc-cl-common | 4 | ||||
-rwxr-xr-x | msvc-lib-common | 6 | ||||
-rwxr-xr-x | msvc-link-common | 6 | ||||
-rwxr-xr-x | msvc-rc-common | 119 | ||||
-rwxr-xr-x | rc-11 | 6 | ||||
-rwxr-xr-x | rc-12 | 6 | ||||
-rwxr-xr-x | rc-14 | 6 | ||||
-rwxr-xr-x | rc-14u2 | 6 |
12 files changed, 180 insertions, 20 deletions
@@ -1,11 +1,14 @@ #! /usr/bin/env bash -# MSVC 11 setup/configuration. Should set VC, INCLUDE, and LIB variables. +# MSVC 11 setup/configuration. +# +# Should set the SDKBIN, VCBIN, INCLUDE, and LIB variables. # # SDK # SDK="C:\\Program Files (x86)\\Windows Kits\\8.0" +SDKBIN="$SDK\\bin\\x86" INCLUDE="$SDK\\include\\shared;$SDK\\include\\um;$SDK\\include\\winrt" LIB="$SDK\\lib\\win8\\um\\x86" @@ -13,6 +16,7 @@ LIB="$SDK\\lib\\win8\\um\\x86" # VC # VC="C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC" +VCBIN="$VC\\bin" INCLUDE="$VC\\include;$INCLUDE" LIB="$VC\\lib;$LIB" @@ -1,11 +1,14 @@ #! /usr/bin/env bash -# MSVC 12 setup/configuration. Should set VC, INCLUDE, and LIB variables. +# MSVC 12 setup/configuration. +# +# Should set the SDKBIN, VCBIN, INCLUDE, and LIB variables. # # SDK # SDK="C:\\Program Files (x86)\\Windows Kits\\8.1" +SDKBIN="$SDK\\bin\\x86" INCLUDE="$SDK\\include\\shared;$SDK\\include\\um;$SDK\\include\\winrt" LIB="$SDK\\lib\\winv6.3\\um\\x86" @@ -13,6 +16,7 @@ LIB="$SDK\\lib\\winv6.3\\um\\x86" # VC # VC="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC" +VCBIN="$VC\\bin" INCLUDE="$VC\\include;$INCLUDE" LIB="$VC\\lib;$LIB" @@ -1,11 +1,14 @@ #! /usr/bin/env bash -# MSVC 14 setup/configuration. Should set VC, INCLUDE, and LIB variables. +# MSVC 14 setup/configuration. +# +# Should set the SDKBIN, VCBIN, INCLUDE, and LIB variables. # # SDK # SDK="C:\\Program Files (x86)\\Windows Kits\\8.1" +SDKBIN="$SDK\\bin\\x86" INCLUDE="$SDK\\include\\shared;$SDK\\include\\um;$SDK\\include\\winrt" LIB="$SDK\\lib\\winv6.3\\um\\x86" @@ -13,14 +16,15 @@ LIB="$SDK\\lib\\winv6.3\\um\\x86" # CRT # CRT="C:\\Program Files (x86)\\Windows Kits\\10" -VER="10.0.10150.0" +CRTVER="10.0.10150.0" -INCLUDE="$CRT\\include\\$VER\\ucrt;$INCLUDE" -LIB="$CRT\\lib\\$VER\\ucrt\\x86;$LIB" +INCLUDE="$CRT\\include\\$CRTVER\\ucrt;$INCLUDE" +LIB="$CRT\\lib\\$CRTVER\\ucrt\\x86;$LIB" # VC # VC="C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC" +VCBIN="$VC\\bin" INCLUDE="$VC\\include;$INCLUDE" LIB="$VC\\lib;$LIB" @@ -1,26 +1,31 @@ #! /usr/bin/env bash -# MSVC 14U2 setup/configuration. Should set VC, INCLUDE, and LIB variables. +# MSVC 14U2 setup/configuration. +# +# Should set the SDKBIN, VCBIN, INCLUDE, and LIB variables. # # SDK # SDK="C:\\Program Files (x86)\\Windows Kits\\10" -VER="10.0.10586.0" +SDKBIN="$SDK\\bin\\x86" +SDKVER="10.0.10586.0" -INCLUDE="$SDK\\include\\$VER\\shared;$SDK\\include\\$VER\\um;$SDK\\include\\$VER\\winrt" -LIB="$SDK\\lib\\$VER\\um\\x86" +INCLUDE="$SDK\\include\\$SDKVER\\shared;$SDK\\include\\$SDKVER\\um;$SDK\\include\\$SDKVER\\winrt" +LIB="$SDK\\lib\\$SDKVER\\um\\x86" # CRT # CRT="C:\\Program Files (x86)\\Windows Kits\\10" +CRTVER="10.0.10586.0" -INCLUDE="$CRT\\include\\$VER\\ucrt;$INCLUDE" -LIB="$CRT\\lib\\$VER\\ucrt\\x86;$LIB" +INCLUDE="$CRT\\include\\$CRTVER\\ucrt;$INCLUDE" +LIB="$CRT\\lib\\$CRTVER\\ucrt\\x86;$LIB" # VC # VC="C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC" +VCBIN="$VC\\bin" INCLUDE="$VC\\include;$INCLUDE" LIB="$VC\\lib;$LIB" diff --git a/msvc-cl-common b/msvc-cl-common index ce76fc8..7601d77 100755 --- a/msvc-cl-common +++ b/msvc-cl-common @@ -1,7 +1,7 @@ #! /usr/bin/env bash # Common cl.exe driver that expects the VC, INCLUDE, and LIB variables to -# be set for the specific MSVC version/configuration set. +# be set for the specific MSVC version/configuration. trap "{ exit 1; }" ERR set -o errtrace # Trap in functions. @@ -142,4 +142,4 @@ done export INCLUDE export LIB -msvc_exec $diag "$VC\\bin\\cl.exe" "${args[@]}" +msvc_exec $diag "$VCBIN\\cl.exe" "${args[@]}" diff --git a/msvc-lib-common b/msvc-lib-common index 5d11ba1..8b23f4f 100755 --- a/msvc-lib-common +++ b/msvc-lib-common @@ -3,7 +3,7 @@ # @@ Do we really need LIB? What's /LIBPATH for? # # Common lib.exe driver that expects the VC and LIB variables to be set for -# the specific MSVC version/configuration set. +# the specific MSVC version/configuration. trap "{ exit 1; }" ERR set -o errtrace # Trap in functions. @@ -90,6 +90,6 @@ done # export LIB -# Lib.exe always sends diagnostics to stdout. +# lib.exe always sends diagnostics to stdout. # -msvc_exec 1 "$VC\\bin\\lib.exe" "${args[@]}" +msvc_exec 1 "$VCBIN\\lib.exe" "${args[@]}" diff --git a/msvc-link-common b/msvc-link-common index 64c8a0c..bec14dc 100755 --- a/msvc-link-common +++ b/msvc-link-common @@ -1,7 +1,7 @@ #! /usr/bin/env bash # Common link.exe driver that expects the VC and LIB variables to be set for -# the specific MSVC version/configuration set. +# the specific MSVC version/configuration. trap "{ exit 1; }" ERR set -o errtrace # Trap in functions. @@ -75,6 +75,6 @@ done export LIB -# Link.exe always sends diagnostics to stdout. +# link.exe always sends diagnostics to stdout. # -msvc_exec 1 "$VC\\bin\\link.exe" "${args[@]}" +msvc_exec 1 "$VCBIN\\link.exe" "${args[@]}" diff --git a/msvc-rc-common b/msvc-rc-common new file mode 100755 index 0000000..7e55aec --- /dev/null +++ b/msvc-rc-common @@ -0,0 +1,119 @@ +#! /usr/bin/env bash + +# Common rc.exe driver that expects the VC and INCLUDE variables to be set for +# the specific MSVC version/configuration. + +trap "{ exit 1; }" ERR +set -o errtrace # Trap in functions. + +function info () { echo "$*" 1>&2; } +function error () { info "$*"; exit 1; } + +source $(dirname $(realpath ${BASH_SOURCE[0]}))/msvc-common + +# Translate absolute paths from POSIX to Windows. Use bash array to store +# arguments in case they contain spaces. +# +# This needs to be done for both certain option values and arguments. +# Arguments are tricky in that unless we recognize every option, and option +# may look a lot like an absolute POSIX path (e.g., /nologo). The heuristics +# that we are going to use here is that if the argument starts with / and +# contains at least one more /, then we consider it an argument. Otherwise -- +# an options. We will also explicitly recognize certain options which may not +# fit this scheme well. +# +# Note that the order of the cases is important. Specifically, we want, e.g., +# /D before /D*. +# +args=() + +while [ $# -gt 0 ]; do + case $1 in + + # /I <dir> + # + [/-][Ii]) + args=("${args[@]}" "$1") + shift + args=("${args[@]}" "$(translate $1)") + shift + ;; + + # /I<dir> + # + [/-][Ii]*) + args=("${args[@]}" "$(split_translate 2 $1)") + shift + ;; + + # /f[om] <file> + # + [/-][fF][oOmM]) + args=("${args[@]}" "$1") + shift + args=("${args[@]}" "$(translate $1)") + shift + ;; + + # /f[om]<file> + # + [/-][fF][oOmM]*) + args=("${args[@]}" "$(split_translate 3 $1)") + shift + ;; + + # /q <file> + # + [/-][qQ]) + args=("${args[@]}" "$1") + shift + args=("${args[@]}" "$(translate $1)") + shift + ;; + + # /q<file> + # + [/-][qQ]*) + args=("${args[@]}" "$(split_translate 2 $1)") + shift + ;; + + # Handle other options with separate values. This makes sure we don't try + # to path-translate them. + # + [/-][Dd] | \ + [/-][Uu]) + args=("${args[@]}" "$1") + shift + args=("${args[@]}" "$1") + shift + ;; + + # Handle other options with combined values that could possibly be + # interpreted as paths, for example /DFOO=foo/bar. + # + [/-][Dd]*) + args=("${args[@]}" "$1") + shift + ;; + + # Option or argument. + # + *) + # If contains at least two slashes, treat it as a path. + # + if [[ "$1" == /*/* ]]; then + args=("${args[@]}" "$(translate $1)") + else + args=("${args[@]}" "$1") + fi + shift + ;; + esac +done + +export INCLUDE + +# rc.exe always sends diagnostics to stdout. +# +msvc_exec 1 "$SDKBIN\\rc.exe" "${args[@]}" @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +src="$(dirname $(realpath ${BASH_SOURCE[0]}))" + +source "$src/msvc-11" +source "$src/msvc-rc-common" @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +src="$(dirname $(realpath ${BASH_SOURCE[0]}))" + +source "$src/msvc-12" +source "$src/msvc-rc-common" @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +src="$(dirname $(realpath ${BASH_SOURCE[0]}))" + +source "$src/msvc-14" +source "$src/msvc-rc-common" @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +src="$(dirname $(realpath ${BASH_SOURCE[0]}))" + +source "$src/msvc-14u2" +source "$src/msvc-rc-common" |