Revision: 77876
          http://sourceforge.net/p/brlcad/code/77876
Author:   starseeker
Date:     2020-12-02 19:35:30 +0000 (Wed, 02 Dec 2020)
Log Message:
-----------
Get a bit more sophisticated about the Tcl package lookup.  Just having Itcl 
isn't enough by itself - it would be for MGED/Archer, but we may also need to 
build Itk against the system Itcl install.  For that we need find_package(ITCL) 
to succeed.  (On Ubuntu, it's the difference between having itcl3 installed and 
also having itcl3-dev installed.)

Modified Paths:
--------------
    brlcad/branches/extbuild/CMakeLists.txt
    brlcad/branches/extbuild/src/libtclcad/auto_path.c
    brlcad/branches/extbuild/src/other/ext/CMakeLists.txt
    brlcad/branches/extbuild/src/other/ext/itcl.cmake
    brlcad/branches/extbuild/src/other/ext/itk.cmake
    brlcad/branches/extbuild/src/other/ext/iwidgets.cmake

Added Paths:
-----------
    brlcad/branches/extbuild/src/other/ext/CMake/FindITCL.cmake

Modified: brlcad/branches/extbuild/CMakeLists.txt
===================================================================
--- brlcad/branches/extbuild/CMakeLists.txt     2020-12-02 18:26:57 UTC (rev 
77875)
+++ brlcad/branches/extbuild/CMakeLists.txt     2020-12-02 19:35:30 UTC (rev 
77876)
@@ -1950,15 +1950,18 @@
 # Now put back the BRL-CAD flags
 RESTORE_CACHED_BUILD_FLAGS(_BRLCAD)
 
-set(TCL_VERSION "8.6")
-CONFIG_H_APPEND(BRLCAD "#define TCL_VERSION \"${TCL_VERSION}\"\n")
+# Define some Tcl related variables for libtclcad
+if(BRLCAD_ITCL_BUILD)
+  CONFIG_H_APPEND(BRLCAD "#cmakedefine ITCL_VERSION \"${ITCL_VERSION}\"\n")
+endif(BRLCAD_ITCL_BUILD)
+if(BRLCAD_ITK_BUILD)
+  CONFIG_H_APPEND(BRLCAD "#cmakedefine ITK_VERSION \"${ITK_VERSION}\"\n")
+endif(BRLCAD_ITK_BUILD)
+if(DEFINED IWIDGETS_VERSION)
+  set(IWIDGETS_VERSION "4.1.1")
+  CONFIG_H_APPEND(BRLCAD "#cmakedefine IWIDGETS_VERSION 
\"${IWIDGETS_VERSION}\"\n")
+endif(DEFINED IWIDGETS_VERSION)
 
-set(ITCL_VERSION "3.4")
-CONFIG_H_APPEND(BRLCAD "#cmakedefine ITCL_VERSION \"${ITCL_VERSION}\"\n")
-
-set(IWIDGETS_VERSION "4.1.1")
-CONFIG_H_APPEND(BRLCAD "#cmakedefine IWIDGETS_VERSION 
\"${IWIDGETS_VERSION}\"\n")
-
 if(BRLCAD_PRINT_MSGS)
   message("***********************************************************")
   message("*        Stage 9 of 9 - Output and Summarize Config       *")

Modified: brlcad/branches/extbuild/src/libtclcad/auto_path.c
===================================================================
--- brlcad/branches/extbuild/src/libtclcad/auto_path.c  2020-12-02 18:26:57 UTC 
(rev 77875)
+++ brlcad/branches/extbuild/src/libtclcad/auto_path.c  2020-12-02 19:35:30 UTC 
(rev 77876)
@@ -149,9 +149,11 @@
        p = bu_strdup(bu_vls_cstr(&buffer));
        bu_ptbl_ins(&lib_subpaths, (long *)p);
 
+#ifdef ITCL_VERSION
        bu_vls_sprintf(&buffer, "itcl%s", ITCL_VERSION);
        p = bu_strdup(bu_vls_cstr(&buffer));
        bu_ptbl_ins(&lib_subpaths, (long *)p);
+#endif
 
 #ifdef HAVE_TK
        bu_vls_sprintf(&buffer, "tk%s", TK_VERSION);
@@ -158,7 +160,7 @@
        p = bu_strdup(bu_vls_cstr(&buffer));
        bu_ptbl_ins(&lib_subpaths, (long *)p);
 
-       bu_vls_sprintf(&buffer, "itk%s", ITCL_VERSION);
+       bu_vls_sprintf(&buffer, "itk%s", ITK_VERSION);
        p = bu_strdup(bu_vls_cstr(&buffer));
        bu_ptbl_ins(&lib_subpaths, (long *)p);
 

