Commit 09594cf8 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Adding support to initialize xmls and CS streams.

parent f3c213c6
......@@ -294,6 +294,7 @@ else()
set (VTK_Group_ParaViewPython ${PARAVIEW_ENABLE_PYTHON} CACHE INTERNAL "" FORCE)
set (ParaViewModulesDirs
Utilities/ProcessXML
ThirdParty/protobuf
ParaViewCore/ClientServerStream
ParaViewCore/PythonSupport
......
......@@ -50,7 +50,7 @@ foreach (_module ${VTK_MODULES_ENABLED})
NOT VTK_MODULE_${_module}_IS_TEST AND
NOT VTK_MODULE_${_module}_THIRD_PARTY AND
(NOT _module STREQUAL "vtkPVServerManagerApplication") )
message("${_module} == Adding")
#message("${_module} == Adding")
set(vtk-module-init-functions
"${vtk-module-init-functions}extern \"C\" void ${_module}CS_Initialize(vtkClientServerInterpreter*);\n")
set(vtk-module-init-calls
......@@ -58,13 +58,57 @@ foreach (_module ${VTK_MODULES_ENABLED})
list(APPEND _dependencies ${_module}CS)
endif()
# TODO: We will do something similar for the XMLs too.
endforeach()
# Add link-dependencies on all wrapping classes.
target_link_libraries(vtkPVServerManagerApplication ${_dependencies})
#------------------------------------------------------------------------------
# Setup SM xmls.
#------------------------------------------------------------------------------
SET(resourceFiles
${CMAKE_CURRENT_SOURCE_DIR}/Resources/filters.xml
${CMAKE_CURRENT_SOURCE_DIR}/Resources/sources.xml
${CMAKE_CURRENT_SOURCE_DIR}/Resources/readers.xml
${CMAKE_CURRENT_SOURCE_DIR}/Resources/utilities.xml
${CMAKE_CURRENT_SOURCE_DIR}/Resources/rendering.xml
${CMAKE_CURRENT_SOURCE_DIR}/Resources/views_and_representations.xml
${CMAKE_CURRENT_SOURCE_DIR}/Resources/3d_widgets.xml
${CMAKE_CURRENT_SOURCE_DIR}/Resources/internal_writers.xml
${CMAKE_CURRENT_SOURCE_DIR}/Resources/writers.xml
)
if (PARAVIEW_ENABLE_PYTHON)
list(APPEND resourceFiles
${CMAKE_CURRENT_SOURCE_DIR}/Resources/pythonfilter.xml
)
endif(PARAVIEW_ENABLE_PYTHON)
set (PARAVIEW_SERVERMANAGER_XMLS ${resourceFiles}
CACHE INTERNAL "Server Manager XMLs")
get_target_property(kwprocessXML_location kwProcessXML LOCATION)
add_custom_target(vtkPVServerManagerApplicationXMLs
DEPENDS ${resourceFiles} kwProcessXML
#"${CMAKE_CURRENT_BINARY_DIR}/vtkParaViewIncludeModulesToSMApplication.h"
COMMAND ${kwprocessXML_location}
${CMAKE_CURRENT_BINARY_DIR}/vtkSMGeneratedModules.h
vtkSMDefaultModules Interface GetInterfaces
${resourceFiles}
COMMENT "generating modules")
add_dependencies(vtkPVServerManagerApplication
vtkPVServerManagerApplicationXMLs)
set (xml_init_code "")
foreach(rf ${resourceFiles})
string(REGEX REPLACE "^.*/(.*).(xml|pvsm)$" "\\1" moduleName "${rf}")
set (oneModule
" init_string = vtkSMDefaultModules${moduleName}GetInterfaces();
xmls.push_back(init_string);
delete[] init_string; init_string = NULL;")
set(xml_init_code
"${xml_init_code}\n${oneModule}")
endforeach()
#------------------------------------------------------------------------------
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/vtkPVInitializer.h.in
......
......@@ -5,4 +5,6 @@ vtk_module(vtkPVServerManagerApplication
# When creating a "custom" application, simply change this to
# depend on the appropriate module.
vtkPVServerManagerDefault
COMPILE_DEPENDS
vtkUtilitiesProcessXML
)
......@@ -28,8 +28,6 @@ PURPOSE. See the above copyright notice for more information.
#include <string>
#include <vtksys/ios/sstream>
static void vtkInitializationHelperInit(vtkClientServerInterpreter*);
//----------------------------------------------------------------------------
void vtkInitializationHelper::Initialize(const char* executable, int type)
{
......@@ -79,8 +77,7 @@ void vtkInitializationHelper::Initialize(int argc, char**argv,
// compatible with the version of the headers we compiled against.
GOOGLE_PROTOBUF_VERIFY_VERSION;
vtkClientServerInterpreterInitializer::GetInitializer()->
RegisterCallback(&::vtkInitializationHelperInit);
PARAVIEW_INITIALIZE();
vtkProcessModule::Initialize(
static_cast<vtkProcessModule::ProcessTypes>(type), argc, argv);
......@@ -132,36 +129,3 @@ void vtkInitializationHelper::Finalize()
// Optional: Delete all global objects allocated by libprotobuf.
google::protobuf::ShutdownProtobufLibrary();
}
//-----------------------------------------------------------------------------
/*
* PARAVIEW_MINIMIUM if enabled, initializes only required set of classes.
* The mechanism is specified in the Servers/ServerManager/CMakeList.txt
* Otherwise the entire vtk+paraview class list will be included.
*
* @param pm IN used to pass the interpreter for every *_Initialize function.
*/
void vtkInitializationHelperInit(vtkClientServerInterpreter* interp)
{
// defined in vtkPVInitializer.h
PARAVIEW_CSSTREAMS_INITIALIZE(interp);
//#ifdef PARAVIEW_MINIMAL_BUILD
// vtkParaviewMinInit_Initialize(interp);
//#else
// // Initialize built-in wrapper modules.
// @vtk-module-init-calls@
// vtkPVCommonCS_Initialize(interp);
// vtkPVVTKExtensionsCS_Initialize(interp);
// vtkPVClientServerCoreCS_Initialize(interp);
// vtkPVServerImplementationCS_Initialize(interp);
// vtkPVServerManager_Initialize(interp);
// vtkXdmfCS_Initialize(interp);
//
//# ifdef PARAVIEW_USE_VISITBRIDGE
// vtkVisItAVTAlgorithmsCS_Initialize(interp);
// vtkVisItDatabasesCS_Initialize(interp);
//# endif
//#endif
}
......@@ -15,6 +15,12 @@
// THIS IS A GENERATED FILE -- DO NOT EDIT ---
#ifndef __vtkPVInitializer_h
#define __vtkPVInitializer_h
#include "vtkPVConfig.h"
#include "vtkSMGeneratedModules.h" // vtkPVConfig must be included before this
// file.
#include "vtkPVPlugin.h"
#include "vtkPVServerManagerPluginInterface.h"
class vtkClientServerInterpreter;
......@@ -24,5 +30,62 @@ void PARAVIEW_CSSTREAMS_INITIALIZE(vtkClientServerInterpreter* interp)
@vtk-module-init-calls@
}
class vtkPVInitializerPlugin : public vtkPVPlugin,
public vtkPVServerManagerPluginInterface
{
// Description:
// Returns the name for this plugin.
virtual const char* GetPluginName()
{return "vtkPVInitializerPlugin"; }
// Description:
// Returns the version for this plugin.
virtual const char* GetPluginVersionString() { return "0.0"; }
// Description:
// Returns true if this plugin is required on the server.
virtual bool GetRequiredOnServer() { return false; }
// Description:
// Returns true if this plugin is required on the client.
virtual bool GetRequiredOnClient() {return false;}
// Description:
// Returns a ';' separated list of plugin names required by this plugin.
virtual const char* GetRequiredPlugins() { return ""; }
// Description:
// Provides access to binary resources compiled into the plugin.
// This is primarily used to compile in icons and compressed help project
// (qch) files into plugins.
virtual void GetBinaryResources(std::vector<std::string>&) {}
// Description:
// Obtain the server-manager configuration xmls, if any.
virtual void GetXMLs(std::vector<std::string> &xmls)
{
(void) xmls;
char* init_string = NULL;
@xml_init_code@
(void) init_string;
}
// Description:
// Returns the callback function to call to initialize the interpretor for the
// new vtk/server-manager classes added by this plugin. Returning NULL is
// perfectly valid.
virtual vtkClientServerInterpreterInitializer::InterpreterInitializationCallback
GetInitializeInterpreterCallback()
{
return PARAVIEW_CSSTREAMS_INITIALIZE;
}
};
void PARAVIEW_INITIALIZE()
{
static vtkPVInitializerPlugin instance;
vtkPVPlugin::ImportPlugin(&instance);
}
#endif
// THIS IS A GENERATED FILE -- DO NOT EDIT ---
#==========================================================================
#
# Program: ParaView
#
# Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
# All rights reserved.
#
# ParaView is a free software; you can redistribute it and/or modify it
# under the terms of the ParaView license version 1.2.
#
# See License_v1.2.txt for the full ParaView license.
# A copy of this license can be obtained by contacting
# Kitware Inc.
# 28 Corporate Drive
# Clifton Park, NY 12065
# USA
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#==========================================================================
vtk_module_impl()
if (NOT CMAKE_CROSSCOMPILING)
vtk_add_executable(kwProcessXML ProcessXML.cxx)
vtk_module_export("")
target_link_libraries(kwProcessXML
vtkCommonCore)
endif()
vtk_module(vtkUtilitiesProcessXML
DEPENDS
vtkCommonCore
vtksys
EXCLUDE_FROM_WRAPPING)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment