diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2016-11-29 03:23:59 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2016-11-29 19:59:24 +0300 |
commit | 1e9c3d01783d0c4c8f4d38baa662fa2b836a710b (patch) | |
tree | 3b470678b1b36dc88ab7a6ef9cc4ae91e60b2f5c | |
parent | 6513bb7b269ea8b39dfed0e86a2df9a01ee23416 (diff) |
Add Windows 10 SDK discovery
-rw-r--r-- | buildfile | 3 | ||||
-rwxr-xr-x | msvc-14/msvc-14u2-32 | 9 | ||||
-rwxr-xr-x | msvc-14/msvc-14u2-64 | 9 | ||||
-rwxr-xr-x | msvc-14/msvc-14u3-32 | 15 | ||||
-rwxr-xr-x | msvc-14/msvc-14u3-64 | 15 | ||||
-rwxr-xr-x | msvc-15/msvc-15rc1-32 | 9 | ||||
-rwxr-xr-x | msvc-15/msvc-15rc1-64 | 9 | ||||
-rwxr-xr-x | msvc-common/msvc-common | 6 | ||||
-rwxr-xr-x | msvc-common/msvc-sdk-common | 36 | ||||
-rwxr-xr-x | msvc-dispatch | 7 |
10 files changed, 99 insertions, 19 deletions
@@ -19,7 +19,8 @@ s = cl-11-32 lib-11-32 link-11-32 mt-11-32 rc-11-32 \ msvc-dispatch \ \ msvc-common/{msvc-cl-common msvc-common msvc-lib-common \ - msvc-link-common msvc-mt-common msvc-rc-common} \ + msvc-link-common msvc-mt-common msvc-rc-common \ + msvc-sdk-common} \ \ msvc-11/{msvc-11-32} \ msvc-12/{msvc-12-32} \ diff --git a/msvc-14/msvc-14u2-32 b/msvc-14/msvc-14u2-32 index 0d54bb7..0eadc14 100755 --- a/msvc-14/msvc-14u2-32 +++ b/msvc-14/msvc-14u2-32 @@ -8,11 +8,16 @@ if [ -z "$MSVC_INSTALLDIR" ]; then MSVC_INSTALLDIR="Microsoft Visual Studio 14.0" fi +if [ -z "$MSVC_SDKVERSION" ]; then + source "$src_dir/msvc-common/msvc-sdk-common" + MSVC_SDKVERSION="$(windows10_sdkversion)" +fi + # SDK # SDK="C:\\Program Files (x86)\\Windows Kits\\10" SDKBIN="$SDK\\bin\\x86" -SDKVER="10.0.10586.0" +SDKVER="$MSVC_SDKVERSION.0" # Originally "10.0.10586". INCLUDE="$SDK\\include\\$SDKVER\\shared;$SDK\\include\\$SDKVER\\um;$SDK\\include\\$SDKVER\\winrt" LIB="$SDK\\lib\\$SDKVER\\um\\x86" @@ -20,7 +25,7 @@ LIB="$SDK\\lib\\$SDKVER\\um\\x86" # CRT # CRT="C:\\Program Files (x86)\\Windows Kits\\10" -CRTVER="10.0.10586.0" +CRTVER="$MSVC_SDKVERSION.0" # Originally "10.0.10586". INCLUDE="$CRT\\include\\$CRTVER\\ucrt;$INCLUDE" LIB="$CRT\\lib\\$CRTVER\\ucrt\\x86;$LIB" diff --git a/msvc-14/msvc-14u2-64 b/msvc-14/msvc-14u2-64 index 5ac895b..78d65d8 100755 --- a/msvc-14/msvc-14u2-64 +++ b/msvc-14/msvc-14u2-64 @@ -8,11 +8,16 @@ if [ -z "$MSVC_INSTALLDIR" ]; then MSVC_INSTALLDIR="Microsoft Visual Studio 14.0" fi +if [ -z "$MSVC_SDKVERSION" ]; then + source "$src_dir/msvc-common/msvc-sdk-common" + MSVC_SDKVERSION="$(windows10_sdkversion)" +fi + # SDK # SDK="C:\\Program Files (x86)\\Windows Kits\\10" SDKBIN="$SDK\\bin\\x64" -SDKVER="10.0.10586.0" +SDKVER="$MSVC_SDKVERSION.0" # Originally "10.0.10586". INCLUDE="$SDK\\include\\$SDKVER\\shared;$SDK\\include\\$SDKVER\\um;$SDK\\include\\$SDKVER\\winrt" LIB="$SDK\\lib\\$SDKVER\\um\\x64" @@ -20,7 +25,7 @@ LIB="$SDK\\lib\\$SDKVER\\um\\x64" # CRT # CRT="C:\\Program Files (x86)\\Windows Kits\\10" -CRTVER="10.0.10586.0" +CRTVER="$MSVC_SDKVERSION.0" # Originally "10.0.10586". INCLUDE="$CRT\\include\\$CRTVER\\ucrt;$INCLUDE" LIB="$CRT\\lib\\$CRTVER\\ucrt\\x64;$LIB" diff --git a/msvc-14/msvc-14u3-32 b/msvc-14/msvc-14u3-32 index 6d9f277..4822400 100755 --- a/msvc-14/msvc-14u3-32 +++ b/msvc-14/msvc-14u3-32 @@ -8,11 +8,19 @@ if [ -z "$MSVC_INSTALLDIR" ]; then MSVC_INSTALLDIR="Microsoft Visual Studio 14.0" fi +if [ -z "$MSVC_SDKVERSION" ]; then + source "$src_dir/msvc-common/msvc-sdk-common" + MSVC_SDKVERSION="$(windows10_sdkversion)" +fi + # SDK # SDK="C:\\Program Files (x86)\\Windows Kits\\10" SDKBIN="$SDK\\bin\\x86" -SDKVER="10.0.14393.0" + +# Originally "10.0.14393" (if upgrade 14u2) or "10.0.10240" (if clean install). +# +SDKVER="$MSVC_SDKVERSION.0" INCLUDE="$SDK\\include\\$SDKVER\\shared;$SDK\\include\\$SDKVER\\um;$SDK\\include\\$SDKVER\\winrt" LIB="$SDK\\lib\\$SDKVER\\um\\x86" @@ -20,7 +28,10 @@ LIB="$SDK\\lib\\$SDKVER\\um\\x86" # CRT # CRT="C:\\Program Files (x86)\\Windows Kits\\10" -CRTVER="10.0.14393.0" + +# Originally "10.0.14393" (if upgrade 14u2) or "10.0.10240" (if clean install). +# +CRTVER="$MSVC_SDKVERSION.0" INCLUDE="$CRT\\include\\$CRTVER\\ucrt;$INCLUDE" LIB="$CRT\\lib\\$CRTVER\\ucrt\\x86;$LIB" diff --git a/msvc-14/msvc-14u3-64 b/msvc-14/msvc-14u3-64 index deec271..9a4e202 100755 --- a/msvc-14/msvc-14u3-64 +++ b/msvc-14/msvc-14u3-64 @@ -8,11 +8,19 @@ if [ -z "$MSVC_INSTALLDIR" ]; then MSVC_INSTALLDIR="Microsoft Visual Studio 14.0" fi +if [ -z "$MSVC_SDKVERSION" ]; then + source "$src_dir/msvc-common/msvc-sdk-common" + MSVC_SDKVERSION="$(windows10_sdkversion)" +fi + # SDK # SDK="C:\\Program Files (x86)\\Windows Kits\\10" SDKBIN="$SDK\\bin\\x64" -SDKVER="10.0.14393.0" + +# Originally "10.0.14393" (if upgrade 14u2) or "10.0.10240" (if clean install). +# +SDKVER="$MSVC_SDKVERSION.0" INCLUDE="$SDK\\include\\$SDKVER\\shared;$SDK\\include\\$SDKVER\\um;$SDK\\include\\$SDKVER\\winrt" LIB="$SDK\\lib\\$SDKVER\\um\\x64" @@ -20,7 +28,10 @@ LIB="$SDK\\lib\\$SDKVER\\um\\x64" # CRT # CRT="C:\\Program Files (x86)\\Windows Kits\\10" -CRTVER="10.0.14393.0" + +# Originally "10.0.14393" (if upgrade 14u2) or "10.0.10240" (if clean install). +# +CRTVER="$MSVC_SDKVERSION.0" INCLUDE="$CRT\\include\\$CRTVER\\ucrt;$INCLUDE" LIB="$CRT\\lib\\$CRTVER\\ucrt\\x64;$LIB" diff --git a/msvc-15/msvc-15rc1-32 b/msvc-15/msvc-15rc1-32 index 774065a..5e0f4c8 100755 --- a/msvc-15/msvc-15rc1-32 +++ b/msvc-15/msvc-15rc1-32 @@ -8,11 +8,16 @@ if [ -z "$MSVC_INSTALLDIR" ]; then MSVC_INSTALLDIR="Microsoft Visual Studio 15.0" fi +if [ -z "$MSVC_SDKVERSION" ]; then + source "$src_dir/msvc-common/msvc-sdk-common" + MSVC_SDKVERSION="$(windows10_sdkversion)" +fi + # SDK # SDK="C:\\Program Files (x86)\\Windows Kits\\10" SDKBIN="$SDK\\bin\\x86" -SDKVER="10.0.14393.0" +SDKVER="$MSVC_SDKVERSION.0" # Originally "10.0.14393". INCLUDE="$SDK\\include\\$SDKVER\\shared;$SDK\\include\\$SDKVER\\um;$SDK\\include\\$SDKVER\\winrt" LIB="$SDK\\lib\\$SDKVER\\um\\x86" @@ -20,7 +25,7 @@ LIB="$SDK\\lib\\$SDKVER\\um\\x86" # CRT # CRT="C:\\Program Files (x86)\\Windows Kits\\10" -CRTVER="10.0.14393.0" +CRTVER="$MSVC_SDKVERSION.0" # Originally "10.0.14393". INCLUDE="$CRT\\include\\$CRTVER\\ucrt;$INCLUDE" LIB="$CRT\\lib\\$CRTVER\\ucrt\\x86;$LIB" diff --git a/msvc-15/msvc-15rc1-64 b/msvc-15/msvc-15rc1-64 index 60c03be..e50d91b 100755 --- a/msvc-15/msvc-15rc1-64 +++ b/msvc-15/msvc-15rc1-64 @@ -8,11 +8,16 @@ if [ -z "$MSVC_INSTALLDIR" ]; then MSVC_INSTALLDIR="Microsoft Visual Studio 15.0" fi +if [ -z "$MSVC_SDKVERSION" ]; then + source "$src_dir/msvc-common/msvc-sdk-common" + MSVC_SDKVERSION="$(windows10_sdkversion)" +fi + # SDK # SDK="C:\\Program Files (x86)\\Windows Kits\\10" SDKBIN="$SDK\\bin\\x64" -SDKVER="10.0.14393.0" +SDKVER="$MSVC_SDKVERSION.0" # Originally "10.0.14393". INCLUDE="$SDK\\include\\$SDKVER\\shared;$SDK\\include\\$SDKVER\\um;$SDK\\include\\$SDKVER\\winrt" LIB="$SDK\\lib\\$SDKVER\\um\\x64" @@ -20,7 +25,7 @@ LIB="$SDK\\lib\\$SDKVER\\um\\x64" # CRT # CRT="C:\\Program Files (x86)\\Windows Kits\\10" -CRTVER="10.0.14393.0" +CRTVER="$MSVC_SDKVERSION.0" # Originally "10.0.14393". INCLUDE="$CRT\\include\\$CRTVER\\ucrt;$INCLUDE" LIB="$CRT\\lib\\$CRTVER\\ucrt\\x64;$LIB" diff --git a/msvc-common/msvc-common b/msvc-common/msvc-common index 3f2e508..c73bd65 100755 --- a/msvc-common/msvc-common +++ b/msvc-common/msvc-common @@ -42,12 +42,6 @@ function msvc_exec () # <diag> <exe> <arg>... # export WINEDEBUG=fixme-all - # Set an alternative .wine directory if requested. - # - if [ -n "$MSVC_WINEPREFIX" ]; then - export WINEPREFIX="$MSVC_WINEPREFIX" - fi - # Filter diagnostics output replacing absolute Windows paths with their # POSIX mapping. If <diag> is 1 then both stdout and stderr output are read # and filtered. diff --git a/msvc-common/msvc-sdk-common b/msvc-common/msvc-sdk-common index b29777e..a3b1096 100755 --- a/msvc-common/msvc-sdk-common +++ b/msvc-common/msvc-sdk-common @@ -9,4 +9,40 @@ function windows10_sdkversion () # local sdk_root="C:\\Program Files (x86)\\Windows Kits\\10" + # Iterate through $sdk_root/Include subdirectories using the "10.0.NNNNN.0" + # pattern and choose the (lexicographically) greatest one. Strip the + # trailing .0 from the selected name and return it as the SDK version. + # + # Note that redirecting winepath's stderr to /dev/null is essential to + # workaround a wineserver bug. If the script's strderr is redirected to + # stdout, it gets inherited by the shell running winepath and the script + # caller that reads from the child stdout can hang waiting for EOF until + # wineserver terminates. For more details on this bug read the related + # comments in msvc-filter.cxx. + # + local sdk_include + sdk_include="$(winepath -u "$sdk_root/Include" 2>/dev/null)" + + local mxv= + for d in "$sdk_include/10.0."[0-9][0-9][0-9][0-9][0-9]".0"; do + # + # Consider sub-directories only. Note that we can get a false positive if + # there is no entry that matches the "10.0.NNNNN.0" pattern but the + # "10.0.[0-9][0-9][0-9][0-9][0-9].0" sub-directory is present. We handle + # this corner case later by checking the version length. + # + if [ -d "$d" ]; then + local v + v="$(basename "$d")" + if [[ "$mxv" < "$v" ]]; then + mxv="$v" + fi + fi + done + + if [ ${#mxv} -ne 12 ]; then + error "unable to find Windows 10 SDK in $sdk_root" + fi + + echo "${mxv:0:10}" } diff --git a/msvc-dispatch b/msvc-dispatch index 4c2bf2d..5180487 100755 --- a/msvc-dispatch +++ b/msvc-dispatch @@ -63,6 +63,13 @@ MSVC_WINEPREFIX="$(lookup_value "WINEPREFIX")" MSVC_INSTALLDIR="$(lookup_value "INSTALLDIR")" MSVC_SDKVERSION="$(lookup_value "SDKVERSION")" +# Set an alternative .wine directory if requested. WINEPREFIX environment +# variable is recognized by wine and winepath programs. +# +if [ -n "$MSVC_WINEPREFIX" ]; then + export WINEPREFIX="$MSVC_WINEPREFIX" +fi + # Load the configuration. # source "$src_dir/msvc-$major/msvc-$major$minor-$target" |