[vtkusers] How should one build a Custom VTK module library

Kamyar kgh5 at raymak.com
Mon Aug 6 20:22:35 EDT 2018


Thank you for your help Robert. The suggestion did get me further along
and I was able to build a static library. But I still had trouble with
ParaView and shared libraries. 

My main objective was to be able to have a Git repo of my code which was
independent of the VTK Git repo. I learned from your suggestion that
this would be called an External Module, which led me to
https://www.vtk.org/Wiki/VTK/Module_Development, and the following note:


EXTERNAL MODULES

 	* If you include a copy of the VTK source inside your project, you can
simply add new directories with module.cmake and CMakeLists.txt files in
them.

So I am now able to include my module in the VTK build without touching
any of the VTK source code using the above approach. I also figured out
that I need to enable my module in CMake under Advanced settings when
Configuring ParaView build. 

So, now I can build static VTK libraries to use in my standalone exe,
and shared VTK libs for use as ParaView plugin. I use the XML based
plugin definition which I manually load with ParaView plugin manager. 

Thank you 

Kamyar 

On 2018-08-06 22:32, Robert Maynard wrote:

> You will need to include the vtkExternalModuleMacros.cmake file for
> this approach to work. Something like the following should allow
> vtk_module_library to be a valid command:
> 
> set(CMAKE_MODULE_PATH
> ${CMAKE_MODULE_PATH}
> ${VTK_CMAKE_DIR}
> ${CMAKE_CURRENT_SOURCE_DIR}/cmake
> )
> include(vtkExternalModuleMacros)
> On Mon, Aug 6, 2018 at 1:42 PM Kamyar <kgh5 at raymak.com> wrote: 
> 
>> I have a couple of custom VTK filters. They are hacked into the VTK sources by adding them to the CMakeList of the existing General Filters module and built along with the entire VTK library. I use the resulting filters both in Paraview (shared libs), and in a little executable (static libs).
>> 
>> I assume I should be able to make VTK as is, then build my filters separately into a new library. But I can't figure out how to set up the CMakelist so the library can be built separately. Every example I can find for custom VTK filters builds them directly into an executable, not a library.
>> 
>> Am I supposed to be doing this as a VTK Remote Module? But there is nothing published in a journal, and I am not trying to share it with anyone.
>> 
>> Am I supposed to put them in as a Third-party submodule? But then they would still build along with the full VTK build.
>> 
>> Here is the attempted CMakeList, which produces the error: "Unknown CMake command "vtk_module_library".
>> 
>> find_package(VTK REQUIRED)
>> include(${VTK_USE_FILE})
>> 
>> set(Module_SRCS
>> ModelReduce.cxx
>> )
>> 
>> configure_file(
>> ${CMAKE_CURRENT_SOURCE_DIR}/ModelReduceExport.h.in
>> ${CMAKE_CURRENT_BINARY_DIR}/ModelReduceExport.h
>> )
>> 
>> vtk_module_library(vtkModelReduce ${Module_SRCS})
>> 
>> _______________________________________________
>> Powered by www.kitware.com [1]
>> 
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>> 
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>> 
>> Follow this link to subscribe/unsubscribe:
>> https://public.kitware.com/mailman/listinfo/vtkusers

 

Links:
------
[1] http://www.kitware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180807/eefdfaf6/attachment.html>


More information about the vtkusers mailing list