Revision: 75898
http://sourceforge.net/p/brlcad/code/75898
Author: starseeker
Date: 2020-05-23 18:39:22 +0000 (Sat, 23 May 2020)
Log Message:
-----------
revert
Modified Paths:
--------------
brlcad/branches/bioh/misc/CMake/CMakeLists.txt
brlcad/branches/bioh/src/other/CMakeLists.txt
Removed Paths:
-------------
brlcad/branches/bioh/misc/CMake/wsysstring.cpp
Modified: brlcad/branches/bioh/misc/CMake/CMakeLists.txt
===================================================================
--- brlcad/branches/bioh/misc/CMake/CMakeLists.txt 2020-05-23 17:05:51 UTC
(rev 75897)
+++ brlcad/branches/bioh/misc/CMake/CMakeLists.txt 2020-05-23 18:39:22 UTC
(rev 75898)
@@ -95,7 +95,6 @@
multiconfig_path_read.cmake.in
source_archive_setup.cmake.in
tcltest.tcl.in
- wsysstring.cpp
)
CMAKEFILES(${cmake_ignore_files})
Deleted: brlcad/branches/bioh/misc/CMake/wsysstring.cpp
===================================================================
--- brlcad/branches/bioh/misc/CMake/wsysstring.cpp 2020-05-23 17:05:51 UTC
(rev 75897)
+++ brlcad/branches/bioh/misc/CMake/wsysstring.cpp 2020-05-23 18:39:22 UTC
(rev 75898)
@@ -1,102 +0,0 @@
-/* W S Y S S T R I N G . C P P
- * BRL-CAD
- *
- * Published in 2020 by the United States Government.
- * This work is in the public domain.
- *
- */
-/** @file wsysstring.cpp
- *
- * This is an attempt to work around a problem with Tcl/Tk. The public Tk C
- * api doesn't provide a way to get at the compiled graphics subsystem choice
- * without trying to initalize a Tk window, which won't work in headless
- * configurations such as build farms. So instead we introspect looking for
- * the key printable strings that can tell us what we've got.
- */
-
-#include <fstream>
-#include <iostream>
-#include <cstring>
-#include <string>
-
-int
-main(int argc, const char *argv[])
-{
- bool have_x11 = false;
- bool have_win32 = false;
- bool have_aqua = false;
-
- if (argc != 2) {
- std::cerr << "Usage: wsysstring <file>\n";
- return -1;
- }
-
- std::string sfile;
- std::ifstream lib;
- lib.open(argv[1]);
- if (!lib.is_open()) {
- std::cerr << "Unable to open file" << argv[1] << "\n";
- return -1;
- }
-
- lib.seekg(0, std::ios::end);
- size_t llen = lib.tellg();
- lib.seekg(0, std::ios::beg);
- std::string lcontent;
- lcontent.reserve(llen);
- char buff[16384]; // 2^14
- std::streamsize ss;
- while (lib.read(buff, sizeof buff), ss = lib.gcount()) {
- lcontent.append(buff, ss);
- }
-
- // Have contents, find any printable substrings and check them
- size_t cpos = 0;
- std::string cstr;
- while (cpos < lcontent.length()) {
- char c = lcontent[cpos];
- if (isprint(c)) {
- cstr.push_back(c);
- } else {
- // Hit a non-printable - if we have a cstr, work it
- // and reset
- if (cstr.length() > 2) {
- if (cstr == std::string("x11")) {
- have_x11 = true;
- }
- if (cstr == std::string("win32")) {
- have_win32 = true;
- }
- if (cstr == std::string("aqua")) {
- have_aqua = true;
- }
- }
- cstr.clear();
- }
- cpos++;
- }
-
- int mcnt = 0;
- mcnt += have_x11;
- mcnt += have_win32;
- mcnt += have_aqua;
- if (mcnt > 1) return -1;
-
- if (mcnt == 1) {
- if (have_x11) std::cout << "x11\n";
- if (have_win32) std::cout << "win32\n";
- if (have_aqua) std::cout << "aqua\n";
- return 1;
- }
-
- return 0;
-}
-
-// Local Variables:
-// tab-width: 8
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: t
-// c-file-style: "stroustrup"
-// End:
-// ex: shiftwidth=4 tabstop=8
Modified: brlcad/branches/bioh/src/other/CMakeLists.txt
===================================================================
--- brlcad/branches/bioh/src/other/CMakeLists.txt 2020-05-23 17:05:51 UTC
(rev 75897)
+++ brlcad/branches/bioh/src/other/CMakeLists.txt 2020-05-23 18:39:22 UTC
(rev 75898)
@@ -455,44 +455,18 @@
set(HAVE_TK_H 1)
- # Packages probably still need to know the system graphics package.
Unfortunately
- # it is not possible to run tclsh or wish to use the [tk windowingsystem]
command
- # to extract this information on a system without the ability to launch a
graphics
- # window successfully - Tk initialization will fail, and thus the command
fails,
- # even though we don't actually need the window. There is no other reliable
- # runtime way to use tclsh or wish to identify the system graphics system.
- #
- # In lieu of this, we look instead in the printiable strings of the Tk
library
- # for the "win32", "aqua", or "x11" strings (or, if necessary, we will add
additional
- # string checks.) This is not ideal, but there appears to be no other way
to learn
- # what we want to know.
+ # Packages probably still need to know the system graphics package
+ if (NOT WIN32)
+ if (APPLE AND TK_ENABLE_AQUA)
+ set(TK_SYSTEM_GRAPHICS aqua)
+ else ()
+ set(TK_SYSTEM_GRAPHICS x11)
+ endif (APPLE AND TK_ENABLE_AQUA)
+ else (NOT WIN32)
+ set(TK_SYSTEM_GRAPHICS win32)
+ endif (NOT WIN32)
+ set(TK_SYSTEM_GRAPHICS "${TK_SYSTEM_GRAPHICS}" CACHE STRING "Tk system
graphics type" FORCE)
- try_compile(WSYS_BUILD ${CMAKE_BINARY_DIR}/CMakeTmp
${BRLCAD_CMAKE_DIR}/wsysstring.cpp
- OUTPUT_VARIABLE WSYS_MSG
- COPY_FILE
${CMAKE_BINARY_DIR}/CMakeTmp/wsysstring${CMAKE_EXECUTABLE_SUFFIX})
-
- if (NOT WSYS_BUILD)
- message(FATAL_ERROR "Could not build wyssstring checker to test Tcl/Tk
windowing system: ${WSYS_MSG}")
- endif (NOT WSYS_BUILD)
-
- execute_process(COMMAND
${CMAKE_BINARY_DIR}/CMakeTmp/wsysstring${CMAKE_EXECUTABLE_SUFFIX} ${TK_LIBRARY}
- RESULT_VARIABLE WSYS_TEST
- OUTPUT_VARIABLE WSYS_VAL
- )
-
- if (WSYS_TEST EQUAL -1)
- message(FATAL_ERROR "Tcl/Tk windowing system test failed")
- endif (WSYS_TEST EQUAL -1)
-
- string(REPLACE "\n" "" WSYS_VAL "${WSYS_VAL}")
- if (BRLCAD_ENABLE_AQUA AND NOT "${WSYS_VAL}" STREQUAL "aqua")
- message(FATAL_ERROR "Aqua build requested, but Tk graphics system is
\"${WSYS_VAL}\". Please direct FindTCL.cmake to a different Tcl/Tk
installation to use Aqua.")
- endif (BRLCAD_ENABLE_AQUA AND NOT "${WSYS_VAL}" STREQUAL "aqua")
-
- set(TK_SYSTEM_GRAPHICS "${WSYS_VAL}" CACHE STRING "Tk system graphics type"
FORCE)
-
- message("TK_SYSTEM_GRAPHICS: ${TK_SYSTEM_GRAPHICS}")
-
else(BRLCAD_TK_BUILD)
# If we're not using Tk, make sure the variables are empty - CMake won't be
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