0026763: CMake configuration process does not allow setup paths for TK library if...
authorski <ski@opencascade.com>
Mon, 2 Nov 2015 14:45:26 +0000 (17:45 +0300)
committerbugmaster <bugmaster@opencascade.com>
Tue, 3 Nov 2015 11:51:53 +0000 (14:51 +0300)
It is possible now to use standalone TCL and TK.
Behavior of 3RDPARTY_TK_DIR specifying extended
TCL/TK searching works correctly with installed ActiveTcl
TCL/TK searching works correctly with latest versions of CMake
Macro COMPLIANCE_PRODUCT_CONSISTENCY was created.

Small update of compilation for android

16 files changed:
CMakeLists.txt
adm/cmake/3rdparty_macro.cmake
adm/cmake/occt_macros.cmake
adm/cmake/tcl.cmake
adm/cmake/tk.cmake [new file with mode: 0644]
adm/cmake/vardescr.cmake
adm/templates/custom.build.bat.in
adm/templates/custom.build.sh.in
adm/templates/custom.install.bat.in
adm/templates/custom.install.sh.in
adm/templates/env.build.bat.in
adm/templates/env.build.sh.in
adm/templates/env.install.bat.in
adm/templates/env.install.sh.in
src/OpenGl/OpenGl_Context.cxx
src/OpenGl/OpenGl_View_Redraw.cxx

index a897d3b..755ad03 100644 (file)
@@ -160,11 +160,15 @@ OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
 if ("${USE_TCL}" STREQUAL ON)
   message (STATUS "Info: TCL is used by OCCT")
   OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl")
+  
+  message (STATUS "Info: TK is used by OCCT")
+  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tk")
 else()
   OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL")
   OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK")
 
   OCCT_CHECK_AND_UNSET ("INSTALL_TCL")
+  OCCT_CHECK_AND_UNSET ("INSTALL_TK")
 endif()
 
 # search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit
index 6705f5b..577ddbd 100644 (file)
@@ -192,3 +192,60 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEB
 
   mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)
 endmacro()
