0032624: Configuration, genproj - add support for VS 2022 / vc143
authorkgv <kgv@opencascade.com>
Fri, 15 Oct 2021 18:29:43 +0000 (11:29 -0700)
committersmoskvin <smoskvin@opencascade.com>
Mon, 18 Oct 2021 17:13:10 +0000 (20:13 +0300)
adm/genconf.tcl
adm/genproj.tcl
adm/templates/env.bat

index a2ca8f6c3d2772de3bb68196d29c5202bc502cb5..6fa37c8469cefd94f7c12a9c062a3cc109492e3b 100644 (file)
@@ -63,30 +63,45 @@ set SYS_VC_LIST {}
 set SYS_VCVARS_LIST {}
 
 # detect installed Visual Studio 2017+ instances by running vswhere.exe
-if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] } {
+if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] && "$res" != "" } {
   lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141)"
   lappend ::SYS_VC_LIST "vc141"
-  lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
+  lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
 }
-if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] } {
+if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] && "$res" != "" } {
   lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141) UWP"
   lappend ::SYS_VC_LIST "vc141-uwp"
-  lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
+  lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
 }
-if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] } {
+if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] && "$res" != "" } {
   lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142)"
   lappend ::SYS_VC_LIST "vc142"
-  lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
+  lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
 }
-if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] } {
+if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] && "$res" != "" } {
   lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142) UWP"
   lappend ::SYS_VC_LIST "vc142-uwp"
-  lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
+  lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
 }
-if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] } {
+if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] && "$res" != "" } {
   lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset ClangCL)"
   lappend ::SYS_VC_LIST "vclang"
-  lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
+  lappend ::SYS_VCVARS_LIST "$res\\VC\Auxiliary\\Build\\vcvarsall.bat"
+}
+if { ! [catch {exec vswhere.exe -version "\[17.0,17.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] && "$res" != "" } {
+  lappend ::SYS_VS_LIST "Visual Studio 2022 (17, toolset v143)"
+  lappend ::SYS_VC_LIST "vc143"
+  lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
+}
+if { ! [catch {exec vswhere.exe -version "\[17.0,17.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] && "$res" != "" } {
+  lappend ::SYS_VS_LIST "Visual Studio 2022 (17, toolset v143) UWP"
+  lappend ::SYS_VC_LIST "vc143-uwp"
+  lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
+}
+if { ! [catch {exec vswhere.exe -version "\[17.0,17.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] && "$res" != "" } {
+  lappend ::SYS_VS_LIST "Visual Studio 2022 (17, toolset ClangCL)"
+  lappend ::SYS_VC_LIST "vclang"
+  lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
 }
 
 # detect installed Visual Studio instances from global environment
index ce70ef7b4f7c743148d36f60f22a0ec3ff323adf..90ab8d16aedcff5dfe6f90b2defa3ed5a4c0442b 100644 (file)
@@ -260,7 +260,7 @@ proc genAllResources { theSrcDir } {
 
 # Wrapper-function to generate VS project files
 proc genproj {theFormat args} {
-  set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "vclang" "cbp" "xcd" "pro"}
+  set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "vc143" "vclang" "cbp" "xcd" "pro"}
   set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
   set isHelpRequire false
 
@@ -324,6 +324,7 @@ proc genproj {theFormat args} {
       vc14     -  Visual Studio 2015
       vc141    -  Visual Studio 2017
       vc142    -  Visual Studio 2019
+      vc143    -  Visual Studio 2022
       vclang   -  Visual Studio with ClangCL toolset
       cbp      -  CodeBlocks
       xcd      -  XCode
@@ -560,6 +561,7 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl theSolution }
     "vc14"  -
     "vc141" -
     "vc142" -
+    "vc143" -
     "vclang"   { OS:MKVC  $anOutDir $aModules $aTools $theSolution $theFormat $isUWP}
     "cbp"      { OS:MKCBP $anOutDir $aModules $theSolution $thePlatform $theCmpl }
     "xcd"      {
@@ -1014,8 +1016,8 @@ proc osutils:vcsolution:header { vcversion } {
     append var \
       "Microsoft Visual Studio Solution File, Format Version 12.00\n" \
       "# Visual Studio 2013\n"
-  } elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" || 
-             "$vcversion" == "vc142" || "$vcversion" == "vclang" } {
+  } elseif { "$vcversion" == "vc14"  || "$vcversion" == "vc141" ||
+             "$vcversion" == "vc142" || "$vcversion" == "vc143" || "$vcversion" == "vclang" } {
     append var \
       "Microsoft Visual Studio Solution File, Format Version 12.00\n" \
       "# Visual Studio 14\n"
@@ -1290,6 +1292,9 @@ proc osutils:vcproj:readtemplate {theVcVer isUWP isExec} {
   } elseif { $theVcVer == "vc142" } {
     set aVCRTVer "vc14"
     set aToolset "v142"
+  } elseif { $theVcVer == "vc143" } {
+    set aVCRTVer "vc14"
+    set aToolset "v143"
   } elseif { $theVcVer == "vclang" } {
     set aVCRTVer "vc14"
     set aToolset "ClangCL"
index a02bea526a3adb0fef9ef99440bff1158b1cf242..c2c20424327e750fa4da872f2c89cc9413c0f27c 100644 (file)
@@ -121,8 +121,12 @@ if not "%DevEnvDir%" == "" (
   for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
     set "DevEnvDir=%%i\Common7\IDE\"
   )
+) else if /I "%VCFMT%" == "vc143" (
+  for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
+    set "DevEnvDir=%%i\Common7\IDE\"
+  )
 ) else if /I "%VCFMT%" == "vclang" (
-  for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
+  for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
     set "DevEnvDir=%%i\Common7\IDE\"
   )
 ) else if /I "%VCFMT%" == "gcc" (
@@ -137,6 +141,7 @@ if not "%DevEnvDir%" == "" (
   echo vc14  = VS 2015
   echo vc141 = VS 2017
   echo vc142 = VS 2019
+  echo vc143 = VS 2022
   echo vclang = VS 2019 with ClangCL toolset
   exit /B
 )
@@ -167,10 +172,15 @@ if /I "%VCFMT%" == "vc9" (
     set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
   ) 
   set "VCPlatformToolSet=v142"
-) else if /I "%VCFMT%" == "vclang" (
-  for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
+) else if /I "%VCFMT%" == "vc143" (
+  for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
     set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
   ) 
+  set "VCPlatformToolSet=v143"
+) else if /I "%VCFMT%" == "vclang" (
+  for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
+    set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
+  )
   set "VCPlatformToolSet=ClangCL"
 ) else if /I "%VCFMT%" == "gcc" (
   rem MinGW