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 /msvc-common | |
parent | 6513bb7b269ea8b39dfed0e86a2df9a01ee23416 (diff) |
Add Windows 10 SDK discovery
Diffstat (limited to 'msvc-common')
-rwxr-xr-x | msvc-common/msvc-common | 6 | ||||
-rwxr-xr-x | msvc-common/msvc-sdk-common | 36 |
2 files changed, 36 insertions, 6 deletions
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}" } |