Commit ef1acaf9 authored by Ben Boeckel's avatar Ben Boeckel

cmake: remove support for Tcl wrapping

parent dcb31501
# - Find Tcl includes and libraries.
# 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:
# TCL_FOUND = Tcl was found
# TK_FOUND = Tk was found
# TCLTK_FOUND = Tcl and Tk were found
# TCL_LIBRARY = path to Tcl library (tcl tcl80)
# TCL_INCLUDE_PATH = path to where tcl.h can be found
# TCL_TCLSH = path to tclsh binary (tcl tcl80)
# TK_LIBRARY = path to Tk library (tk tk80 etc)
# TK_INCLUDE_PATH = path to where tk.h can be found
# TK_WISH = full path to the wish executable
#
# In an effort to remove some clutter and clear up some issues for people
# who are not necessarily Tcl/Tk gurus/developers, some variables were
# moved or removed. Changes compared to CMake 2.4 are:
# - The stub libraries are now found in FindTclStub.cmake
# => they were only useful for people writing Tcl/Tk extensions.
# - TCL_LIBRARY_DEBUG and TK_LIBRARY_DEBUG were removed.
# => these libs are not packaged by default with Tcl/Tk distributions.
# Even when Tcl/Tk is built from source, several flavors of debug libs
# are created and there is no real reason to pick a single one
# specifically (say, amongst tcl84g, tcl84gs, or tcl84sgx).
# Let's leave that choice to the user by allowing him to assign
# TCL_LIBRARY to any Tcl library, debug or not.
# - TK_INTERNAL_PATH was removed.
# => this ended up being only a Win32 variable, and there is a lot of
# confusion regarding the location of this file in an installed Tcl/Tk
# tree anyway (see 8.5 for example). If you need the internal path at
# this point it is safer you ask directly where the *source* tree is
# and dig from there.
INCLUDE(CMakeFindFrameworks)
INCLUDE(FindTclsh)
INCLUDE(FindWish)
GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
GET_FILENAME_COMPONENT(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)
STRING(REGEX REPLACE
"^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}")
GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH)
GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH)
STRING(REGEX REPLACE
"^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}")
GET_FILENAME_COMPONENT(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH)
GET_FILENAME_COMPONENT(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH)
GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH)
GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH_PARENT "${TCL_LIBRARY_PATH}" PATH)
STRING(REGEX REPLACE
"^.*tcl([0-9]\\.*[0-9]).*$" "\\1" TCL_LIBRARY_VERSION "${TCL_LIBRARY}")
GET_FILENAME_COMPONENT(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH)
GET_FILENAME_COMPONENT(TK_LIBRARY_PATH_PARENT "${TK_LIBRARY_PATH}" PATH)
STRING(REGEX REPLACE
"^.*tk([0-9]\\.*[0-9]).*$" "\\1" TK_LIBRARY_VERSION "${TK_LIBRARY}")
SET(TCLTK_POSSIBLE_LIB_PATHS
"${TCL_INCLUDE_PATH_PARENT}/lib"
"${TK_INCLUDE_PATH_PARENT}/lib"
"${TCL_LIBRARY_PATH}"
"${TK_LIBRARY_PATH}"
"${TCL_TCLSH_PATH_PARENT}/lib"
"${TK_WISH_PATH_PARENT}/lib"
/usr/lib
/usr/local/lib
)
IF(WIN32)
GET_FILENAME_COMPONENT(
ActiveTcl_CurrentVersion
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
NAME)
SET(TCLTK_POSSIBLE_LIB_PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib"
"$ENV{ProgramFiles}/Tcl/Lib"
"C:/Program Files/Tcl/lib"
"C:/Tcl/lib"
)
ENDIF()
FIND_LIBRARY(TCL_LIBRARY
NAMES
tcl
tcl${TK_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION}
tcl86 tcl8.6
tcl85 tcl8.5
tcl84 tcl8.4
tcl83 tcl8.3
tcl82 tcl8.2
tcl80 tcl8.0
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
)
FIND_LIBRARY(TK_LIBRARY
NAMES
tk
tk${TCL_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION}
tk86 tk8.6
tk85 tk8.5
tk84 tk8.4
tk83 tk8.3
tk82 tk8.2
tk80 tk8.0
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
)
CMAKE_FIND_FRAMEWORKS(Tcl)
CMAKE_FIND_FRAMEWORKS(Tk)
SET(TCL_FRAMEWORK_INCLUDES)
IF(Tcl_FRAMEWORKS)
IF(NOT TCL_INCLUDE_PATH)
FOREACH(dir ${Tcl_FRAMEWORKS})
SET(TCL_FRAMEWORK_INCLUDES ${TCL_FRAMEWORK_INCLUDES} ${dir}/Headers)
ENDFOREACH()
ENDIF()
ENDIF()
SET(TK_FRAMEWORK_INCLUDES)
IF(Tk_FRAMEWORKS)
IF(NOT TK_INCLUDE_PATH)
FOREACH(dir ${Tk_FRAMEWORKS})
SET(TK_FRAMEWORK_INCLUDES ${TK_FRAMEWORK_INCLUDES}
${dir}/Headers ${dir}/PrivateHeaders)
ENDFOREACH()
ENDIF()
ENDIF()
SET(TCLTK_POSSIBLE_INCLUDE_PATHS
"${TCL_LIBRARY_PATH_PARENT}/include"
"${TK_LIBRARY_PATH_PARENT}/include"
"${TCL_INCLUDE_PATH}"
"${TK_INCLUDE_PATH}"
${TCL_FRAMEWORK_INCLUDES}
${TK_FRAMEWORK_INCLUDES}
"${TCL_TCLSH_PATH_PARENT}/include"
"${TK_WISH_PATH_PARENT}/include"
/usr/include
/usr/local/include
/usr/include/tcl${TK_LIBRARY_VERSION}
/usr/include/tcl${TCL_LIBRARY_VERSION}
/usr/include/tcl8.6
/usr/include/tcl8.5
/usr/include/tcl8.4
/usr/include/tcl8.3
/usr/include/tcl8.2
/usr/include/tcl8.0
)
IF(WIN32)
SET(TCLTK_POSSIBLE_INCLUDE_PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/include"
"$ENV{ProgramFiles}/Tcl/include"
"C:/Program Files/Tcl/include"
"C:/Tcl/include"
)
ENDIF()
FIND_PATH(TCL_INCLUDE_PATH
NAMES tcl.h
PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
NO_DEFAULT_PATH
)
FIND_PATH(TCL_INCLUDE_PATH
NAMES tcl.h
PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
)
FIND_PATH(TK_INCLUDE_PATH
NAMES tk.h
PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
NO_DEFAULT_PATH
)
FIND_PATH(TK_INCLUDE_PATH
NAMES tk.h
PATHS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
)
# handle the QUIETLY and REQUIRED arguments and set TCL_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
SET(TCLTK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
SET(TCLTK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCLTK DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH TK_LIBRARY TK_INCLUDE_PATH)
SET(TK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
SET(TK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TK DEFAULT_MSG TK_LIBRARY TK_INCLUDE_PATH)
MARK_AS_ADVANCED(
TCL_INCLUDE_PATH
TK_INCLUDE_PATH
TCL_LIBRARY
TK_LIBRARY
)
......@@ -132,7 +132,6 @@ SET(VTK_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
SET(VTK_LEGACY_REMOVE "@VTK_LEGACY_REMOVE@")
SET(VTK_LEGACY_SILENT "@VTK_LEGACY_SILENT@")
SET(VTK_WRAP_PYTHON "@VTK_WRAP_PYTHON@")
SET(VTK_WRAP_TCL "@VTK_WRAP_TCL@")
SET(VTK_WRAP_JAVA "@VTK_WRAP_JAVA@")
SET(VTK_QT_VERSION "@VTK_QT_VERSION@")
SET(VTK_ENABLE_KITS "@VTK_ENABLE_KITS@")
......
......@@ -35,10 +35,6 @@ endif()
if(NOT VTK_INSTALL_DOXYGEN_DIR)
set(VTK_INSTALL_DOXYGEN_DIR ${VTK_INSTALL_DOC_DIR}/doxygen)
endif()
if(NOT VTK_INSTALL_TCL_DIR)
# tclsh searches <prefix>/lib/tcltk and its subdirectories for pkgIndex.tcl files
set(VTK_INSTALL_TCL_DIR lib/tcltk/vtk-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION})
endif()
if(NOT VTK_INSTALL_EXPORT_NAME)
set(VTK_INSTALL_EXPORT_NAME VTKTargets)
endif()
......
......@@ -23,7 +23,6 @@ endif()
# OPTIONAL_PYTHON_LINK = Optionally link the python library to this module
# TEST_DEPENDS = Modules that are needed by this modules testing executables
# DESCRIPTION = Free text description of the module
# TCL_NAME = Alternative name for the TCL wrapping (cannot contain numbers)
# IMPLEMENTS = Modules that this module implements, using the auto init feature
# BACKEND = An implementation backend that this module belongs (valid with
# IMPLEMENTS only)
......@@ -65,7 +64,6 @@ macro(vtk_module _name)
set(${vtk-module}_IMPLEMENTATION_REQUIRED_BY_BACKEND 0)
set(${vtk-module}_BACKEND "")
set(${vtk-module}_DESCRIPTION "description")
set(${vtk-module}_TCL_NAME "${vtk-module}")
set(${vtk-module}_EXCLUDE_FROM_ALL 0)
set(${vtk-module}_EXCLUDE_FROM_WRAPPING 0)
set(${vtk-module}_EXCLUDE_FROM_WRAP_HIERARCHY 0)
......@@ -74,7 +72,7 @@ macro(vtk_module _name)
foreach(arg ${ARGN})
# XXX: Adding a new keyword? Update Utilities/Maintenance/WhatModulesVTK.py
# and Utilities/Maintenance/VisualizeModuleDependencies.py as well.
if("${arg}" MATCHES "^((|COMPILE_|PRIVATE_|TEST_|)DEPENDS|DESCRIPTION|TCL_NAME|IMPLEMENTS|BACKEND|DEFAULT|GROUPS|TEST_LABELS|KIT|LEGACY)$")
if("${arg}" MATCHES "^((|COMPILE_|PRIVATE_|TEST_|)DEPENDS|DESCRIPTION|IMPLEMENTS|BACKEND|DEFAULT|GROUPS|TEST_LABELS|KIT|LEGACY)$")
set(_doing "${arg}")
elseif("${arg}" STREQUAL "EXCLUDE_FROM_ALL")
set(_doing "")
......@@ -111,9 +109,6 @@ macro(vtk_module _name)
elseif("${_doing}" STREQUAL "DESCRIPTION")
set(_doing "")
set(${vtk-module}_DESCRIPTION "${arg}")
elseif("${_doing}" STREQUAL "TCL_NAME")
set(_doing "")
set(${vtk-module}_TCL_NAME "${arg}")
elseif("${_doing}" STREQUAL "IMPLEMENTS")
list(APPEND ${vtk-module}_DEPENDS "${arg}")
list(APPEND ${vtk-module}_IMPLEMENTS "${arg}")
......@@ -162,11 +157,6 @@ macro(vtk_module _name)
list(SORT ${vtk-module}_DEPENDS) # Deterministic order.
list(SORT ${vtk-module-test}_DEPENDS) # Deterministic order.
list(SORT ${vtk-module}_IMPLEMENTS) # Deterministic order.
if(NOT (${vtk-module}_EXCLUDE_FROM_WRAPPING OR
${vtk-module}_EXCLUDE_FROM_TCL_WRAPPING) AND
"${${vtk-module}_TCL_NAME}" MATCHES "[0-9]")
message(AUTHOR_WARNING "Specify a TCL_NAME with no digits.")
endif()
endif()
endmacro()
......@@ -359,7 +349,7 @@ macro(vtk_module_export_info)
DESTINATION ${VTK_INSTALL_PACKAGE_DIR}/Modules
COMPONENT Development)
if(NOT ${vtk-module}_EXCLUDE_FROM_WRAPPING)
if(VTK_WRAP_PYTHON OR VTK_WRAP_TCL OR VTK_WRAP_JAVA)
if(VTK_WRAP_PYTHON OR VTK_WRAP_JAVA)
install(FILES ${${vtk-module}_WRAP_HIERARCHY_FILE}
DESTINATION ${VTK_INSTALL_PACKAGE_DIR}/Modules
COMPONENT Development)
......@@ -672,7 +662,7 @@ function(vtk_module_library name)
# TODO: Re-order things so we do not need to duplicate this condition.
if(NOT ${vtk-module}_EXCLUDE_FROM_WRAPPING AND
NOT ${vtk-module}_EXCLUDE_FROM_WRAP_HIERARCHY AND
( VTK_WRAP_PYTHON OR VTK_WRAP_TCL OR VTK_WRAP_JAVA ))
( VTK_WRAP_PYTHON OR VTK_WRAP_JAVA ))
set(_hierarchy ${CMAKE_CURRENT_BINARY_DIR}/${vtk-module}Hierarchy.stamp.txt)
else()
set(_hierarchy "")
......@@ -809,27 +799,6 @@ VTK_AUTOINIT(${vtk-module})
)
endif()
if(BUILD_TESTING AND TCL_TCLSH)
add_test(NAME ${vtk-module}-TestSetObjectMacro
COMMAND ${TCL_TCLSH}
${VTK_SOURCE_DIR}/Testing/Core/FindString.tcl
"${${vtk-module}_SOURCE_DIR}/vtk\\\\*.h"
# "${CMAKE_CURRENT_SOURCE_DIR}/vtk\\\\*.h"
"vtkSetObjectMacro"
${VTK_SOURCE_DIR}/Common/Core/vtkSetGet.h
)
add_test(NAME ${vtk-module}-TestPrintSelf
COMMAND ${TCL_TCLSH}
${VTK_SOURCE_DIR}/Testing/Core/PrintSelfCheck.tcl
${${vtk-module}_SOURCE_DIR})
set_tests_properties(${vtk-module}-TestSetObjectMacro
PROPERTIES LABELS "${${vtk-module}_TEST_LABELS}"
)
set_tests_properties(${vtk-module}-TestPrintSelf
PROPERTIES LABELS "${${vtk-module}_TEST_LABELS}"
)
endif()
# Add the module to the list of wrapped modules if necessary
vtk_add_wrapping(${vtk-module} "${ARGN}" "${${vtk-module}_HDRS}")
......
......@@ -4,9 +4,6 @@ if(BUILD_TESTING)
if(VTK_WRAP_PYTHON)
list(APPEND _test_languages "Python")
endif()
if(VTK_WRAP_TCL)
list(APPEND _test_languages "Tcl")
endif()
if(VTK_WRAP_JAVA)
list(APPEND _test_languages "Java")
endif()
......@@ -506,9 +503,7 @@ if (NOT VTK_INSTALL_NO_DEVELOPMENT)
CMake/vtkInitializeBuildType.cmake
CMake/pythonmodules.h.in
CMake/UseVTK.cmake
CMake/FindTCL.cmake
CMake/TopologicalSort.cmake
CMake/vtkTclTkMacros.cmake
CMake/vtk-forward.c.in
CMake/vtkGroups.cmake
CMake/vtkEncodeString.cmake
......@@ -526,14 +521,12 @@ if (NOT VTK_INSTALL_NO_DEVELOPMENT)
CMake/vtkPythonPackages.cmake
CMake/vtkPythonWrapping.cmake
CMake/vtkTargetLinkLibrariesWithDynamicLookup.cmake
CMake/vtkTclWrapping.cmake
CMake/vtkThirdParty.cmake
CMake/vtkWrapHierarchy.cmake
CMake/vtkWrapJava.cmake
CMake/vtkWrapperInit.data.in
CMake/vtkWrapping.cmake
CMake/vtkWrapPython.cmake
CMake/vtkWrapTcl.cmake
DESTINATION ${VTK_INSTALL_PACKAGE_DIR})
get_property(VTK_TARGETS GLOBAL PROPERTY VTK_TARGETS)
......
This diff is collapsed.
# Make sure we find the required Tcl components.
if(VTK_WRAP_TCL)
set(VTK_WRAP_TCL_FIND_LIBS 1)
include(vtkWrapTcl)
include(vtkWrapHierarchy)
endif()
function(vtk_add_tcl_wrapping module_name module_srcs module_hdrs)
if(NOT VTK_WRAP_TCL_INIT_EXE)
if (TARGET vtkWrapTclInit)
set(VTK_WRAP_TCL_INIT_EXE vtkWrapTclInit)
else()
message(FATAL_ERROR
"VTK_WRAP_TCL_INIT_EXE must be set before calling vtk_add_tcl_wrapping.")
endif()
endif()
# Need to add the Wrapping directory to the include directory
set(_tcl_include_dirs
${VTK_SOURCE_DIR}/Wrapping/Tcl
${VTK_BINARY_DIR}/Wrapping/Tcl
${TCL_INCLUDE_PATH})
# FIXME: These must be here for now, should be fixed in the wrap hierarchy stuff
if(NOT ${module_name}_EXCLUDE_FROM_WRAP_HIERARCHY)
set(KIT_HIERARCHY_FILE ${${module_name}_WRAP_HIERARCHY_FILE})
endif()
string(REGEX REPLACE "^vtk" "" kit_name "${module_name}")
set(KIT ${kit_name})
# FIXME: Terrible temporary hack - add in the extra source file for CommonCore
if(${module_name} STREQUAL "vtkCommonCore")
set(extra_srcs ${VTK_SOURCE_DIR}/Wrapping/Tcl/vtkTclUtil.cxx)
set(extra_links vtksys)
else()
unset(extra_srcs)
# This contains the vtkTclUtil class....
set(extra_links vtkCommonCoreTCL)
endif()
# Figure out the dependent Tcl libraries for the module
foreach(dep ${${vtk-module}_WRAP_DEPENDS})
if(NOT "${vtk-module}" STREQUAL "${dep}")
if(NOT ${dep}_EXCLUDE_FROM_WRAPPING AND NOT "${${dep}_TCL_NAME}" STREQUAL "")
list(APPEND extra_links ${${dep}_TCL_NAME}TCL)
endif()
endif()
endforeach()
# Tcl will not accept module names with numbers in.
set(tcl_module ${${module_name}_TCL_NAME})
vtk_wrap_tcl3(${tcl_module}TCL Tcl_SRCS "${module_srcs}" "")
vtk_add_library(${tcl_module}TCL ${Tcl_SRCS} ${extra_srcs})
set_property(TARGET ${tcl_module}TCL APPEND
PROPERTY INCLUDE_DIRECTORIES ${_tcl_include_dirs})
if(${module_name}_IMPLEMENTS)
set_property(TARGET ${tcl_module}TCL PROPERTY COMPILE_DEFINITIONS
"${module_name}_AUTOINIT=1(${module_name})")
endif()
target_link_libraries(${tcl_module}TCL LINK_PUBLIC ${module_name}
${extra_links} ${VTK_TCL_LIBRARIES})
endfunction()
......@@ -491,95 +491,3 @@ function(vtk_add_test_python_mpi)
endif()
vtk_add_test_python(${ARGN})
endfunction()
# -----------------------------------------------------------------------------
# vtk_add_test_tcl([NO_RT] [NO_DATA] [NO_VALID] [NO_OUTPUT]
# [test1.tcl...] [args...])
# Adds Tcl tests.
#
# Adds Tcl tests to run. If NO_DATA is set, the -D argument to the test
# (input data) will not be passed, NO_VALID will suppress -V, NO_OUTPUT will
# suppress -T, and NO_RT will suppress the -V and -T arguments
# unconditionally and pass -D to the empty string. Test-specific arguments may
# be set to _${name}_ARGS. By default, the test name will be the part of the
# source file before the '.tcl'. A custom test name can be specified by giving
# a name followed by a comma before the test file name, .e.g.,
#
# CustomTestName,TestSource.tcl
#
# The 'vtk_test_prefix' variable may be set to create separate tests from a
# single test name (e.g., running with different arguments), but should be
# used only when required.
function(vtk_add_test_tcl)
if(NOT VTK_TCL_EXE)
message(FATAL_ERROR "VTK_TCL_EXE not set")
endif()
set(tcl_options
NO_DATA
NO_VALID
NO_OUTPUT
NO_RT
)
_vtk_test_parse_args("${tcl_options}" "tcl" ${ARGN})
_vtk_test_set_options("${tcl_options}" "" ${options})
set(_vtk_fail_regex "(\n|^)ERROR: " "instance(s)? still around")
set(data_dir "${VTK_TEST_DATA_DIR}")
if(${vtk-module}_DATA_DIR)
set(data_dir "${${vtk-module}_DATA_DIR}")
endif()
set(baseline_dir ${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline)
if(VTK_BASELINE_DIR)
set(baseline_dir ${VTK_BASELINE_DIR})
endif()
set(externaldata_target VTKData)
if(VTK_TEST_DATA_TARGET)
set(externaldata_target ${VTK_TEST_DATA_TARGET})
endif()
foreach(name IN LISTS names)
_vtk_test_set_options("${tcl_options}" "local_" ${_${name}_options})
_vtk_test_parse_name(${name})
if(NOT local_NO_DATA)
set(_D -D ${data_dir})
elseif(local_NO_RT)
set(_D "")
else()
set(_D -D VTK_DATA_ROOT-NOTFOUND)
endif()
set(rtImageTest "")
set(_V "")
set(_T "")
if(NOT local_NO_RT)
set(rtImageTest ${vtkTestingRendering_SOURCE_DIR}/rtImageTest.tcl)
if(NOT local_NO_VALID)
set(_V -V "DATA{${baseline_dir}/${test_name}.png,:}")
endif()
if(NOT local_NO_OUTPUT)
set(_T -T ${VTK_TEST_OUTPUT_DIR})
endif()
endif()
set(_A -A ${VTK_SOURCE_DIR}/Wrapping/Tcl)
ExternalData_add_test(${externaldata_target}
NAME ${vtk-module}Tcl-${vtk_test_prefix}${test_name}
COMMAND ${VTK_TCL_EXE}
${rtImageTest}
${CMAKE_CURRENT_SOURCE_DIR}/${test_file}.tcl
${args}
${${vtk-module}_ARGS}
${${name}_ARGS}
${_D} ${_T} ${_V} ${_A})
set_tests_properties(${vtk-module}Tcl-${vtk_test_prefix}${test_name}
PROPERTIES
LABELS "${${vtk-module}_TEST_LABELS}"
FAIL_REGULAR_EXPRESSION "${_vtk_fail_regex}"
)
endforeach()
endfunction()
#
# a cmake implementation of the Wrap Tcl command
# it takes an optional VERSION parameter that will be output
# to the .data file as VERSION ${VERSION}.
# vtkWrapTclInit will then recognize the VERSION keyword, extract the version
# and make sure the corresponding Tcl package is 'provided' with that version.
#
MACRO(VTK_WRAP_TCL2 TARGET)
# convert to the WRAP3 signature
SET(MODE SOURCE_LIST)
SET(SOURCES)
FOREACH(ARG ${ARGN})
SET (MODE_CHANGED 0)
IF ("${ARG}" MATCHES SOURCES)
SET (MODE SOURCE_LIST)
SET(MODE_CHANGED 1)
ENDIF ()
IF ("${ARG}" MATCHES COMMANDS)
SET (MODE COMMANDS)
SET(MODE_CHANGED 1)
ENDIF ()
IF (NOT MODE_CHANGED)
IF (MODE MATCHES SOURCES)
SET(SOURCES ${SOURCES} ${ARG})
ENDIF ()
IF (MODE MATCHES COMMANDS)
SET(COMMANDS ${COMMANDS} ${ARG})
ENDIF ()
IF (MODE MATCHES SOURCE_LIST)
SET(SOURCE_LIST_NAME "${ARG}")
SET (MODE SOURCES)
ENDIF ()
ENDIF ()
ENDFOREACH()
VTK_WRAP_TCL3(${TARGET} ${SOURCE_LIST_NAME} "${SOURCES}" "${COMMANDS}")
ENDMACRO()
MACRO(VTK_WRAP_TCL3 TARGET SRC_LIST_NAME SOURCES COMMANDS)
if(NOT VTK_WRAP_TCL_INIT_EXE)
if(TARGET vtkWrapTclInit)
set(VTK_WRAP_TCL_INIT_EXE vtkWrapTclInit)
else()
message(SEND_ERROR
"VTK_WRAP_TCL_INIT_EXE not specified when calling VTK_WRAP_TCL3")
endif()
endif()
if(NOT VTK_WRAP_TCL_EXE)
if(TARGET vtkWrapTcl)
set(VTK_WRAP_TCL_EXE vtkWrapTcl)
else()
message(SEND_ERROR
"VTK_WRAP_TCL_EXE not specified when calling VTK_WRAP_TCL3")
endif()
endif()
# Initialize the custom target counter.
IF(VTK_WRAP_TCL_NEED_CUSTOM_TARGETS)
SET(VTK_WRAP_TCL_CUSTOM_COUNT "")
SET(VTK_WRAP_TCL_CUSTOM_NAME ${TARGET})
SET(VTK_WRAP_TCL_CUSTOM_LIST)
ENDIF()
# start writing the input file for the init file
SET(VTK_WRAPPER_INIT_DATA "${TARGET}")
IF (${ARGC} GREATER 4)
SET(VTK_WRAPPER_INIT_DATA
"${VTK_WRAPPER_INIT_DATA}\nVERSION ${ARGV4}")
ENDIF ()
# collect the common wrapper-tool arguments
set(_common_args)
if(VTK_WRAP_HINTS)
set(_common_args "${_common_args}--hints \"${VTK_WRAP_HINTS}\"\n")
endif()
if(KIT_HIERARCHY_FILE)
set(_common_args "${_common_args}--types \"${KIT_HIERARCHY_FILE}\"\n")
endif()
if(NOT VTK_ENABLE_KITS)
# write wrapper-tool arguments to a file
set(_args_file ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.$<CONFIGURATION>.args)
file(GENERATE OUTPUT ${_args_file} CONTENT "${_common_args}
$<$<BOOL:$<TARGET_PROPERTY:${TARGET},COMPILE_DEFINITIONS>>:
-D\"$<JOIN:$<TARGET_PROPERTY:${TARGET},COMPILE_DEFINITIONS>,\"
-D\">\">
$<$<BOOL:$<TARGET_PROPERTY:${TARGET},INCLUDE_DIRECTORIES>>:
-I\"$<JOIN:$<TARGET_PROPERTY:${TARGET},INCLUDE_DIRECTORIES>,\"
-I\">\">
")
else()
# all the include directories
if(VTK_WRAP_INCLUDE_DIRS)
set(TMP_INCLUDE_DIRS ${VTK_WRAP_INCLUDE_DIRS})
else()
set(TMP_INCLUDE_DIRS ${VTK_INCLUDE_DIRS})
endif()
foreach(INCLUDE_DIR ${TMP_INCLUDE_DIRS})
set(_common_args "${_common_args}-I\"${INCLUDE_DIR}\"\n")
endforeach()
get_directory_property(_def_list DEFINITION COMPILE_DEFINITIONS)
foreach(TMP_DEF ${_def_list})
set(_common_args "${_common_args}-D${TMP_DEF}\n")
endforeach()
# write wrapper-tool arguments to a file
string(STRIP "${_common_args}" CMAKE_CONFIGURABLE_FILE_CONTENT)
set(_args_file ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.args)
configure_file(${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in
${_args_file} @ONLY)
endif()
# for each class
FOREACH(FILE ${SOURCES})
# should we wrap the file?
GET_SOURCE_FILE_PROPERTY(TMP_WRAP_EXCLUDE ${FILE} WRAP_EXCLUDE)
# if we should wrap it
IF (NOT TMP_WRAP_EXCLUDE)
# what is the filename without the extension
GET_FILENAME_COMPONENT(TMP_FILENAME ${FILE} NAME_WE)
# the input file might be full path so handle that
GET_FILENAME_COMPONENT(TMP_FILEPATH ${FILE} PATH)
# compute the input filename
IF (TMP_FILEPATH)
SET(TMP_INPUT ${TMP_FILEPATH}/${TMP_FILENAME}.h)
ELSE ()
SET(TMP_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/${TMP_FILENAME}.h)
ENDIF ()
# add the info to the init file
SET(VTK_WRAPPER_INIT_DATA
"${VTK_WRAPPER_INIT_DATA}\n${TMP_FILENAME}")
# new source file is nameTcl.cxx, add to resulting list
SET(${SRC_LIST_NAME} ${${SRC_LIST_NAME}}
${TMP_FILENAME}Tcl.cxx)
# add custom command to output
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Tcl.cxx
DEPENDS ${VTK_WRAP_TCL_EXE}
${VTK_WRAP_HINTS}
${TMP_INPUT}
${_args_file}
${KIT_HIERARCHY_FILE}
COMMAND ${VTK_WRAP_TCL_EXE}
${TMP_HINTS}
@${_args_file}
-o ${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Tcl.cxx
${TMP_INPUT}
COMMENT "Tcl Wrapping - generating ${TMP_FILENAME}Tcl.cxx"
VERBATIM
)
# Add this output to a custom target if needed.
IF(VTK_WRAP_TCL_NEED_CUSTOM_TARGETS)
SET(VTK_WRAP_TCL_CUSTOM_LIST ${VTK_WRAP_TCL_CUSTOM_LIST}
${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Tcl.cxx)
SET(VTK_WRAP_TCL_CUSTOM_COUNT ${VTK_WRAP_TCL_CUSTOM_COUNT}x)
IF(VTK_WRAP_TCL_CUSTOM_COUNT MATCHES "^${VTK_WRAP_TCL_CUSTOM_LIMIT}$")
SET(VTK_WRAP_TCL_CUSTOM_NAME ${VTK_WRAP_TCL_CUSTOM_NAME}Hack)
ADD_CUSTOM_TARGET(${VTK_WRAP_TCL_CUSTOM_NAME} DEPENDS ${VTK_WRAP_TCL_CUSTOM_LIST})
SET(KIT_TCL_DEPS ${VTK_WRAP_TCL_CUSTOM_NAME})
SET(VTK_WRAP_TCL_CUSTOM_LIST)
SET(VTK_WRAP_TCL_CUSTOM_COUNT)
ENDIF()
ENDIF()
ENDIF ()
ENDFOREACH()
# finish the data file for the init file
FOREACH(CMD ${COMMANDS})
SET(VTK_WRAPPER_INIT_DATA
"${VTK_WRAPPER_INIT_DATA}\nCOMMAND ${CMD}")
ENDFOREACH()
SET(dir ${CMAKE_CURRENT_SOURCE_DIR})
CONFIGURE_FILE(
${VTK_CMAKE_DIR}/vtkWrapperInit.data.in
${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.data
@ONLY
)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.cxx
DEPENDS ${VTK_WRAP_TCL_INIT_EXE}
${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.data
COMMAND ${VTK_WRAP_TCL_INIT_EXE}
${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.data
${CMAKE_CURRENT_BINARY_DIR}/${TARGET}Init.cxx
COMMENT "Tcl Wrapping - generating ${TARGET}Init.cxx"
VERBATIM
)
# Create the Init File