]> OCCT Git - occt-wok.git/commitdiff
0024316: Make building with different versions of Tcl easier
authorabv <abv@opencascade.com>
Tue, 5 Nov 2013 08:57:35 +0000 (12:57 +0400)
committerabv <abv@opencascade.com>
Tue, 5 Nov 2013 08:59:21 +0000 (12:59 +0400)
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.

src/WOKBuilderDef/CSF_WNT.edl
src/WOKTclLib/osutils.tcl
src/WOKsite/wok_deps.tcl

index d9f9c047709e8660daa65b3ae43b1eabc706f323..27c93b8b339f925b271a2f09e5a2af17e356bc78 100644 (file)
 
   -- 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";
 
index 42f0331fc77b0b2b3c0e42a77b8d3328996786c6..f855bb6428aa1f96a77a0bd9ad0320c4e5707e71 100755 (executable)
@@ -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 {
index c0403109ebb1a29c5e0a8a1fc35d7ffa5dc79d97..ab356e90be6932de09f7ed1abacd126b8fe8fc01 100644 (file)
@@ -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} {