Skip to content

Commit

Permalink
0028701: Configuration - add support of VS 2017
Browse files Browse the repository at this point in the history
Added support of Visual Studio 2017 (15) in CMake build procedure.
CMake 3.7.2 or above is required to generate projects for VS 2017.

Since version of compiler and toolset remained at 14 (now they are 14.1), and they use the same run-time, the same third-party products as for VS 2015 (14) can be used.
Also the name of the folder for installation of OCCT binaries in OCCT-standard layout (default on Windows) remains "vc14".

Support of Visual Studio 2017 is added in genproj generator and relevant environment, with format specifier "vc141".

The syntax of the genproj command is revised:
- UWP is considered as separate platform ("uwp" alternative to "wnt"), not part of IDE specification
- Option "IDE" is renamed to "Format"
- Obsolete name of local variable "aWokStation" is replaced by equivalent "theFormat"

In environment scripts, additional variables are defined (derived from VCVER, see adm/vcver.bat):
- VCLIB defines name of the subdirectory specific to VS version; it is the same as VCVER except that for VCVER=vc141 VCLIB=vc14 and for VCVER=141-uwp VCLIB=vc14-uwp
- VCFMT is VCVER without optional suffix "-uwp"
- VCPROP is "NativeDesktop" for normal builds or "Universal" for UWP builds

Command genconf is amended to:
- Detect presence of VS 2017 (separately for desktop and UWP)
- Use only two first digits after "vc" in format specification for search of third-party libs
- Have more space in user interface for VS specification

All supported variants of VCVER variable are documented in dev guides / buiding / msvc
  • Loading branch information
a-betenev authored and bugmaster committed Jul 13, 2017
1 parent efd535a commit d6cda17
Show file tree
Hide file tree
Showing 13 changed files with 243 additions and 152 deletions.
5 changes: 5 additions & 0 deletions adm/cmake/occt_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ macro (OCCT_MAKE_COMPILER_SHORT_NAME)
set (COMPILER vc12)
elseif (MSVC14)
set (COMPILER vc14)
elseif (MSVC15)
# Since Visual Studio 15 (2017), its version diverged from version of
# compiler which is 14.1; as that compiler uses the same run-time as 14.0,
# we keep its id as "vc14" to be compatibille
set (COMPILER vc14)
endif()
elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
set (COMPILER gcc)
Expand Down
43 changes: 27 additions & 16 deletions adm/genconf.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,50 @@ set SYS_VS_LIST {}
set SYS_VC_LIST {}
set SYS_VCVARS_LIST {}

# detect installed Visual Studio instances from global environment
if { [info exists ::env(VS150COMNTOOLS)] } {
lappend ::SYS_VS_LIST "Visual Studio 201x (vc15)"
lappend ::SYS_VC_LIST "vc15"
lappend ::SYS_VCVARS_LIST "%VS150COMNTOOLS%..\\..\\VC\\vcvarsall.bat"
# 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] } {
lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141)"
lappend ::SYS_VC_LIST "vc141"
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
}
if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} 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"
}