Added: brlcad/branches/extbuild/src/other/ext/CMake/FindITCL.cmake
===================================================================
--- brlcad/branches/extbuild/src/other/ext/CMake/FindITCL.cmake                 
        (rev 0)
+++ brlcad/branches/extbuild/src/other/ext/CMake/FindITCL.cmake 2020-12-02 
19:35:30 UTC (rev 77876)
@@ -0,0 +1,115 @@
+# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindTCL
+-------
+
+This module finds if Tcl is installed and determines where the include
+files and libraries are.  It also determines what the name of the
+library is.  This code sets the following variables:
+
+::
+
+ITCL_FOUND              = Tcl was found
+ITCL_LIBRARY            = path to Tcl library (tcl tcl80)
+ITCL_INCLUDE_PATH       = path to where tcl.h can be found
+ITCL_STUB_LIBRARY       = path to Tcl stub library
+
+#]=======================================================================]
+
+include(CMakeFindFrameworks)
+
+set(_ITCL_SEARCHES)
+
+# Search ITCL_ROOT first if it is set.
+if(ITCL_ROOT)
+  set(_ITCL_SEARCH_ROOT PATHS ${ITCL_ROOT} NO_DEFAULT_PATH)
+  list(APPEND _ITCL_SEARCHES _ITCL_SEARCH_ROOT)
+endif()
+
+set(ITCL_POSSIBLE_LIB_PATH_SUFFIXES
+  lib
+  lib/itcl
+  lib/itcl3.4
+  )
+
+set(ITCL_POSSIBLE_LIB_NAMES
+  itcl
+  itcl3
+  itcl3.4
+  )
+
+if(NOT ITCL_LIBRARY)
+  foreach(search ${_ITCL_SEARCHES})
+    find_library(ITCL_LIBRARY
+      NAMES ${ITCL_POSSIBLE_LIB_NAMES}
+      NAMES_PER_DIR ${${search}}
+      PATH_SUFFIXES ${ITCL_POSSIBLE_LIB_PATH_SUFFIXES})
+  endforeach()
+endif()
+if(NOT ITCL_LIBRARY)
+  find_library(ITCL_LIBRARY
+    NAMES ${ITCL_POSSIBLE_LIB_NAMES}
+    PATH_SUFFIXES ${ITCL_POSSIBLE_LIB_PATH_SUFFIXES}
+    )
+endif(NOT ITCL_LIBRARY)
+
+set(ITCLSTUB_POSSIBLE_LIB_NAMES
+  itclstub
+  itclstub3
+  itclstub3.4
+  )
+if(NOT ITCL_STUB_LIBRARY)
+  foreach(search ${_ITCL_SEARCHES})
+    find_library(ITCL_STUB_LIBRARY
+      NAMES ${ITCLSTUB_POSSIBLE_LIB_NAMES}
+      NAMES_PER_DIR ${${search}}
+      PATH_SUFFIXES ${ITCL_POSSIBLE_LIB_PATH_SUFFIXES}
+      )
+  endforeach()
+endif()
+if(NOT ITCL_STUB_LIBRARY)
+  find_library(ITCL_STUB_LIBRARY
+    NAMES ${ITCLSTUB_POSSIBLE_LIB_NAMES}
+    )
+endif()
+
+set(ITCL_POSSIBLE_INCLUDE_PATH_SUFFIXES
+  include
+  include/itcl
+  include/itcl3
+  include/itcl3.4
+  )
+
+foreach(search ${_ITCL_SEARCHES})
+  find_path(ITCL_INCLUDE_PATH
+    NAMES itcl.h ${${search}}
+    PATH_SUFFIXES ${ITCL_POSSIBLE_INCLUDE_PATH_SUFFIXES}
+    )
+endforeach()
+if (NOT ITCL_INCLUDE_PATH)
+  find_path(ITCL_INCLUDE_PATH
+    NAMES itcl.h
+    HINTS ${ITCL_POSSIBLE_INCLUDE_PATHS}
+    )
+endif()
+
+include(FindPackageHandleStandardArgs)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ITCL
+  REQUIRED_VARS ITCL_LIBRARY ITCL_STUB_LIBRARY ITCL_INCLUDE_PATH
+  )
+
+mark_as_advanced(
+  ITCL_INCLUDE_PATH
+  ITCL_LIBRARY
+  ITCL_STUB_LIBRARY
+  )
+
+# Local Variables:
+# tab-width: 8
+# mode: cmake
+# indent-tabs-mode: t
+# End:
+# ex: shiftwidth=2 tabstop=8


