Revision: 75593
          http://sourceforge.net/p/brlcad/code/75593
Author:   starseeker
Date:     2020-04-23 22:07:57 +0000 (Thu, 23 Apr 2020)
Log Message:
-----------
Test the windowing system of the system Tcl/Tk

Modified Paths:
--------------
    brlcad/trunk/src/other/CMakeLists.txt

Modified: brlcad/trunk/src/other/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/other/CMakeLists.txt       2020-04-23 21:59:05 UTC (rev 
75592)
+++ brlcad/trunk/src/other/CMakeLists.txt       2020-04-23 22:07:57 UTC (rev 
75593)
@@ -450,10 +450,9 @@
   SetTargetFolder(tk "Third Party Libraries")
   SetTargetFolder(tkstub "Third Party Libraries")
 
-elseif(BRLCAD_TK_BUILD AND BRLCAD_ENABLE_TK)
+elseif(BRLCAD_ENABLE_TK)
 
-  # Still need the header, even if we're using system Tcl/Tk
-  BRLCAD_INCLUDE_FILE(tk.h HAVE_TK_H)
+  set(HAVE_TK_H 1)
 
   # Packages probably still need to know the system graphics package
   if (NOT WIN32)
@@ -470,9 +469,24 @@
   # Now we know what the options want - confirm we actually have it.  If not, 
it's a fatal
   # error - the user will need to either specify a system version with the 
graphics system
   # desired, change their toplevel options, or enable the bundled Tcl/Tk build.
+  set(tkwin_script "
+package require Tk
+set filename \"${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM\"
+set fileId [open $filename \"w\"]
+set windowingsystem [tk windowingsystem]
+puts $fileId $windowingsystem
+close $fileId
+exit
+  ")
+  set(tkwin_scriptfile "${CMAKE_BINARY_DIR}/CMakeTmp/tk_windowingsystem.tcl")
+  file(WRITE ${tkwin_scriptfile} ${tkwin_script})
+  execute_process(COMMAND ${TCL_TCLSH} ${tkwin_scriptfile} OUTPUT_VARIABLE 
EXECOUTPUT)
+  file(READ "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM" tcl_tkwin_raw)
+  string(REGEX REPLACE "\n" "" tcl_tkwin ${tcl_tkwin_raw})
+  if (NOT "${TK_SYSTEM_GRAPHICS}" MATCHES "${tcl_tkwin}")
+    message(FATAL_ERROR "Grahics system needed is ${TK_SYSTEM_GRAPHICS} but 
found Tcl/Tk reports \"${tcl_tkwin}\".  Need to either specify a Tcl/Tk system 
with the desired graphics behavior or specifiy different toplevel graphics 
options.")
+  endif (NOT "${TK_SYSTEM_GRAPHICS}" MATCHES "${tcl_tkwin}")
 
-  # TODO
-
 endif(BRLCAD_TK_BUILD)
 mark_as_advanced(TK_INCLUDE_PATH)
 mark_as_advanced(TK_LIBRARY)

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