0024316: Make building with different versions of Tcl easier
[occt.git] / src / Draw / Draw.cxx
index 7780a13..7054f69 100755 (executable)
@@ -60,7 +60,6 @@
 #include <Draw_Drawable3D.hxx>
 #include <Draw_Interpretor.hxx>
 #include <Draw_ProgressIndicator.hxx>
-#include <tcl.h>
 
 #include <Draw_MapOfFunctions.hxx>
 #include <OSD_SharedLibrary.hxx>
 #include <Draw_Failure.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <Standard_ErrorHandler.hxx>
+
+#include <tcl.h>
+
+// on MSVC, use #pragma to define name of the Tcl library to link with,
+// depending on Tcl version number
+#ifdef _MSC_VER
+// two helper macros are needed to convert version number macro to string literal
+#define STRINGIZE1(a) #a
+#define STRINGIZE2(a) STRINGIZE1(a)
+#pragma comment (lib, "tcl" STRINGIZE2(TCL_MAJOR_VERSION) STRINGIZE2(TCL_MINOR_VERSION) ".lib")
+#pragma comment (lib, "tk"  STRINGIZE2(TCL_MAJOR_VERSION) STRINGIZE2(TCL_MINOR_VERSION) ".lib")
+#undef STRINGIZE2
+#undef STRINGIZE1
+#endif
+
 extern Standard_Boolean Draw_ParseFailed;
 
 Standard_EXPORT Draw_Viewer dout;