# detect installed Visual Studio instances from global environment
if { [info exists ::env(VS140COMNTOOLS)] } {
lappend ::SYS_VS_LIST "Visual Studio 2015 (vc14)"
lappend ::SYS_VS_LIST "Visual Studio 2015 (14, toolset v140)"
lappend ::SYS_VC_LIST "vc14"
lappend ::SYS_VCVARS_LIST "%VS140COMNTOOLS%..\\..\\VC\\vcvarsall.bat"

lappend ::SYS_VS_LIST "Visual Studio 2015 (14, toolset v140) UWP"
lappend ::SYS_VC_LIST "vc14-uwp"
lappend ::SYS_VCVARS_LIST "%VS140COMNTOOLS%..\\..\\VC\\vcvarsall.bat"
}
if { [info exists ::env(VS120COMNTOOLS)] } {
lappend ::SYS_VS_LIST "Visual Studio 2013 (vc12)"
lappend ::SYS_VS_LIST "Visual Studio 2013 (12, toolset v120)"
lappend ::SYS_VC_LIST "vc12"
lappend ::SYS_VCVARS_LIST "%VS120COMNTOOLS%..\\..\\VC\\vcvarsall.bat"
}
if { [info exists ::env(VS110COMNTOOLS)] } {
lappend ::SYS_VS_LIST "Visual Studio 2012 (vc11)"
lappend ::SYS_VS_LIST "Visual Studio 2012 (11, toolset v110)"
lappend ::SYS_VC_LIST "vc11"
lappend ::SYS_VCVARS_LIST "%VS110COMNTOOLS%..\\..\\VC\\vcvarsall.bat"
}
if { [info exists ::env(VS100COMNTOOLS)] } {
lappend ::SYS_VS_LIST "Visual Studio 2010 (vc10)"
lappend ::SYS_VS_LIST "Visual Studio 2010 (10, toolset v100)"
lappend ::SYS_VC_LIST "vc10"
lappend ::SYS_VCVARS_LIST "%VS100COMNTOOLS%..\\..\\VC\\vcvarsall.bat"
}
if { [info exists ::env(VS90COMNTOOLS)] } {
lappend ::SYS_VS_LIST "Visual Studio 2008 (vc9)"
lappend ::SYS_VS_LIST "Visual Studio 2008 (9, toolset v90)"
lappend ::SYS_VC_LIST "vc9"
lappend ::SYS_VCVARS_LIST "%VS90COMNTOOLS%..\\..\\VC\\vcvarsall.bat"
}
if { [info exists ::env(VS80COMNTOOLS)] } {
lappend ::SYS_VS_LIST "Visual Studio 2005 (vc8)"
lappend ::SYS_VS_LIST "Visual Studio 2005 (8, toolset v80)"
lappend ::SYS_VC_LIST "vc8"
lappend ::SYS_VCVARS_LIST "%VS80COMNTOOLS%..\\..\\VC\\vcvarsall.bat"
}
Expand Down Expand Up @@ -129,10 +140,10 @@ proc wokdep:gui:UpdateList {} {
wokdep:SearchX11 anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
if { "$::HAVE_GLES2" == "true" } {
if { "$::HAVE_GL2PS" == "true" } {
lappend anIncErrs "Error: gl2ps can not be used within OpenGL ES"
lappend anIncErrs "Error: gl2ps can not be used with OpenGL ES"
}
if { "$::HAVE_D3D" == "true" } {
lappend anIncErrs "Error: Direct3D can not be used within OpenGL ES"
lappend anIncErrs "Error: Direct3D can not be used with OpenGL ES"
}
wokdep:SearchEGL anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
wokdep:SearchGLES anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
Expand Down Expand Up @@ -388,10 +399,10 @@ proc wokdep:gui:Show64Bitness { theRowIter } {
}

# Header
ttk::label .myFrame.myVsFrame.myVsLbl -text "Visual Studio configuration:" -padding {5 5 80 5}
ttk::combobox .myFrame.myVsFrame.myVsCombo -values $SYS_VS_LIST -state readonly -textvariable VSVER -width 30
ttk::label .myFrame.myVsFrame.myVsLbl -text "Visual Studio configuration:" -padding {5 5 20 5}
ttk::combobox .myFrame.myVsFrame.myVsCombo -values $SYS_VS_LIST -state readonly -textvariable VSVER -width 40
ttk::combobox .myFrame.myVsFrame.myArchCombo -values { {32} {64} } -textvariable ARCH -state readonly -width 6
entry .myFrame.myVcEntry -textvariable VCVER -width 6
entry .myFrame.myVcEntry -textvariable VCVER -width 10
entry .myFrame.myVcVarsEntry -textvariable VCVARS -width 70
ttk::button .myFrame.myVcBrowseBtn -text "Browse" -command wokdep:gui:BrowseVcVars
ttk::label .myFrame.myHxxChecks.myRelDebInfoLbl -text "Release with Debug info"
Expand Down
24 changes: 17 additions & 7 deletions adm/genconfdeps.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,14 @@ proc wokdep:Preferred {theList theCmpl theArch} {
return ""
}

# keep only two first digits in "vc141"
if { ! [regexp {^vc[0-9][0-9]} $theCmpl aCmpl] } {
set aCmpl $theCmpl
}

set aShortList {}
foreach aPath $theList {
if { [string first "$theCmpl" "$aPath"] != "-1" } {
if { [string first "$aCmpl" "$aPath"] != "-1" } {
lappend aShortList "$aPath"
}
}
Expand Down Expand Up @@ -589,6 +594,11 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
upvar $theErrBin32 anErrBin32
upvar $theErrBin64 anErrBin64

# keep only two first digits in "vc141"
if { ! [regexp {^vc[0-9][0-9]} ${::VCVER} aVcLib] } {
set aVcLib ${::VCVER}
}

set isFound "true"
set aTbbHPath [wokdep:SearchHeader "tbb/scalable_allocator.h"]
if { "$aTbbHPath" == "" } {
Expand All @@ -609,8 +619,8 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64

set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter"]
if { "$aTbbLibPath" == "" } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ]
set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir/${::VCVER}"]
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir/$aVcLib"]
if { "$aTbbLibPath" == "" } {
# Set the path to the TBB library for Linux
if { "$::tcl_platform(platform)" != "windows" } {
Expand All @@ -621,7 +631,7 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir"
}
} else {
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/${::VCVER}"
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/$aVcLib"
}
if { "$aTbbLibPath" == "" } {
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
Expand All @@ -631,10 +641,10 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
if { "$::tcl_platform(platform)" == "windows" } {
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
if { "$aTbbDllPath" == "" } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ]
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/${::VCVER}"]
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
if { "$aTbbDllPath" != "" } {
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/${::VCVER}"
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/$aVcLib"
} else {
lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
Expand Down
Loading

0 comments on commit d6cda17

Please sign in to comment.