From: abv Date: Tue, 5 Nov 2013 08:57:35 +0000 (+0400) Subject: 0024316: Make building with different versions of Tcl easier X-Git-Tag: V6_7_1~17 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=fcc04a0558f2eaeb1fbc6c8854bb3da9e30d49e2;p=occt-wok.git 0024316: Make building with different versions of Tcl easier Explicit addition of Tcl libraries to MSVC projects is avoided, they should be linked by #pragma. WOK configuration script improved to recognize version of Tcl. Warning level used for MSVC compiler in WOK increased to -W4. --- diff --git a/src/WOKBuilderDef/CSF_WNT.edl b/src/WOKBuilderDef/CSF_WNT.edl index d9f9c04..27c93b8 100644 --- a/src/WOKBuilderDef/CSF_WNT.edl +++ b/src/WOKBuilderDef/CSF_WNT.edl @@ -17,14 +17,14 @@ -- Visual Studio compilers and tools should be set in PATH @set %CSF_CXX_COMPILER = "cl.exe "; - @set %CSF_CXX_SysOptions = " -nologo -arch:SSE2 -W3 "; + @set %CSF_CXX_SysOptions = " -nologo -arch:SSE2 -W4 "; @string %CSF_CXX_Options = " -DWNT -D_WINDOWS -D_CRT_SECURE_NO_DEPRECATE " %CSF_PRODUCTS_DEFINES " "; @set %CSF_CXX_ModeOpt = " -MD -EHa -O2 -Gy -DNDEBUG -DNo_Exception "; @set %CSF_CXX_ModeOptDeb = " -MDd -EHa -Od -Gm -Zi -DDEB -D_DEBUG "; -- C compiler @set %CSF_C_COMPILER = "cl.exe "; - @set %CSF_C_SysOptions = " -nologo -arch:SSE2 -W3 "; + @set %CSF_C_SysOptions = " -nologo -arch:SSE2 -W4 "; @string %CSF_C_Options = " -DWNT -D_WINDOWS -D_CRT_SECURE_NO_DEPRECATE " %CSF_PRODUCTS_DEFINES " "; @set %CSF_C_ModeOpt = " -MD -EHa -O2 -Gy -DNDEBUG -DNo_Exception "; @set %CSF_C_ModeOptDeb = " -MDd -EHa -Od -Gm -Zi -DDEB -D_DEBUG "; @@ -73,7 +73,7 @@ @string %CSF_TclLibs = "tcl86.lib"; @string %CSF_TclTkLibs = "tk86.lib"; - -- Qt4 framework, doesn't required for OCCT itself + -- Qt4 framework, not required for OCCT itself @string %CSF_QT_INCLUDES = " "; @string %CSF_QT = "QtCore4.lib QtGui4.lib"; diff --git a/src/WOKTclLib/osutils.tcl b/src/WOKTclLib/osutils.tcl index 42f0331..f855bb6 100755 --- a/src/WOKTclLib/osutils.tcl +++ b/src/WOKTclLib/osutils.tcl @@ -1848,8 +1848,9 @@ proc osutils:csfList { theOS theCsfMap } { set aCsfMap(CSF_OpenGlLibs) "opengl32.lib glu32.lib" # -- 3rd-parties precompiled libraries - set aCsfMap(CSF_TclLibs) "tcl86.lib" - set aCsfMap(CSF_TclTkLibs) "tk86.lib" + # Note: Tcl library name depends on version and is chosen by #pragma +# set aCsfMap(CSF_TclLibs) "tcl86.lib" +# set aCsfMap(CSF_TclTkLibs) "tk86.lib" set aCsfMap(CSF_QT) "QtCore4.lib QtGui4.lib" } else { diff --git a/src/WOKsite/wok_deps.tcl b/src/WOKsite/wok_deps.tcl index c040310..ab356e9 100644 --- a/src/WOKsite/wok_deps.tcl +++ b/src/WOKsite/wok_deps.tcl @@ -218,9 +218,12 @@ proc wokdep:SearchTclTk {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin upvar $theErrBin32 anErrBin32 upvar $theErrBin64 anErrBin64 + set tclver_maj 8 + set tclver_min 6 + set isFound "true" set aTclHPath [wokdep:SearchHeader "tcl.h"] - set aTkHPath [wokdep:SearchHeader "tcl.h"] + set aTkHPath [wokdep:SearchHeader "tk.h"] if { "$aTclHPath" == "" || "$aTkHPath" == "" } { if { [file exists "/usr/include/tcl8.6/tcl.h"] && [file exists "/usr/include/tcl8.6/tk.h" ] } { @@ -229,6 +232,7 @@ proc wokdep:SearchTclTk {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$::ARCH" ] if { "$aPath" != "" && [file exists "$aPath/include/tcl.h"] && [file exists "$aPath/include/tk.h"] } { lappend ::CSF_OPT_INC "$aPath/include" + set aTclHPath "$aPath/include/tcl.h" } else { lappend anErrInc "Error: 'tcl.h' or 'tk.h' not found (Tcl/Tk)" set isFound "false" @@ -236,12 +240,21 @@ proc wokdep:SearchTclTk {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin } } + # detect tcl version by parsing header file + if { $isFound } { + set fh [open $aTclHPath] + set tcl_h [read $fh] + close $fh + regexp {define\s+TCL_MAJOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_maj + regexp {define\s+TCL_MINOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_min + } + if { "$::tcl_platform(platform)" == "windows" } { - set aTclLibName "tcl86" - set aTkLibName "tk86" + set aTclLibName "tcl${tclver_maj}${tclver_min}" + set aTkLibName "tk${tclver_maj}${tclver_min}" } else { - set aTclLibName "tcl8.6" - set aTkLibName "tk8.6" + set aTclLibName "tcl${tclver_maj}.${tclver_min}" + set aTkLibName "tk${tclver_maj}.${tclver_min}" } foreach anArchIter {64 32} {