From: <ai...@us...> - 2013-11-10 01:15:02
|
Revision: 12674 http://sourceforge.net/p/plplot/code/12674 Author: airwin Date: 2013-11-10 01:14:57 +0000 (Sun, 10 Nov 2013) Log Message: ----------- Add Itcl and Itk header consistency checks using the version numbers in the itcl.h and itk.h headers that are found. Modified Paths: -------------- trunk/cmake/modules/tcl-related.cmake Modified: trunk/cmake/modules/tcl-related.cmake =================================================================== --- trunk/cmake/modules/tcl-related.cmake 2013-11-09 19:59:07 UTC (rev 12673) +++ trunk/cmake/modules/tcl-related.cmake 2013-11-10 01:14:57 UTC (rev 12674) @@ -22,17 +22,17 @@ if(DEFAULT_NO_BINDINGS) option(ENABLE_tcl "Enable Tcl bindings" OFF) - option(ENABLE_itcl "Enable incr Tcl interface code" OFF) + option(ENABLE_itcl "Enable Itcl interface code" OFF) option(ENABLE_tk "Enable Tk interface code" OFF) - option(ENABLE_itk "Enable incr Tk interface code" OFF) + option(ENABLE_itk "Enable Itk interface code" OFF) else(DEFAULT_NO_BINDINGS) option(ENABLE_tcl "Enable Tcl bindings" ON) - option(ENABLE_itcl "Enable incr Tcl interface code" ON) + option(ENABLE_itcl "Enable Itcl interface code" ON) option(ENABLE_tk "Enable Tk interface code" ON) - option(ENABLE_itk "Enable incr Tk interface code" ON) + option(ENABLE_itk "Enable Itk interface code" ON) endif(DEFAULT_NO_BINDINGS) -option(USE_INCRTCL_VERSION_4 "Use [incr Tcl] version 4" OFF) +option(USE_INCRTCL_VERSION_4 "Use version 4 of Itcl and Itcl, version 4.1 of Iwidgets" OFF) # Depending on these above options and system resources may also determine # the following variables which are largely self-explanatory unless documented @@ -57,7 +57,7 @@ # Used for source file configuration.) if(ENABLE_tcl) - message(STATUS "Use system introspection to determine data for Tcl and friends") + message(STATUS "Start determining consistent system data for Tcl and friends") find_package(TCL QUIET) if(TCL_FOUND) message(STATUS "Looking for include paths and libraries for Tcl - found") @@ -101,9 +101,45 @@ find_path(ITCL_INCLUDE_PATH itcl.h HINTS ${TCL_INCLUDE_PATH}/itcl${ITCL_VERSION}) endif(NOT USE_INCRTCL_VERSION_4) find_path(ITCL_INCLUDE_PATH itcl.h HINTS ${TCL_INCLUDE_PATH}) + if(ITCL_INCLUDE_PATH) message(STATUS "Looking for itcl.h - found") message(STATUS "ITCL_INCLUDE_PATH = ${ITCL_INCLUDE_PATH}") + + message(STATUS "Checking for Itcl header version consistency") + string(REGEX REPLACE "^([0-9]*)\\.[0-9]*.*$" "\\1" ITCL_MAJOR_VERSION "${ITCL_VERSION}") + string(REGEX REPLACE "^[0-9]*\\.([0-9]*).*$" "\\1" ITCL_MINOR_VERSION "${ITCL_VERSION}") + message(STATUS "ITCL_MAJOR_VERSION = ${ITCL_MAJOR_VERSION}") + message(STATUS "ITCL_MINOR_VERSION = ${ITCL_MINOR_VERSION}") + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckITCL_VERSION.c + "// #define RC_INVOKED to avoid sucking in lots of additional includes for +// efficiency and simplicity. +#define RC_INVOKED 1 +#include <itcl.h> +#if ITCL_MAJOR_VERSION != ${ITCL_MAJOR_VERSION} || ITCL_MINOR_VERSION != ${ITCL_MINOR_VERSION} + #error ITCL_VERSION mismatch +#endif +void main(void){} +" + ) + try_compile(CONSISTENT_HEADER_ITCL_VERSION ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/CheckITCL_VERSION.c + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${ITCL_INCLUDE_PATH};${TCL_INCLUDE_PATH}" + ) + if(CONSISTENT_HEADER_ITCL_VERSION) + message(STATUS "Checking for Itcl header version consistency - true") + else(CONSISTENT_HEADER_ITCL_VERSION) + message(STATUS "Checking for Itcl header version consistency - false") + message(STATUS "WARNING: Disabling Itcl interface code") + set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE) + endif(CONSISTENT_HEADER_ITCL_VERSION) + else(ITCL_INCLUDE_PATH) + message(STATUS "Looking for itcl.h - not found") + message(STATUS "WARNING: Disabling Itcl interface code") + set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE) + endif(ITCL_INCLUDE_PATH) + + if(ENABLE_itcl) message(STATUS "Looking for itcl library") # Search first for epa_build install location. find_library(ITCL_LIBRARY itcl${ITCL_VERSION} HINTS ${TCL_LIBRARY_PATH}/itcl${ITCL_VERSION}) @@ -115,18 +151,14 @@ find_path(HAVE_ITCLDECLS_H itclDecls.h HINTS ${ITCL_INCLUDE_PATH}) else(ITCL_LIBRARY) message(STATUS "Looking for itcl library - not found") - message(STATUS "WARNING: Disabling incr Tcl interface code") - set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE) + message(STATUS "WARNING: Disabling Itcl interface code") + set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE) endif(ITCL_LIBRARY) - else(ITCL_INCLUDE_PATH) - message(STATUS "Looking for itcl.h - not found") - message(STATUS "WARNING: Disabling incr Tcl interface code") - set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE) - endif(ITCL_INCLUDE_PATH) + endif(ENABLE_itcl) else(NOT ITCL_RC) message(STATUS "Itcl not available or not compatible with current Tcl shell") - message(STATUS "WARNING: Disabling incr Tcl interface code") - set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE) + message(STATUS "WARNING: Disabling Itcl interface code") + set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE) endif(NOT ITCL_RC) endif(ENABLE_itcl) @@ -162,8 +194,8 @@ message(STATUS "WARNING: the Tcl and Tk library locations are inconsistent so those libraries are likely not compatible") endif(NOT ${TK_LIBRARY_PATH} STREQUAL ${TCL_LIBRARY_PATH}) else(ENABLE_tk) - message(STATUS "WARNING: Because Tk is disabled must disable incr Tk as well") - set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE) + message(STATUS "WARNING: Because Tk is disabled must disable Itk as well") + set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE) endif(ENABLE_tk) if(ENABLE_itk) @@ -190,10 +222,46 @@ find_path(ITK_INCLUDE_PATH itk.h HINTS ${TCL_INCLUDE_PATH}/itcl${ITCL_VERSION}) endif(NOT USE_INCRTCL_VERSION_4) find_path(ITK_INCLUDE_PATH itk.h HINTS ${TCL_INCLUDE_PATH}) + if(ITK_INCLUDE_PATH) message(STATUS "Looking for itk.h - found") message(STATUS "ITK_INCLUDE_PATH = ${ITK_INCLUDE_PATH}") + message(STATUS "Checking for Itk header version consistency") + string(REGEX REPLACE "^([0-9]*)\\.[0-9]*.*$" "\\1" ITK_MAJOR_VERSION "${ITK_VERSION}") + string(REGEX REPLACE "^[0-9]*\\.([0-9]*).*$" "\\1" ITK_MINOR_VERSION "${ITK_VERSION}") + message(STATUS "ITK_MAJOR_VERSION = ${ITK_MAJOR_VERSION}") + message(STATUS "ITK_MINOR_VERSION = ${ITK_MINOR_VERSION}") + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckITK_VERSION.c + "// #define RC_INVOKED to avoid sucking in lots of additional includes for +// efficiency and simplicity and also to avoid the header file disaster that has long +// been a problem for version 3.3 of itk.h +#define RC_INVOKED 1 +#include <itk.h> +#if ITK_MAJOR_VERSION != ${ITK_MAJOR_VERSION} || ITK_MINOR_VERSION != ${ITK_MINOR_VERSION} + #error ITK_VERSION mismatch +#endif +void main(void){} +" + ) + try_compile(CONSISTENT_HEADER_ITK_VERSION ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/CheckITK_VERSION.c + CMAKE_FLAGS -DINCLUDE_DIRECTORIES:PATH=${ITK_INCLUDE_PATH} + ) + if(CONSISTENT_HEADER_ITK_VERSION) + message(STATUS "Checking for Itk header version consistency - true") + else(CONSISTENT_HEADER_ITK_VERSION) + message(STATUS "Checking for Itk header version consistency - false") + message(STATUS "WARNING: Disabling Itk interface code") + set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE) + endif(CONSISTENT_HEADER_ITK_VERSION) + else(ITK_INCLUDE_PATH) + message(STATUS "Looking for itk.h - not found") + message(STATUS "WARNING: Disabling Itk interface code") + set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE) + endif(ITK_INCLUDE_PATH) + + if(ENABLE_itk) message(STATUS "Looking for itk library") # Search first for epa_build install location. find_library(ITK_LIBRARY itk${ITK_VERSION} HINTS ${TCL_LIBRARY_PATH}/itk${ITK_VERSION}) @@ -240,6 +308,7 @@ list(GET IWIDGETS_VERSIONS_LIST 0 IWIDGETS_VERSION) list(GET IWIDGETS_VERSIONS_LIST 1 CONSISTENT_ITK_VERSION) list(GET IWIDGETS_VERSIONS_LIST 2 CONSISTENT_ITCL_VERSION) + message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent") if(CONSISTENT_ITCL_VERSION STREQUAL ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL ITK_VERSION) if(USE_INCRTCL_VERSION_4) set(IWIDGETS_PACKAGE_NAME "Iwidgets ${IWIDGETS_VERSION}") @@ -251,6 +320,7 @@ # iwidgets between the build and post-install eras. set(IWIDGETS_PACKAGE_NAME "-exact Iwidgets ${IWIDGETS_VERSION}") endif(USE_INCRTCL_VERSION_4) + message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent - true") message(STATUS "IWIDGETS_PACKAGE_NAME = ${IWIDGETS_PACKAGE_NAME}") else(CONSISTENT_ITCL_VERSION STREQUAL ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL ITK_VERSION) message(STATUS "IWIDGETS_VERSION = ${IWIDGETS_VERSION}") @@ -258,29 +328,26 @@ message(STATUS "CONSISTENT_ITK_VERSION = ${CONSISTENT_ITK_VERSION}") message(STATUS "ITCL_VERSION = ${ITCL_VERSION}") message(STATUS "CONSISTENT_ITCL_VERSION = ${CONSISTENT_ITCL_VERSION}") + message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent - false") message(STATUS "WARNING: Consistent combination of Iwidgets, Itk, and Itcl not found so disabling Itcl and Itk") - set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE) - set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE) + set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE) + set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE) endif(CONSISTENT_ITCL_VERSION STREQUAL ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL ITK_VERSION) else(NOT IWIDGETS_RC) message(STATUS "WARNING: Iwidgets could not be found so disabling Itcl and Itk") - set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE) - set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE) + set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE) + set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE) endif(NOT IWIDGETS_RC) else(ITK_LIBRARY) message(STATUS "Looking for itk library - not found") - message(STATUS "WARNING: Disabling incr Tk interface code") - set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE) + message(STATUS "WARNING: Disabling Itk interface code") + set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE) endif(ITK_LIBRARY) - else(ITK_INCLUDE_PATH) - message(STATUS "Looking for itk.h - not found") - message(STATUS "WARNING: Disabling incr Tk interface code") - set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE) - endif(ITK_INCLUDE_PATH) + endif(ENABLE_itk) else(NOT ITK_RC) message(STATUS "Itk not available or not compatible with current Tcl shell") - message(STATUS "WARNING: Disabling incr Tk interface code") - set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE) + message(STATUS "WARNING: Disabling Itk interface code") + set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE) endif(NOT ITK_RC) endif(ENABLE_itk) @@ -288,16 +355,16 @@ message(STATUS "Tcl not found OR tclsh not found") message(STATUS "WARNING: Disabling everything that is Tcl/Tk related") set(ENABLE_tcl OFF CACHE BOOL "Enable Tcl bindings" FORCE) - set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE) + set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE) set(ENABLE_tk OFF CACHE BOOL "Enable Tk interface code" FORCE) - set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE) + set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE) endif(TCL_FOUND AND TCL_TCLSH) - message(STATUS "Finished system introspection to determine data for Tcl and friends") + message(STATUS "Finished determining consistent system data for Tcl and friends") else(ENABLE_tcl) message(STATUS "WARNING: ENABLE_tcl is OFF so disabling everything else that is Tcl/Tk related") - set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE) + set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE) set(ENABLE_tk OFF CACHE BOOL "Enable Tk interface code" FORCE) - set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE) + set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE) endif(ENABLE_tcl) if(NOT ENABLE_itk) set(itk_true "#") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |