1.1 --- a/common/autoconf/toolchain_windows.m4 Thu May 31 13:57:22 2018 +0100 1.2 +++ b/common/autoconf/toolchain_windows.m4 Fri Jun 08 14:06:17 2018 -0700 1.3 @@ -24,8 +24,8 @@ 1.4 # 1.5 1.6 ################################################################################ 1.7 - 1.8 -VALID_VS_VERSIONS="2010 2012 2013" 1.9 +# The order of these defines the priority by which we try to find them. 1.10 +VALID_VS_VERSIONS="2010 2012 2013 2015 2017" 1.11 1.12 VS_DESCRIPTION_2010="Microsoft Visual Studio 2010" 1.13 VS_VERSION_INTERNAL_2010=100 1.14 @@ -58,6 +58,30 @@ 1.15 VS_VS_PLATFORM_NAME_2013="v120" 1.16 VS_SDK_PLATFORM_NAME_2013= 1.17 1.18 +VS_DESCRIPTION_2015="Microsoft Visual Studio 2015 - CURRENTLY NOT WORKING" 1.19 +VS_VERSION_INTERNAL_2015=140 1.20 +VS_MSVCR_2015=vcruntime140.dll 1.21 +VS_MSVCP_2015=msvcp140.dll 1.22 +VS_ENVVAR_2015="VS140COMNTOOLS" 1.23 +VS_VS_INSTALLDIR_2015="Microsoft Visual Studio 14.0" 1.24 +VS_SDK_INSTALLDIR_2015= 1.25 +VS_VS_PLATFORM_NAME_2015="v140" 1.26 +VS_SDK_PLATFORM_NAME_2015= 1.27 +# The vcvars of 2015 breaks if 2017 is also installed. Work around this by 1.28 +# explicitly specifying Windows Kit 8.1 to be used. 1.29 +VS_ENV_ARGS_2015="8.1" 1.30 + 1.31 +VS_DESCRIPTION_2017="Microsoft Visual Studio 2017 - CURRENTLY NOT WORKING" 1.32 +VS_VERSION_INTERNAL_2017=141 1.33 +VS_MSVCR_2017=vcruntime140.dll 1.34 +VS_MSVCP_2017=msvcp140.dll 1.35 +VS_ENVVAR_2017="VS150COMNTOOLS" 1.36 +VS_VS_INSTALLDIR_2017="Microsoft Visual Studio/2017" 1.37 +VS_EDITIONS_2017="Community Professional Enterprise" 1.38 +VS_SDK_INSTALLDIR_2017= 1.39 +VS_VS_PLATFORM_NAME_2017="v141" 1.40 +VS_SDK_PLATFORM_NAME_2017= 1.41 + 1.42 ################################################################################ 1.43 1.44 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT], 1.45 @@ -67,23 +91,42 @@ 1.46 VS_BASE="$2" 1.47 METHOD="$3" 1.48 1.49 - if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then 1.50 - VCVARSFILE="vc/bin/vcvars32.bat" 1.51 - else 1.52 - VCVARSFILE="vc/bin/amd64/vcvars64.bat" 1.53 + BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE) 1.54 + # In VS 2017, the default installation is in a subdir named after the edition. 1.55 + # Find the first one present and use that. 1.56 + if test "x$VS_EDITIONS" != x; then 1.57 + for edition in $VS_EDITIONS; do 1.58 + if test -d "$VS_BASE/$edition"; then 1.59 + VS_BASE="$VS_BASE/$edition" 1.60 + break 1.61 + fi 1.62 + done 1.63 fi 1.64 1.65 - BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE) 1.66 if test -d "$VS_BASE"; then 1.67 - if test -f "$VS_BASE/$VCVARSFILE"; then 1.68 - AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD]) 1.69 - VS_ENV_CMD="$VS_BASE/$VCVARSFILE" 1.70 - # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see 1.71 - # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013 1.72 + AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD]) 1.73 + if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then 1.74 + VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat" 1.75 + else 1.76 + VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \ 1.77 + vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat" 1.78 + fi 1.79 + 1.80 + for VCVARSFILE in $VCVARSFILES; do 1.81 + if test -f "$VS_BASE/$VCVARSFILE"; then 1.82 + VS_ENV_CMD="$VS_BASE/$VCVARSFILE" 1.83 + break 1.84 + fi 1.85 + done 1.86 + 1.87 + if test "x$VS_ENV_CMD" = x; then 1.88 + AC_MSG_NOTICE([Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring]) 1.89 + else 1.90 + # PLATFORM_TOOLSET is used during the compilation of the freetype sources 1.91 + # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 1.92 + # 'v110' or 'v120' for VS 2010, 2012 or VS2013 1.93 eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" 1.94 - else 1.95 - AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD]) 1.96 - AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring]) 1.97 + 1.98 fi 1.99 fi 1.100 fi 1.101 @@ -133,7 +176,9 @@ 1.102 eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}" 1.103 eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}" 1.104 eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}" 1.105 + eval VS_EDITIONS="\${VS_EDITIONS_${VS_VERSION}}" 1.106 eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}" 1.107 + eval VS_ENV_ARGS="\${VS_ENV_ARGS_${VS_VERSION}}" 1.108 1.109 # When using --with-tools-dir, assume it points to the correct and default 1.110 # version of Visual Studio or that --with-toolchain-version was also set. 1.111 @@ -153,7 +198,6 @@ 1.112 fi 1.113 1.114 VS_ENV_CMD="" 1.115 - VS_ENV_ARGS="" 1.116 1.117 if test "x$VS_COMNTOOLS" != x; then 1.118 TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}], 1.119 @@ -213,7 +257,11 @@ 1.120 elif test "x$DEVKIT_VS_VERSION" != x; then 1.121 VS_VERSION=$DEVKIT_VS_VERSION 1.122 TOOLCHAIN_VERSION=$VS_VERSION 1.123 - eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}" 1.124 + # If the devkit has a name, use that as description 1.125 + VS_DESCRIPTION="$DEVKIT_NAME" 1.126 + if test "x$VS_DESCRIPTION" = x; then 1.127 + eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}" 1.128 + fi 1.129 eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}" 1.130 eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}" 1.131 eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}" 1.132 @@ -267,6 +315,11 @@ 1.133 break 1.134 fi 1.135 done 1.136 + 1.137 + TOOLCHAIN_DESCRIPTION="$VS_DESCRIPTION" 1.138 + if test "$TOOLCHAIN_VERSION" -gt 2013; then 1.139 + UNSUPPORTED_TOOLCHAIN_VERSION=yes 1.140 + fi 1.141 ]) 1.142 1.143 ################################################################################ 1.144 @@ -320,6 +373,9 @@ 1.145 # This will end up something like: 1.146 # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat 1.147 $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE 1.148 + # In some cases, the VS_ENV_CMD will change directory, change back so 1.149 + # the set-vs-env.sh ends up in the right place. 1.150 + $ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE 1.151 # These will end up something like: 1.152 # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh 1.153 # The trailing space for everyone except PATH is no typo, but is needed due 1.154 @@ -447,18 +503,30 @@ 1.155 MSVC_DLL= 1.156 1.157 if test "x$MSVC_DLL" = x; then 1.158 - # Probe: Using well-known location from Visual Studio 10.0 1.159 if test "x$VCINSTALLDIR" != x; then 1.160 CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR" 1.161 BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR) 1.162 - if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 1.163 - POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" 1.164 + if test "$VS_VERSION" -lt 2017; then 1.165 + # Probe: Using well-known location from Visual Studio 12.0 and older 1.166 + if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 1.167 + POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" 1.168 + else 1.169 + POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" 1.170 + fi 1.171 else 1.172 - POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" 1.173 + # Probe: Using well-known location from VS 2017 1.174 + if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 1.175 + POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`" 1.176 + else 1.177 + POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`" 1.178 + fi 1.179 fi 1.180 - $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL" 1.181 - TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL], 1.182 + # In case any of the above finds more than one file, loop over them. 1.183 + for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do 1.184 + $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll" 1.185 + TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$possible_msvc_dll], 1.186 [well-known location in VCINSTALLDIR]) 1.187 + done 1.188 fi 1.189 fi 1.190