Property changes on: brlcad/branches/extbuild/src/other/ext/CMake/FindITCL.cmake
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: brlcad/branches/extbuild/src/other/ext/CMakeLists.txt
===================================================================
--- brlcad/branches/extbuild/src/other/ext/CMakeLists.txt       2020-12-02 
18:26:57 UTC (rev 77875)
+++ brlcad/branches/extbuild/src/other/ext/CMakeLists.txt       2020-12-02 
19:35:30 UTC (rev 77876)
@@ -329,6 +329,7 @@
     CMakeLists.txt
     CMake/ExternalProject_Target.cmake
     CMake/FindBSON.cmake
+    CMake/FindITCL.cmake
     CMake/FindLEMON.cmake
     CMake/FindNETPBM.cmake
     CMake/FindOPENNURBS.cmake

Modified: brlcad/branches/extbuild/src/other/ext/itcl.cmake
===================================================================
--- brlcad/branches/extbuild/src/other/ext/itcl.cmake   2020-12-02 18:26:57 UTC 
(rev 77875)
+++ brlcad/branches/extbuild/src/other/ext/itcl.cmake   2020-12-02 19:35:30 UTC 
(rev 77876)
@@ -45,8 +45,19 @@
        set(${bvar} 1 PARENT_SCOPE)
       endif ("${BRLCAD_ITCL}" STREQUAL "SYSTEM")
     else (ITCL_TEST_FAILED)
-      # We have Itcl 3 - no need to build.
-      set(${bvar} 0 PARENT_SCOPE)
+      # We have Itcl 3, but that's not enough by itself - we may need to build
+      # Itk, and for that to work find_package has to also be able to locate 
Itcl.
+      find_package(ITCL)
+      if(ITCL_FOUND)
+       set(${bvar} 0 PARENT_SCOPE)
+      else(ITCL_FOUND)
+       if ("${BRLCAD_ITCL}" STREQUAL "SYSTEM")
+         # Test failed, but user has specified system - this is fatal.
+         message(FATAL_ERROR "System-installed Itcl3 specified, but package is 
not installed in such a way that find_package(ITCL) can locate its components.")
+       else ("${BRLCAD_ITCL}" STREQUAL "SYSTEM")
+         set(${bvar} 1 PARENT_SCOPE)
+       endif ("${BRLCAD_ITCL}" STREQUAL "SYSTEM")
+      endif(ITCL_FOUND)
     endif (ITCL_TEST_FAILED)
 
   endif (NOT "${BRLCAD_ITCL}" STREQUAL "BUNDLED")
@@ -70,7 +81,7 @@
 
     set(ITCL_MAJOR_VERSION 3)
     set(ITCL_MINOR_VERSION 4)
-    set(ITCL_VERSION ${ITCL_MAJOR_VERSION}.${ITCL_MINOR_VERSION})
+    set(ITCL_VERSION ${ITCL_MAJOR_VERSION}.${ITCL_MINOR_VERSION} CACHE STRING 
"Itcl version")
 
     set(ITCL_DEPS)
     if (TARGET tcl_stage)

Modified: brlcad/branches/extbuild/src/other/ext/itk.cmake
===================================================================
--- brlcad/branches/extbuild/src/other/ext/itk.cmake    2020-12-02 18:26:57 UTC 
(rev 77875)
+++ brlcad/branches/extbuild/src/other/ext/itk.cmake    2020-12-02 19:35:30 UTC 
(rev 77876)
@@ -41,7 +41,7 @@
 
     set(ITK_MAJOR_VERSION 3)
     set(ITK_MINOR_VERSION 4)
-    set(ITK_VERSION ${ITK_MAJOR_VERSION}.${ITK_MINOR_VERSION})
+    set(ITK_VERSION ${ITK_MAJOR_VERSION}.${ITK_MINOR_VERSION} CACHE STRING 
"Itk version")
 
     set(ITK_DEPS)
     if (TARGET tcl_stage)

Modified: brlcad/branches/extbuild/src/other/ext/iwidgets.cmake
===================================================================
--- brlcad/branches/extbuild/src/other/ext/iwidgets.cmake       2020-12-02 
18:26:57 UTC (rev 77875)
+++ brlcad/branches/extbuild/src/other/ext/iwidgets.cmake       2020-12-02 
19:35:30 UTC (rev 77876)
@@ -26,7 +26,7 @@
     set(IWIDGETS_MAJOR_VERSION 4)
     set(IWIDGETS_MINOR_VERSION 1)
     set(IWIDGETS_PATCH_VERSION 1)
-    set(IWIDGETS_VERSION 
${IWIDGETS_MAJOR_VERSION}.${IWIDGETS_MINOR_VERSION}.${IWIDGETS_PATCH_VERSION})
+    set(IWIDGETS_VERSION 
${IWIDGETS_MAJOR_VERSION}.${IWIDGETS_MINOR_VERSION}.${IWIDGETS_PATCH_VERSION} 
CACHE STRING "IWidgets version")
 
     # If we have build targets, set the variables accordingly.  Otherwise,
     # we need to find the *Config.sh script locations.

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to