[CMake] [Paraview] Plugin Basics

Michael Jackson mike.jackson at bluequartz.net
Tue Dec 2 15:51:21 EST 2008


Gaaahhhhh....

I'm using a variable (SOURCES) that is actually an optional argument  
to the ADD_PARAVIEW_PLUGIN() macro.


If I change SET (SOURCES ${ParaViewExamples_SOURCE_DIR}/ 
vtkMyElevationFilter.cxx) to

SET (_SOURCES ${ParaViewExamples_SOURCE_DIR}/vtkMyElevationFilter.cxx)
ADD_PARAVIEW_PLUGIN(SMMyElevation "1.0"
  SERVER_MANAGER_XML MyElevationFilter.xml
  SERVER_MANAGER_SOURCES "${_SOURCES}"
# SERVER_MANAGER_SOURCES vtkMyElevationFilter.cxx
  )

then everything works.

Hmm. I was thinking that cmake would have done the variable  
substitution FIRST before sending it to the macro.

Is this a bug or feature?

Mike


On Dec 2, 2008, at 3:44 PM, Mike Jackson wrote:

> Working from the examples provided with ParaView I have narrowed  
> down the problem to the following:
>
> ADD_PARAVIEW_PLUGIN(SMMyElevation "1.0"
>  SERVER_MANAGER_XML MyElevationFilter.xml
> # SERVER_MANAGER_SOURCES "${SOURCES}"
>  SERVER_MANAGER_SOURCES vtkMyElevationFilter.cxx
>  )
>
> If the project is configured and compiled as is then the  
> vtkMyElevationFilter.cxx is compiled.
>
> If you then try the following:
>
> SET (SOURCES ${ParaViewExamples_SOURCE_DIR}/vtkMyElevationFilter.cxx)
> ADD_PARAVIEW_PLUGIN(SMMyElevation "1.0"
>  SERVER_MANAGER_XML MyElevationFilter.xml
>  SERVER_MANAGER_SOURCES "${SOURCES}"
> # SERVER_MANAGER_SOURCES vtkMyElevationFilter.cxx
>  )
>
> then the file is NOT compiled. Tracing into the actual  
> ADD_PARAVIEW_PLUGIN macro and placing some message() commands there  
> is something odd happening in there.
>
> -- ARG_/Users/Shared/Kitware-CVS/ParaView3/Examples/Plugins/Filter/ 
> vtkMyElevationFilter.cxx-- ARG_SERVER_MANAGER_SOURCES:
>
> where as in the run that actually works I get:
>
> -- ARG_SERVER_MANAGER_SOURCES vtkMyElevationFilter.cxx
> -- ARG_SERVER_MANAGER_SOURCES: vtkMyElevationFilter.cxx
>
> Is this a bug or just something I am doing wrong?
>
> Mike
>
>
> On Dec 2, 2008, at 2:54 PM, Michael Jackson wrote:
>
>> I am trying to update my plugin creator and I am coming up against  
>> some issues that I am not sure how to solve because I am basically  
>> confused as to what is going wrong. Here is the CMakeLists.txt file  
>> that I generate:
>>
>> project(MyPlugin)
>> cmake_minimum_required(VERSION 2.4)
>> if(COMMAND cmake_policy)
>>     cmake_policy(SET CMP0003 NEW)
>> endif(COMMAND cmake_policy)
>>
>> # Configure output directories.
>> SET (LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/Bin"
>>    CACHE INTERNAL "For libraries.")
>> SET (EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/Bin"
>>    CACHE INTERNAL "For executables.")
>>
>>
>> # -- Set the Module Name
>> SET(MODULE_NAME MyPlugin)
>> # -- Find ParaView -----
>> FIND_PACKAGE(ParaView REQUIRED)
>> INCLUDE(${PARAVIEW_USE_FILE})
>> INCLUDE_DIRECTORIES(    "${CMAKE_CURRENT_BINARY_DIR}"
>>                       "${MyPlugin_SOURCE_DIR}/src/"
>> )
>> #-- List our source files --
>> #SET (SOURCES ${SOURCES} ${MyPlugin_SOURCE_DIR}/src/.cpp)
>> SET (SOURCES ${SOURCES} ${MyPlugin_SOURCE_DIR}/src/vtkMyReader.cpp)
>> #SET (SOURCES ${SOURCES} ${MyPlugin_SOURCE_DIR}/src/.cpp)
>>
>>
>> # -- Add the Plugin to ParaView -----
>> ADD_PARAVIEW_PLUGIN(MyPlugin "1.0"
>> SERVER_MANAGER_SOURCES ${SOURCES}
>> SERVER_MANAGER_XML ${MyPlugin_SOURCE_DIR}/XMLFiles/MyPlugin_pvsm.xml
>> GUI_RESOURCE_FILES ${MyPlugin_SOURCE_DIR}/XMLFiles/MyPlugin_gui.xml
>> )
>>
>>
>> When I run cmake and then compile the project I get:
>>
>> -- Build files have been written to: /Users/mjackson/Workspace/ 
>> MyPlugin/Build
>> [ 14%] Generating vtkSMXML_MyPlugin.h
>> -- Generate module: MyPlugin_pvsm
>> [ 28%] Generating moc_MyPluginPluginImplementation.cxx
>> [ 42%] Generating qrc_MyPlugin.cxx
>> Scanning dependencies of target MyPlugin
>> [ 57%] Building CXX object CMakeFiles/MyPlugin.dir/ 
>> moc_MyPluginPluginImplementation.o
>> [ 71%] Building CXX object CMakeFiles/MyPlugin.dir/ 
>> MyPluginPluginImplementation.o
>> [ 85%] Building CXX object CMakeFiles/MyPlugin.dir/qrc_MyPlugin.o
>> [100%] Building CXX object CMakeFiles/MyPlugin.dir/ 
>> vtkPVPluginInit_MyPlugin.o
>> Linking CXX shared library Bin/libMyPlugin.dylib
>> [100%] Built target MyPlugin
>>
>>
>> No where in there is anything about the vtkMyReader.cpp being  
>> compiled. Um.. What am I missing?
>>
>>
>> Thanks
>> _________________________________________________________
>> Mike Jackson                  mike.jackson at bluequartz.net
>> BlueQuartz Software                    www.bluequartz.net
>> Principal Software Engineer                  Dayton, Ohio



More information about the CMake mailing list