+
+macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME)
+  if (3RDPARTY_${LIBNAME}_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DIR}")
+    # include dir
+    set (DOES_PATH_CONTAIN FALSE)
+    if (3RDPARTY_${LIBNAME}_INCLUDE_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
+      string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
+    endif()
+    if (NOT DOES_PATH_CONTAIN)
+      set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
+    endif()
+
+    # library dir
+    set (DOES_PATH_CONTAIN FALSE)
+    if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
+      string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
+    endif()
+    if (NOT DOES_PATH_CONTAIN)
+      set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
+    endif()
+
+    # shared library dir
+    if (WIN32)
+      set (DOES_PATH_CONTAIN FALSE)
+      if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
+        string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL_DIR}")
+      endif()
+      if (NOT DOES_PATH_CONTAIN)
+        set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
+      endif()
+    endif()
+  endif()
+
+  # check library
+  set (DOES_PATH_CONTAIN FALSE)
+  if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
+    if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
+      string (REGEX MATCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY}")
+    endif()
+  endif()
+  if (NOT DOES_PATH_CONTAIN)
+    set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
+  endif()
+
+  # check shared library
+  if (WIN32)
+    set (DOES_PATH_CONTAIN FALSE)
+    if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
+      if (3RDPARTY_${LIBNAME}_DLL AND EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
+        string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DLL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL}")
+      endif()
+    endif()
+    if (NOT DOES_PATH_CONTAIN)
+      set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
+    endif()
+  endif()
+endmacro()
index cf68136..0e87d9a 100644 (file)
@@ -111,6 +111,11 @@ function (FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
 
   string (TOLOWER "${PRODUCT_NAME}" lower_PRODUCT_NAME)
 
+  list (APPEND SEARCH_TEMPLATES "^${lower_PRODUCT_NAME}.*${COMPILER}.*${COMPILER_BITNESS}")
+  list (APPEND SEARCH_TEMPLATES "^${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
+  list (APPEND SEARCH_TEMPLATES "^${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER_BITNESS}")
+  list (APPEND SEARCH_TEMPLATES "^${lower_PRODUCT_NAME}.*[0-9.]+")
+  list (APPEND SEARCH_TEMPLATES "^${lower_PRODUCT_NAME}")
   list (APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*${COMPILER}.*${COMPILER_BITNESS}")
   list (APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
   list (APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER_BITNESS}")
index 99aa0c5..033171b 100644 (file)
@@ -14,11 +14,6 @@ if (NOT DEFINED 3RDPARTY_TCL_INCLUDE_DIR)
   set (3RDPARTY_TCL_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tcl")
 endif()
 
-# tk include directory
-if (NOT DEFINED 3RDPARTY_TK_INCLUDE_DIR)
-  set (3RDPARTY_TK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tk")
-endif()
-
 # tcl library file (with absolute path)
 if (NOT DEFINED 3RDPARTY_TCL_LIBRARY OR NOT 3RDPARTY_TCL_LIBRARY_DIR)
   set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "tcl library"  FORCE)
@@ -29,16 +24,6 @@ if (NOT DEFINED 3RDPARTY_TCL_LIBRARY_DIR)
   set (3RDPARTY_TCL_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tcl library")
 endif()
 
-# tk library file (with absolute path)
-if (NOT DEFINED 3RDPARTY_TK_LIBRARY OR NOT 3RDPARTY_TK_LIBRARY_DIR)
-  set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "tk library" FORCE)
-endif()
-
-# tk library directory
-if (NOT DEFINED 3RDPARTY_TK_LIBRARY_DIR)
-  set (3RDPARTY_TK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tk library")
-endif()
-
 # tcl shared library (with absolute path)
 if (WIN32)
   if (NOT DEFINED 3RDPARTY_TCL_DLL OR NOT 3RDPARTY_TCL_DLL_DIR)
@@ -51,18 +36,6 @@ if (WIN32 AND NOT DEFINED 3RDPARTY_TCL_DLL_DIR)
   set (3RDPARTY_TCL_DLL_DIR "" CACHE FILEPATH "The directory containing tcl shared library")
 endif()
 
-# tk shared library (with absolute path)
-if (WIN32)
-  if (NOT DEFINED 3RDPARTY_TK_DLL OR NOT 3RDPARTY_TK_DLL_DIR)
-    set (3RDPARTY_TK_DLL "" CACHE FILEPATH "tk shared library" FORCE)
-  endif()
-endif()
-
-# tk shared library directory
-if (WIN32 AND NOT DEFINED 3RDPARTY_TK_DLL_DIR)
-  set (3RDPARTY_TK_DLL_DIR "" CACHE FILEPATH "The directory containing tk shared library")
-endif()
-
 # search for tcl in user defined directory
 if (NOT 3RDPARTY_TCL_DIR AND 3RDPARTY_DIR)
   FIND_PRODUCT_DIR("${3RDPARTY_DIR}" tcl TCL_DIR_NAME)
@@ -76,226 +49,148 @@ if (3RDPARTY_TCL_DIR AND EXISTS "${3RDPARTY_TCL_DIR}")
   set (TCL_INCLUDE_PATH "${3RDPARTY_TCL_DIR}/include")
 endif()
 
-# check tcl/tk include dir, library dir and shared library dir
-macro (DIR_SUBDIR_FILE_FIT LIBNAME)
-  if (3RDPARTY_TCL_DIR AND EXISTS "${3RDPARTY_TCL_DIR}")
-    # tcl/tk include dir
-    if (3RDPARTY_${LIBNAME}_INCLUDE_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
-      string (REGEX MATCH "${3RDPARTY_TCL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
-      if (NOT DOES_PATH_CONTAIN)
-        set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
-      endif()
-    else()
-      set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
-    endif()
-
-    # tcl/tk library dir
-    if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
+# check tcl include dir, library dir and shared library dir
+COMPLIANCE_PRODUCT_CONSISTENCY(TCL)
 
-      string (REGEX MATCH "${3RDPARTY_TCL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
-      if (NOT DOES_PATH_CONTAIN)
-        set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
-      endif()
-    else()
-      set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
-    endif()
+# use default (CMake) TCL search
+find_package(TCL)
 
-    # tcl/tk shared library dir
-    if (WIN32)
-      if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
-        string (REGEX MATCH "${3RDPARTY_TCL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL_DIR}")
-        if (NOT DOES_PATH_CONTAIN)
-          set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
-        endif()
-      else()
-        set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
-      endif()
-    endif()
+# tcl include dir
+if (NOT 3RDPARTY_TCL_INCLUDE_DIR)
+  if (TCL_INCLUDE_PATH AND EXISTS "${TCL_INCLUDE_PATH}")
+    set (3RDPARTY_TCL_INCLUDE_DIR "${TCL_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of TCL" FORCE)
   endif()
+endif()
 
-  # check tcl/tk library
-  if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
-    if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
-      string (REGEX MATCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY}")
+# tcl dir and library
+if (NOT 3RDPARTY_TCL_LIBRARY)
+  if (TCL_LIBRARY AND EXISTS "${TCL_LIBRARY}")
+    set (3RDPARTY_TCL_LIBRARY "${TCL_LIBRARY}" CACHE FILEPATH "TCL library" FORCE)
 
-      if (NOT DOES_PATH_CONTAIN)
-        set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
-      endif()
-    else()
-      set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
+    if (NOT 3RDPARTY_TCL_LIBRARY_DIR)
+      get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
+      set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
     endif()
-  else()
-    set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
   endif()
+endif()
 
-  # check tcl/tk shared library
-  if (WIN32)
-    if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
-      if (3RDPARTY_${LIBNAME}_DLL AND EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
-        string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DLL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL}")
-
-        if (NOT DOES_PATH_CONTAIN)
-          set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
-        endif()
-      else()
-        set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
-      endif()
-    else()
-      set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
+
+if (WIN32)
+  if (NOT 3RDPARTY_TCL_DLL)
+    set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+
+    set (DLL_FOLDER_FOR_SEARCH "")
+    if (3RDPARTY_TCL_DLL_DIR)
+      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
+    elseif (3RDPARTY_TCL_DIR)
+      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
+    elseif (3RDPARTY_TCL_LIBRARY_DIR)
+      get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
+      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
     endif()
-  endif()
-endmacro()
 
+    set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
+    find_library (3RDPARTY_TCL_DLL NAMES tcl86 tcl85
+                                          PATHS "${DLL_FOLDER_FOR_SEARCH}"
+                                          NO_DEFAULT_PATH)
+  endif()
+endif()
 
-DIR_SUBDIR_FILE_FIT(TCL)
-DIR_SUBDIR_FILE_FIT(TK)
+COMPLIANCE_PRODUCT_CONSISTENCY(TCL)
 
+# tcl dir and library
+if (NOT 3RDPARTY_TCL_LIBRARY)
+  set (3RDPARTY_TCL_LIBRARY "3RDPARTY_TCL_LIBRARY-NOTFOUND" CACHE FILEPATH "TCL library" FORCE)
+  find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
+                                            PATHS "${3RDPARTY_TCL_LIBRARY_DIR}"
+                                            NO_DEFAULT_PATH)
 
-# use default (CMake) TCL search
-find_package(TCL)
+  # search in another place if previous search doesn't find anything
+  find_library (3RDPARTY_TCL_LIBRARY NAMES tcl8.6 tcl86 tcl8.5 tcl85
+                                            PATHS "${3RDPARTY_TCL_DIR}/lib"
+                                            NO_DEFAULT_PATH)
 
-foreach (LIBNAME TCL TK)
-  string (TOLOWER "${LIBNAME}" LIBNAME_L)
 
-  # tcl/tk include dir
-  if (NOT 3RDPARTY_${LIBNAME}_INCLUDE_DIR)
-    if (${LIBNAME}_INCLUDE_PATH AND EXISTS "${${LIBNAME}_INCLUDE_PATH}")
-      set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "${${LIBNAME}_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
-    endif()
+  if (NOT 3RDPARTY_TCL_LIBRARY OR NOT EXISTS "${3RDPARTY_TCL_LIBRARY}")
+    set (3RDPARTY_TCL_LIBRARY "" CACHE FILEPATH "TCL library" FORCE)
   endif()
 
-  # tcl/tk dir and library
-  if (NOT 3RDPARTY_${LIBNAME}_LIBRARY)
-    if (${LIBNAME}_LIBRARY AND EXISTS "${${LIBNAME}_LIBRARY}")
-      set (3RDPARTY_${LIBNAME}_LIBRARY "${${LIBNAME}_LIBRARY}" CACHE FILEPATH "${LIBNAME} library" FORCE)
-
-      if (NOT 3RDPARTY_${LIBNAME}_LIBRARY_DIR)
-        get_filename_component (3RDPARTY_${LIBNAME}_LIBRARY_DIR "${3RDPARTY_${LIBNAME}_LIBRARY}" PATH)
-        set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
-      endif()
-    endif()
+  if (NOT 3RDPARTY_TCL_LIBRARY_DIR AND 3RDPARTY_TCL_LIBRARY)
+    get_filename_component (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
+    set (3RDPARTY_TCL_LIBRARY_DIR "${3RDPARTY_TCL_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TCL library" FORCE)
   endif()
+endif()
 
+set (3RDPARTY_TCL_LIBRARY_VERSION "")
+if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
+  get_filename_component (TCL_LIBRARY_NAME "${3RDPARTY_TCL_LIBRARY}" NAME)
+  string(REGEX REPLACE "^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY_NAME}")
 
-  if (WIN32)
-    if (NOT 3RDPARTY_${LIBNAME}_DLL)
-        set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
-
-        set (DLL_FOLDER_FOR_SEARCH "")
-        if (3RDPARTY_${LIBNAME}_DLL_DIR)
-          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_${LIBNAME}_DLL_DIR}")
-        elseif (3RDPARTY_TCL_DIR)
-          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
-        elseif (3RDPARTY_${LIBNAME}_LIBRARY_DIR)
-          get_filename_component (3RDPARTY_${LIBNAME}_LIBRARY_DIR_PARENT "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" PATH)
-          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR_PARENT}/bin")
-        endif()
-
-        set (3RDPARTY_${LIBNAME}_DLL "3RDPARTY_${LIBNAME}_DLL-NOTFOUND" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
-        find_library (3RDPARTY_${LIBNAME}_DLL NAMES ${LIBNAME_L}86 ${LIBNAME_L}85
-                                              PATHS "${DLL_FOLDER_FOR_SEARCH}"
-                                              NO_DEFAULT_PATH)
-    endif()
+  if (NOT "${TCL_LIBRARY_VERSION}" STREQUAL "${TCL_LIBRARY_NAME}")
+    set (3RDPARTY_TCL_LIBRARY_VERSION "${TCL_LIBRARY_VERSION}")
+  else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
+    message (STATUS "Info: TCL version isn't found")
   endif()
+endif()
 
-  DIR_SUBDIR_FILE_FIT(${LIBNAME})
-
-
-  # tcl/tk dir and library
-  if (NOT 3RDPARTY_${LIBNAME}_LIBRARY)
-    set (3RDPARTY_${LIBNAME}_LIBRARY "3RDPARTY_${LIBNAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "${LIBNAME} library" FORCE)
-    find_library (3RDPARTY_${LIBNAME}_LIBRARY NAMES ${LIBNAME_L}8.6 ${LIBNAME_L}86 ${LIBNAME_L}8.5 ${LIBNAME_L}85
-                                              PATHS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}"
-                                              NO_DEFAULT_PATH)
-
-    # search in another place if previous search doesn't find anything
-    find_library (3RDPARTY_${LIBNAME}_LIBRARY NAMES ${LIBNAME_L}8.6 ${LIBNAME_L}86 ${LIBNAME_L}8.5 ${LIBNAME_L}85
-                                              PATHS "${3RDPARTY_TCL_DIR}/lib"
-                                              NO_DEFAULT_PATH)
-
-
-    if (NOT 3RDPARTY_${LIBNAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
-      set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
-    endif()
+set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "")
+if (3RDPARTY_TCL_LIBRARY_VERSION)
+  string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TCL_MAJOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
+  string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TCL_MINOR_VERSION "${3RDPARTY_TCL_LIBRARY_VERSION}")
+  set (3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TCL_MAJOR_VERSION}.${3RDPARTY_TCL_MINOR_VERSION}")
+endif()
 
-    if (NOT 3RDPARTY_${LIBNAME}_LIBRARY_DIR AND 3RDPARTY_${LIBNAME}_LIBRARY)
-      get_filename_component (3RDPARTY_${LIBNAME}_LIBRARY_DIR "${3RDPARTY_${LIBNAME}_LIBRARY}" PATH)
-      set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
+if (WIN32)
+  if (NOT 3RDPARTY_TCL_DLL)
+    set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+
+    set (DLL_FOLDER_FOR_SEARCH "")
+    if (3RDPARTY_TCL_DLL_DIR)
+      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DLL_DIR}")
+    elseif (3RDPARTY_TCL_DIR)
+      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
+    else()
+      get_filename_component (3RDPARTY_TCL_LIBRARY_DIR_PARENT "${3RDPARTY_TCL_LIBRARY_DIR}" PATH)
+      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_LIBRARY_DIR_PARENT}/bin")
     endif()
-  endif()
 
-  set (3RDPARTY_${LIBNAME}_LIBRARY_VERSION "")
-  if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
-    get_filename_component (${LIBNAME}_LIBRARY_NAME "${3RDPARTY_${LIBNAME}_LIBRARY}" NAME)
-    string(REGEX REPLACE "^.*${LIBNAME_L}([0-9]\\.*[0-9]).*$" "\\1" ${LIBNAME}_LIBRARY_VERSION "${${LIBNAME}_LIBRARY_NAME}")
+    set (3RDPARTY_TCL_DLL "3RDPARTY_TCL_DLL-NOTFOUND" CACHE FILEPATH "TCL shared library" FORCE)
+    find_library (3RDPARTY_TCL_DLL NAMES tcl${3RDPARTY_TCL_LIBRARY_VERSION}
+                                          PATHS "${DLL_FOLDER_FOR_SEARCH}"
+                                          NO_DEFAULT_PATH)
 
-    if (NOT "${${LIBNAME}_LIBRARY_VERSION}" STREQUAL "${${LIBNAME}_LIBRARY_NAME}")
-      set (3RDPARTY_${LIBNAME}_LIBRARY_VERSION "${${LIBNAME}_LIBRARY_VERSION}")
-    else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
-      message (STATUS "Info: ${LIBNAME} version isn't found")
+    if (NOT 3RDPARTY_TCL_DLL OR NOT EXISTS "${3RDPARTY_TCL_DLL}")
+      set (3RDPARTY_TCL_DLL "" CACHE FILEPATH "TCL shared library" FORCE)
     endif()
   endif()
-
-  set (3RDPARTY_${LIBNAME}_LIBRARY_VERSION_WITH_DOT "")
-  if (3RDPARTY_${LIBNAME}_LIBRARY_VERSION)
-    string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_${LIBNAME}_MAJOR_VERSION "${3RDPARTY_${LIBNAME}_LIBRARY_VERSION}")
-    string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_${LIBNAME}_MINOR_VERSION "${3RDPARTY_${LIBNAME}_LIBRARY_VERSION}")
-    set (3RDPARTY_${LIBNAME}_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_${LIBNAME}_MAJOR_VERSION}.${3RDPARTY_${LIBNAME}_MINOR_VERSION}")
+  if (NOT 3RDPARTY_TCL_DLL_DIR AND 3RDPARTY_TCL_DLL)
+    get_filename_component (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
+    set (3RDPARTY_TCL_DLL_DIR "${3RDPARTY_TCL_DLL_DIR}" CACHE FILEPATH "The directory containing TCL shared library" FORCE)
   endif()
+endif()
 
-  if (WIN32)
-    if (NOT 3RDPARTY_${LIBNAME}_DLL)
-        set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
-
-        set (DLL_FOLDER_FOR_SEARCH "")
-        if (3RDPARTY_${LIBNAME}_DLL_DIR)
-          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_${LIBNAME}_DLL_DIR}")
-        elseif (3RDPARTY_TCL_DIR)
-          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TCL_DIR}/bin")
-        else()
-          get_filename_component (3RDPARTY_${LIBNAME}_LIBRARY_DIR_PARENT "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" PATH)
-          set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR_PARENT}/bin")
-        endif()
-
-        set (3RDPARTY_${LIBNAME}_DLL "3RDPARTY_${LIBNAME}_DLL-NOTFOUND" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
-        find_library (3RDPARTY_${LIBNAME}_DLL NAMES ${LIBNAME_L}${3RDPARTY_${LIBNAME}_LIBRARY_VERSION}
-                                              PATHS "${DLL_FOLDER_FOR_SEARCH}"
-                                              NO_DEFAULT_PATH)
-
-        if (NOT 3RDPARTY_${LIBNAME}_DLL OR NOT EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
-          set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
-        endif()
-
-        if (NOT 3RDPARTY_${LIBNAME}_DLL_DIR AND 3RDPARTY_${LIBNAME}_DLL)
-          get_filename_component (3RDPARTY_${LIBNAME}_DLL_DIR "${3RDPARTY_${LIBNAME}_DLL}" PATH)
-          set (3RDPARTY_${LIBNAME}_DLL_DIR "${3RDPARTY_${LIBNAME}_DLL_DIR}" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
-        endif()
-    endif()
-  endif()
+# include found paths to common variables
+if (3RDPARTY_TCL_INCLUDE_DIR AND EXISTS "${3RDPARTY_TCL_INCLUDE_DIR}")
+  list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TCL_INCLUDE_DIR}")
+else()
+  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_INCLUDE_DIR)
+endif()
 
-  # include found paths to common variables
-  if (3RDPARTY_${LIBNAME}_INCLUDE_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
-    list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
-  else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${LIBNAME}_INCLUDE_DIR)
-  endif()
+if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
+  list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
+else()
+  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_LIBRARY_DIR})
+endif()
 
-  if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
-    list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
+if (WIN32)
+  if (3RDPARTY_TCL_DLL OR EXISTS "${3RDPARTY_TCL_DLL}")
+    list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TCL_DLL_DIR}")
   else()
-    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${LIBNAME}_LIBRARY_DIR})
-  endif()
-
-  if (WIN32)
-    if (3RDPARTY_${LIBNAME}_DLL OR EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
-      list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
-    else()
-      list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${LIBNAME}_DLL_DIR)
-    endif()
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TCL_DLL_DIR)
   endif()
-endforeach()
+endif()
 
-# install tcltk
+# install tcl
 if (INSTALL_TCL)
   # include occt macros. compiler_bitness, os_wiht_bit, compiler
   OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
@@ -306,16 +201,15 @@ if (INSTALL_TCL)
   if (WIN32)
     # tcl 8.6 requires zlib. install all dlls from tcl bin folder that may contain zlib also
 
-    # collect and install all dlls from tcl/tk dll dirs
+    # collect and install all dlls from tcl dll dirs
     file (GLOB TCL_DLLS "${3RDPARTY_TCL_DLL_DIR}/*.dll")
-    file (GLOB TK_DLLS  "${3RDPARTY_TK_DLL_DIR}/*.dll")
-    install (FILES ${TCL_DLLS} ${TK_DLLS}
+    install (FILES ${TCL_DLLS}
              CONFIGURATIONS Release
              DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
-    install (FILES ${TCL_DLLS} ${TK_DLLS}
+    install (FILES ${TCL_DLLS}
              CONFIGURATIONS RelWithDebInfo
              DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
-    install (FILES ${TCL_DLLS} ${TK_DLLS}
+    install (FILES ${TCL_DLLS}
              CONFIGURATIONS Debug
              DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
   else()
@@ -329,26 +223,14 @@ if (INSTALL_TCL)
     install (FILES ${3RDPARTY_TCL_LIBRARY_REALPATH}
              CONFIGURATIONS Debug
              DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
-
-    get_filename_component(3RDPARTY_TK_LIBRARY_REALPATH ${3RDPARTY_TK_LIBRARY} REALPATH)
-    install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
-             CONFIGURATIONS Release
-             DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
-    install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
-             CONFIGURATIONS RelWithDebInfo
-             DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/libi")
-    install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
-             CONFIGURATIONS Debug
-             DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
   endif()
 
   if (TCL_TCLSH_VERSION)
     # tcl is required to install in lib folder (without)
     install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8"                    DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
     install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
-    install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tk${TCL_TCLSH_VERSION}"  DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
   else()
-    message (STATUS "\nWarning: tclX.X and tkX.X subdirs won't be copyied during the installation process.")
+    message (STATUS "\nWarning: tclX.X subdir won't be copyied during the installation process.")
     message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
   endif()
 
@@ -362,7 +244,15 @@ else()
   endif()
 endif()
 
-mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TK_LIBRARY 3RDPARTY_TCL_DLL 3RDPARTY_TK_DLL)
+mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TCL_DLL)
+
+if (TK_FOUND AND 3RDPARTY_TCL_DIR)
+  get_filename_component (3RDPARTY_TK_WISH_DIR "${TK_WISH}" PATH)
+  get_filename_component (3RDPARTY_TK_WISH_DIR_PARENT "${3RDPARTY_TK_WISH_DIR}" PATH)
+  if ("${3RDPARTY_TK_WISH_DIR_PARENT}" STREQUAL "${3RDPARTY_TCL_DIR}")
+    set (3RDPARTY_TCLTK_DIR "${3RDPARTY_TCL_DIR}")
+  endif()
+endif()
 
 # unset all redundant variables
 #TCL
diff --git a/adm/cmake/tk.cmake b/adm/cmake/tk.cmake
new file mode 100644 (file)
index 0000000..3fb67e6
--- /dev/null
@@ -0,0 +1,260 @@
+# tk
+
+if (NOT DEFINED INSTALL_TK)
+  set (INSTALL_TK OFF CACHE BOOL "${INSTALL_TK_DESCR}")
+endif()
+
+# tk directory
+if (NOT DEFINED 3RDPARTY_TK_DIR)
+  set (3RDPARTY_TK_DIR "" CACHE PATH "The directory containing tk")
+endif ()
+
+if (NOT 3RDPARTY_TK_DIR AND 3RDPARTY_TCLTK_DIR)
+  set (3RDPARTY_TK_DIR "${3RDPARTY_TCLTK_DIR}" CACHE PATH "The directory containing tk" FORCE)
+endif()
+
+# tk include directory
+if (NOT DEFINED 3RDPARTY_TK_INCLUDE_DIR)
+  set (3RDPARTY_TK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tk")
+endif()
+
+# tk library file (with absolute path)
+if (NOT DEFINED 3RDPARTY_TK_LIBRARY OR NOT 3RDPARTY_TK_LIBRARY_DIR)
+  set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "tk library" FORCE)
+endif()
+
+# tk library directory
+if (NOT DEFINED 3RDPARTY_TK_LIBRARY_DIR)
+  set (3RDPARTY_TK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing tk library")
+endif()
+
+# tk shared library (with absolute path)
+if (WIN32)
+  if (NOT DEFINED 3RDPARTY_TK_DLL OR NOT 3RDPARTY_TK_DLL_DIR)
+    set (3RDPARTY_TK_DLL "" CACHE FILEPATH "tk shared library" FORCE)
+  endif()
+endif()
+
+# tk shared library directory
+if (WIN32 AND NOT DEFINED 3RDPARTY_TK_DLL_DIR)
+  set (3RDPARTY_TK_DLL_DIR "" CACHE FILEPATH "The directory containing tk shared library")
+endif()
+
+# search for tk in user defined directory
+if (NOT 3RDPARTY_TK_DIR AND 3RDPARTY_DIR)
+  FIND_PRODUCT_DIR("${3RDPARTY_DIR}" tk TK_DIR_NAME)
+  if (TK_DIR_NAME)
+    set (3RDPARTY_TK_DIR "${3RDPARTY_DIR}/${TK_DIR_NAME}" CACHE PATH "The directory containing tk" FORCE)
+  endif()
+endif()
+
+# define paths for default engine
+if (3RDPARTY_TK_DIR AND EXISTS "${3RDPARTY_TK_DIR}")
+  set (TK_INCLUDE_PATH "${3RDPARTY_TK_DIR}/include")
+endif()
+
+# check tk include dir, library dir and shared library dir
+COMPLIANCE_PRODUCT_CONSISTENCY(TK)
+
+# use default (CMake) TCL search
+find_package(TCL)
+
+# tk include dir
+if (NOT 3RDPARTY_TK_INCLUDE_DIR)
+  if (TK_INCLUDE_PATH AND EXISTS "${TK_INCLUDE_PATH}")
+    set (3RDPARTY_TK_INCLUDE_DIR "${TK_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of TK" FORCE)
+  endif()
+endif()
+
+# tk dir and library
+if (NOT 3RDPARTY_TK_LIBRARY)
+  if (TK_LIBRARY AND EXISTS "${TK_LIBRARY}")
+    set (3RDPARTY_TK_LIBRARY "${TK_LIBRARY}" CACHE FILEPATH "TK library" FORCE)
+
+    if (NOT 3RDPARTY_TK_LIBRARY_DIR)
+      get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
+      set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
+    endif()
+  endif()
+endif()
+
+
+if (WIN32)
+  if (NOT 3RDPARTY_TK_DLL)
+      set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+
+      set (DLL_FOLDER_FOR_SEARCH "")
+      if (3RDPARTY_TK_DLL_DIR)
+        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DLL_DIR}")
+      elseif (3RDPARTY_TK_DIR)
+        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DIR}/bin")
+      elseif (3RDPARTY_TK_LIBRARY_DIR)
+        get_filename_component (3RDPARTY_TK_LIBRARY_DIR_PARENT "${3RDPARTY_TK_LIBRARY_DIR}" PATH)
+        set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_LIBRARY_DIR_PARENT}/bin")
+      endif()
+
+      set (3RDPARTY_TK_DLL "3RDPARTY_TK_DLL-NOTFOUND" CACHE FILEPATH "TK shared library" FORCE)
+      find_library (3RDPARTY_TK_DLL NAMES tk86 tk85
+                                            PATHS "${DLL_FOLDER_FOR_SEARCH}"
+                                            NO_DEFAULT_PATH)
+  endif()
+endif()
+
+COMPLIANCE_PRODUCT_CONSISTENCY(TK)
+
+# tk dir and library
+if (NOT 3RDPARTY_TK_LIBRARY)
+  set (3RDPARTY_TK_LIBRARY "3RDPARTY_TK_LIBRARY-NOTFOUND" CACHE FILEPATH "TK library" FORCE)
+  find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
+                                            PATHS "${3RDPARTY_TK_LIBRARY_DIR}"
+                                            NO_DEFAULT_PATH)
+
+  # search in another place if previous search doesn't find anything
+  find_library (3RDPARTY_TK_LIBRARY NAMES tk8.6 tk86 tk8.5 tk85
+                                            PATHS "${3RDPARTY_TK_DIR}/lib"
+                                            NO_DEFAULT_PATH)
+
+
+  if (NOT 3RDPARTY_TK_LIBRARY OR NOT EXISTS "${3RDPARTY_TK_LIBRARY}")
+    set (3RDPARTY_TK_LIBRARY "" CACHE FILEPATH "TK library" FORCE)
+  endif()
+
+  if (NOT 3RDPARTY_TK_LIBRARY_DIR AND 3RDPARTY_TK_LIBRARY)
+    get_filename_component (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY}" PATH)
+    set (3RDPARTY_TK_LIBRARY_DIR "${3RDPARTY_TK_LIBRARY_DIR}" CACHE FILEPATH "The directory containing TK library" FORCE)
+  endif()
+endif()
+
+set (3RDPARTY_TK_LIBRARY_VERSION "")
+if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
+  get_filename_component (TK_LIBRARY_NAME "${3RDPARTY_TK_LIBRARY}" NAME)
+  string(REGEX REPLACE "^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY_NAME}")
+
+  if (NOT "${TK_LIBRARY_VERSION}" STREQUAL "${TK_LIBRARY_NAME}")
+    set (3RDPARTY_TK_LIBRARY_VERSION "${TK_LIBRARY_VERSION}")
+  else() # if the version isn't found - seek other library with 8.6 or 8.5 version in the same dir
+    message (STATUS "Info: TK version isn't found")
+  endif()
+endif()
+
+set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "")
+if (3RDPARTY_TK_LIBRARY_VERSION)
+  string (REGEX REPLACE "^.*([0-9])[^0-9]*[0-9].*$" "\\1" 3RDPARTY_TK_MAJOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
+  string (REGEX REPLACE "^.*[0-9][^0-9]*([0-9]).*$" "\\1" 3RDPARTY_TK_MINOR_VERSION "${3RDPARTY_TK_LIBRARY_VERSION}")
+  set (3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT "${3RDPARTY_TK_MAJOR_VERSION}.${3RDPARTY_TK_MINOR_VERSION}")
+endif()
+
+if (WIN32)
+  if (NOT 3RDPARTY_TK_DLL)
+    set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+
+    set (DLL_FOLDER_FOR_SEARCH "")
+    if (3RDPARTY_TK_DLL_DIR)
+      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DLL_DIR}")
+    elseif (3RDPARTY_TK_DIR)
+      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_DIR}/bin")
+    else()
+      get_filename_component (3RDPARTY_TK_LIBRARY_DIR_PARENT "${3RDPARTY_TK_LIBRARY_DIR}" PATH)
+      set (DLL_FOLDER_FOR_SEARCH "${3RDPARTY_TK_LIBRARY_DIR_PARENT}/bin")
+    endif()
+
+    set (3RDPARTY_TK_DLL "3RDPARTY_TK_DLL-NOTFOUND" CACHE FILEPATH "TK shared library" FORCE)
+    find_library (3RDPARTY_TK_DLL NAMES tk${3RDPARTY_TK_LIBRARY_VERSION}
+                                          PATHS "${DLL_FOLDER_FOR_SEARCH}"
+                                          NO_DEFAULT_PATH)
+
+    if (NOT 3RDPARTY_TK_DLL OR NOT EXISTS "${3RDPARTY_TK_DLL}")
+      set (3RDPARTY_TK_DLL "" CACHE FILEPATH "TK shared library" FORCE)
+    endif()
+  endif()
+  if (NOT 3RDPARTY_TK_DLL_DIR AND 3RDPARTY_TK_DLL)
+    get_filename_component (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL}" PATH)
+    set (3RDPARTY_TK_DLL_DIR "${3RDPARTY_TK_DLL_DIR}" CACHE FILEPATH "The directory containing TK shared library" FORCE)
+  endif()
+endif()
+
+# include found paths to common variables
+if (3RDPARTY_TK_INCLUDE_DIR AND EXISTS "${3RDPARTY_TK_INCLUDE_DIR}")
+  list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TK_INCLUDE_DIR}")
+else()
+  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_INCLUDE_DIR)
+endif()
+
+if (3RDPARTY_TK_LIBRARY AND EXISTS "${3RDPARTY_TK_LIBRARY}")
+  list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TK_LIBRARY_DIR}")
+else()
+  list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_LIBRARY_DIR})
+endif()
+
+if (WIN32)
+  if (3RDPARTY_TK_DLL OR EXISTS "${3RDPARTY_TK_DLL}")
+    list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_TK_DLL_DIR}")
+  else()
+    list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TK_DLL_DIR)
+  endif()
+endif()
+
+# install tk
+if (INSTALL_TK)
+  # include occt macros. compiler_bitness, os_wiht_bit, compiler
+  OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
+
+  OCCT_MAKE_OS_WITH_BITNESS()
+  OCCT_MAKE_COMPILER_SHORT_NAME()
+
+  if (WIN32)
+    # tk 8.6 requires zlib. install all dlls from tk bin folder that may contain zlib also
+
+    # collect and install all dlls from tk dll dirs
+    file (GLOB TK_DLLS  "${3RDPARTY_TK_DLL_DIR}/*.dll")
+    install (FILES ${TK_DLLS}
+             CONFIGURATIONS Release
+             DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
+    install (FILES ${TK_DLLS}
+             CONFIGURATIONS RelWithDebInfo
+             DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
+    install (FILES ${TK_DLLS}
+             CONFIGURATIONS Debug
+             DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
+  else()
+    get_filename_component(3RDPARTY_TK_LIBRARY_REALPATH ${3RDPARTY_TK_LIBRARY} REALPATH)
+    install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
+             CONFIGURATIONS Release
+             DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
+    install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
+             CONFIGURATIONS RelWithDebInfo
+             DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/libi")
+    install (FILES ${3RDPARTY_TK_LIBRARY_REALPATH}
+             CONFIGURATIONS Debug
+             DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
+  endif()
+
+  if (TCL_TCLSH_VERSION)
+    # tk is required to install in lib folder (without)
+    install (DIRECTORY "${3RDPARTY_TK_LIBRARY_DIR}/tk${TCL_TCLSH_VERSION}"  DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
+  else()
+    message (STATUS "\nWarning: tkX.X subdir won't be copyied during the installation process.")
+    message (STATUS "Try seeking tk within another folder by changing 3RDPARTY_TK_DIR variable.")
+  endif()
+
+  set (USED_3RDPARTY_TK_DIR "")
+else()
+  # the library directory for using by the executable
+  if (WIN32)
+    set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_DLL_DIR})
+  else()
+    set (USED_3RDPARTY_TK_DIR ${3RDPARTY_TK_LIBRARY_DIR})
+  endif()
+endif()
+
+mark_as_advanced (3RDPARTY_TK_LIBRARY 3RDPARTY_TK_DLL)
+
+# unset all redundant variables
+#TCL
+OCCT_CHECK_AND_UNSET (TCL_LIBRARY)
+OCCT_CHECK_AND_UNSET (TCL_INCLUDE_PATH)
+OCCT_CHECK_AND_UNSET (TCL_TCLSH)
+#TK
+OCCT_CHECK_AND_UNSET (TK_LIBRARY)
+OCCT_CHECK_AND_UNSET (TK_INCLUDE_PATH)
+OCCT_CHECK_AND_UNSET (TK_WISH)
index 6ee1dc3..8e29c01 100644 (file)
@@ -43,6 +43,7 @@ INSTALL_MESSAGE (INSTALL_FREETYPE         "FreeType binaries")
 INSTALL_MESSAGE (INSTALL_GL2PS            "GL2PS binaries")
 INSTALL_MESSAGE (INSTALL_TBB              "TBB binaries")
 INSTALL_MESSAGE (INSTALL_TCL              "TCL binaries")
+INSTALL_MESSAGE (INSTALL_TK               "TK binaries")
 INSTALL_MESSAGE (INSTALL_VTK              "VTK binaries ")
 
 # build variables
index 127a43a..4fd1c72 100644 (file)
@@ -3,6 +3,7 @@ echo off
 if "%VCVER%" == "@COMPILER@" (
   if "%ARCH%" == "@COMPILER_BITNESS@" (
     set "TCL_DIR=@3RDPARTY_TCL_DLL_DIR@"
+    set "TK_DIR=@3RDPARTY_TK_DLL_DIR@"
     set "FREETYPE_DIR=@3RDPARTY_FREETYPE_DLL_DIR@"
     set "FREEIMAGE_DIR=@3RDPARTY_FREEIMAGE_DLL_DIR@"
     set "FREEIMAGEPLUS_DIR=@3RDPARTY_FREEIMAGEPLUS_DLL_DIR@"
index fbc1323..e635d53 100644 (file)
@@ -3,6 +3,7 @@
 if [ "$COMPILER" == "@COMPILER@" ]; then
   if [ "$ARCH" == "@COMPILER_BITNESS@" ]; then
     export TCL_DIR="@3RDPARTY_TCL_LIBRARY_DIR@"
+    export TK_DIR="@3RDPARTY_TK_LIBRARY_DIR@"
     export FREETYPE_DIR="@3RDPARTY_FREETYPE_LIBRARY_DIR@"
     export FREEIMAGE_DIR="@3RDPARTY_FREEIMAGE_LIBRARY_DIR@"
     export GL2PS_DIR="@3RDPARTY_GL2PS_LIBRARY_DIR@"
index 084de68..1d05432 100644 (file)
@@ -3,6 +3,7 @@ echo off
 if "%VCVER%" == "@COMPILER@" (
   if "%ARCH%" == "@COMPILER_BITNESS@" (
     set "TCL_DIR=@USED_3RDPARTY_TCL_DIR@"
+    set "TK_DIR=@USED_3RDPARTY_TK_DIR@"
     set "FREETYPE_DIR=@USED_3RDPARTY_FREETYPE_DIR@"
     set "FREEIMAGE_DIR=@USED_3RDPARTY_FREEIMAGE_DIR@"
     set "FREEIMAGEPLUS_DIR=@USED_3RDPARTY_FREEIMAGEPLUS_DIR@"
index d9231bc..5c0aa7f 100644 (file)
@@ -3,6 +3,7 @@
 if [ "$COMPILER" == "@COMPILER@" ]; then
   if [ "$ARCH" == "@COMPILER_BITNESS@" ]; then
     export TCL_DIR="@USED_3RDPARTY_TCL_DIR@"
+    export TK_DIR="@USED_3RDPARTY_TK_DIR@"
     export FREETYPE_DIR="@USED_3RDPARTY_FREETYPE_DIR@"
     export FREEIMAGE_DIR="@USED_3RDPARTY_FREEIMAGE_DIR@"
     export GL2PS_DIR="@USED_3RDPARTY_GL2PS_DIR@"
index 04fa2c8..ef3ead2 100644 (file)
@@ -28,6 +28,7 @@ set "PRODROOT="
 set "ORIGIN_PATH=%PATH%"
 
 if not ["%TCL_DIR%"] == [""]           set "PATH=%TCL_DIR%;%PATH%"
+if not ["%TK_DIR%"] == [""]            set "PATH=%TK_DIR%;%PATH%"
 if not ["%FREETYPE_DIR%"] == [""]      set "PATH=%FREETYPE_DIR%;%PATH%"
 if not ["%FREEIMAGE_DIR%"] == [""]     set "PATH=%FREEIMAGE_DIR%;%PATH%"
 if not ["%FREEIMAGEPLUS_DIR%"] == [""] set "PATH=%FREEIMAGEPLUS_DIR%;%PATH%"
@@ -38,6 +39,10 @@ if not ["%VTK_DIR%"] == [""]           set "PATH=%VTK_DIR%;%PATH%"
 rem ----- Set path to 3rd party and OCCT libraries -----
 set "BIN_TAIL=win%ARCH%/%VCVER%/bin%CASDEB%"
 set "PATH=@CMAKE_BINARY_DIR@/%BIN_TAIL%;%PATH%"
+if not ["%TK_DIR%"] == ["%TCL_DIR%"] (
+  if not ["%TK_DIR%"] == [""]  set "TK_LIBRARY=%TK_DIR%/../lib/tk@3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT@"
+  if not ["%TCL_DIR%"] == [""] set "TCL_LIBRARY=%TCL_DIR%/../lib/tcl@3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT@"
+)
 
 rem ----- Set envoronment variables used by OCCT -----
 set  CSF_LANGUAGE=us
index 89da909..bae619b 100644 (file)
@@ -45,6 +45,10 @@ if [ "$TCL_DIR" != "" ]; then
   THRDPARTY_PATH="${TCL_DIR}:${THRDPARTY_PATH}"
 fi
 
+if [ "$TK_DIR" != "" ]; then
+  THRDPARTY_PATH="${TK_DIR}:${THRDPARTY_PATH}"
+fi
+
 if [ "$FREETYPE_DIR" != "" ]; then
   THRDPARTY_PATH="${FREETYPE_DIR}:${THRDPARTY_PATH}"
 fi
@@ -65,6 +69,15 @@ if [ "$VTK_DIR" != "" ]; then
   THRDPARTY_PATH="${VTK_DIR}:${THRDPARTY_PATH}"
 fi
 
+if [ "$TK_DIR" != "$TCL_DIR" ]; then
+  if [ "$TK_DIR" != "" ]; then
+    export TK_LIBRARY="${TK_DIR}/../lib/tk@3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT@"
+  fi
+  if [ "$TCL_DIR" != "" ]; then
+    export TCL_LIBRARY="${TCL_DIR}/../lib/tcl@3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT@"
+  fi
+fi
+
 BIN_PATH="${WOKSTATION}${ARCH}/${COMPILER}/bin${CASDEB}"
 LIBS_PATH="${WOKSTATION}${ARCH}/${COMPILER}/lib${CASDEB}"
 
index 4358137..4cf0332 100644 (file)
@@ -26,6 +26,7 @@ set "PRODROOT="
 set "ORIGIN_PATH=%PATH%"
 
 if not ["%TCL_DIR%"] == [""]           set "PATH=%TCL_DIR%;%PATH%"
+if not ["%TK_DIR%"] == [""]            set "PATH=%TK_DIR%;%PATH%"
 if not ["%FREETYPE_DIR%"] == [""]      set "PATH=%FREETYPE_DIR%;%PATH%"
 if not ["%FREEIMAGE_DIR%"] == [""]     set "PATH=%FREEIMAGE_DIR%;%PATH%"
 if not ["%FREEIMAGEPLUS_DIR%"] == [""] set "PATH=%FREEIMAGEPLUS_DIR%;%PATH%"
@@ -36,6 +37,10 @@ if not ["%VTK_DIR%"] == [""]           set "PATH=%VTK_DIR%;%PATH%"
 rem ----- Set path to 3rd party and OCCT libraries -----
 set "BIN_TAIL=win%ARCH%/%VCVER%/bin%CASDEB%"
 set "PATH=%CASROOT%/%BIN_TAIL%;%PATH%"
+if not ["%TK_DIR%"] == ["%TCL_DIR%"] (
+  if not ["%TK_DIR%"] == [""]  set "TK_LIBRARY=%TK_DIR%/../lib/tk@3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT@"
+  if not ["%TCL_DIR%"] == [""] set "TCL_LIBRARY=%TCL_DIR%/../lib/tcl@3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT@"
+)
 
 rem ----- Set envoronment variables used by OCCT -----
 set  CSF_LANGUAGE=us
index 200b7d2..07eb2d2 100644 (file)
@@ -43,6 +43,10 @@ if [ "$TCL_DIR" != "" ]; then
   THRDPARTY_PATH="${TCL_DIR}:${THRDPARTY_PATH}"
 fi
 
+if [ "$TK_DIR" != "" ]; then
+  THRDPARTY_PATH="${TK_DIR}:${THRDPARTY_PATH}"
+fi
+
 if [ "$FREETYPE_DIR" != "" ]; then
   THRDPARTY_PATH="${FREETYPE_DIR}:${THRDPARTY_PATH}"
 fi
@@ -63,6 +67,15 @@ if [ "$VTK_DIR" != "" ]; then
   THRDPARTY_PATH="${VTK_DIR}:${THRDPARTY_PATH}"
 fi
 
+if [ "$TK_DIR" != "$TCL_DIR" ]; then
+  if [ "$TK_DIR" != "" ]; then
+    export TK_LIBRARY="${TK_DIR}/../lib/tk@3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT@"
+  fi
+  if [ "$TCL_DIR" != "" ]; then
+    export TCL_LIBRARY="${TCL_DIR}/../lib/tcl@3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT@"
+  fi
+fi
+
 BIN_PATH="${WOKSTATION}${ARCH}/${COMPILER}/bin${CASDEB}"
 LIBS_PATH="${WOKSTATION}${ARCH}/${COMPILER}/lib${CASDEB}"
 
index 291b73c..f7052ff 100644 (file)
@@ -772,7 +772,7 @@ void OpenGl_Context::ResetErrors (const bool theToPrintErrors)
     }
 
     const TCollection_ExtendedString aMsg = TCollection_ExtendedString ("Unhandled GL error: ") + anErrId;
-    PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB, GL_DEBUG_TYPE_OTHER_ARB, 0, GL_DEBUG_SEVERITY_LOW, aMsg);
+    PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 0, GL_DEBUG_SEVERITY_LOW, aMsg);
   }
 }
 
index 4813aa7..7a84bb8 100644 (file)
@@ -1599,10 +1599,10 @@ void OpenGl_View::drawStereoPair (OpenGl_FrameBuffer* theDrawFbo)
     if (!myOpenGlFBO ->InitLazy (aCtx, aPair[0]->GetVPSizeX(), aPair[0]->GetVPSizeY(), myFboColorFormat, myFboDepthFormat, 0)
      || !myOpenGlFBO2->InitLazy (aCtx, aPair[0]->GetVPSizeX(), aPair[0]->GetVPSizeY(), myFboColorFormat, 0, 0))
     {
-      aCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION_ARB,
-                         GL_DEBUG_TYPE_ERROR_ARB,
+      aCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
+                         GL_DEBUG_TYPE_ERROR,
                          0,
-                         GL_DEBUG_SEVERITY_HIGH_ARB,
+                         GL_DEBUG_SEVERITY_HIGH,
                          "Error! Unable to allocate FBO for blitting stereo pair");
       bindDefaultFbo (theDrawFbo);
       return;