New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"vtk_module_config" removed from VTK #424

Open
fbudin69500 opened this Issue Jan 17, 2019 · 15 comments

Comments

Projects
None yet
5 participants
@fbudin69500
Copy link
Contributor

fbudin69500 commented Jan 17, 2019

Description

VtkGlue doesn't compile with latest version of VTK (new module structure). I expect LevelSetsv4Visualization to have the same problem.

Steps to Reproduce

  1. Clone VTK github repository and compile it
  2. Compile ITK with VtkGlue ON

Expected behavior

CMake should configure the project correctly.

Actual behavior

Currently, the following CMake error is printed:

Unknown CMake command "vtk_module_config"

Reproducibility

All the time.

Versions

VTK version > 8.2.0 will have this problem as the required CMake macro used by ITK to configure the remote modules that use VTK has been removed from VTK in commit 8d61ac62bfb3c532d1d3506d5f7fd495e49c4295.

Environment

Ubuntu 18.04 but this should happen on any environment.

Additional Information

This issue arises because the VTK module system has been fully reworked. A person that knows the new module system could probably fix the problem really fast. Information about the new VTK module system should be posted in this issue to help the person that is going to fix this problem.

@dzenanz

This comment has been minimized.

Copy link
Member

dzenanz commented Jan 17, 2019

LevelSetsv4Visualization has been broken for a while, see Corista build here, but it has been manifesting itself as runtime error when visualizing something is attempted.

LevelSetsv4Visualization's CMake code seems to be mostly duplicated from VTKGlue. It would be good if that duplication is gotten rid of, and simple dependency between them is introduced.

@fbudin69500

This comment has been minimized.

Copy link
Contributor Author

fbudin69500 commented Jan 17, 2019

@seanm

This comment has been minimized.

Copy link
Contributor

seanm commented Jan 17, 2019

@seanm CC'ing myself...

@schmidje

This comment has been minimized.

Copy link

schmidje commented Jan 22, 2019

I can confirm this issue is also happening in Windows (visual studio 2017).

edit:

I added the following after set(ITKVtkGlue_LIBRARIES ITKVtkGlue) of VtkGlue's CMakeLists.txt file:

if(NOT COMMAND vtk_module_config)
  macro(vtk_module_config ns)   
     foreach(arg ${ARGN})  
      if(${arg} MATCHES "^[Vv][Tt][Kk]")
        string(REGEX REPLACE "^[Vv][Tt][Kk]" "" _arg ${arg})
      else()
        set(_arg ${arg})
      endif()
      set(${ns}_LIBRARIES ${${ns}_LIBRARIES} VTK::${_arg})
     endforeach()
  endmacro()
  
  if(NOT VTK_RENDERING_BACKEND)
    set(VTK_RENDERING_BACKEND OpenGL2)
  endif()
endif()

This should not interfere with other vtk versions not using new target building. I added OpenGL2 rendering because vtkRenderingOpenGL is not defined as a valid target in my case. Maybe this is not necessary.

This is a quick and dirty hack to build ITKVtkGlue, I have yet to check that external projects linking against ITKVtkGlue work properly. I use vtk 8.9 and itk 5.0.

@seanm

This comment has been minimized.

Copy link
Contributor

seanm commented Jan 23, 2019

VTK's new module system was merged exactly 2 weeks ago now (January 9), any chance ITK can be working with VTK again soon?

@seanm

This comment has been minimized.

Copy link
Contributor

seanm commented Feb 5, 2019

So I guess nobody at Kitware uses VTK & ITK together? :(

@dzenanz

This comment has been minimized.

Copy link
Member

dzenanz commented Feb 5, 2019

There are many combinations of versions and modules, so not all are routinely used/tested.

@seanm

This comment has been minimized.

Copy link
Contributor

seanm commented Feb 5, 2019

If I'm not mistaken, it's not an obscure combination that's broken, but a vanilla VTK git master + ITK git master. It's been broken since Kitware made the big build system changes in VTK the other week.

@thewtex

This comment has been minimized.

Copy link
Member

thewtex commented Feb 6, 2019

@schmidje well done on the update! Could it be contributed to the repository?

@schmidje

This comment has been minimized.

Copy link

schmidje commented Feb 6, 2019

@thewtex Well itk does build but I had to add additional mess on the file to be able to use ITKVtkGlue outside of itk, and honestly I am definitively not sure that the fixes will work. In this context, itk gurus of the cmake modules should instead investigate closely the issue....

I also found that the exported targets do NOT include the include paths of the targets... (whereas vtk does it properly in the new update) which somehow reduce the interest as you cannot just use a target_link_library(...someItkModule...) and have the include paths set automatically. But this is another story...!

@thewtex

This comment has been minimized.

Copy link
Member

thewtex commented Feb 6, 2019

@schmidje did you also add the compatibility macro to ITKVtkGlue_EXPORT_CODE_INSTALL and ITKVtkGlue_EXPORT_CODE_BUILD?

@schmidje

This comment has been minimized.

Copy link

schmidje commented Feb 6, 2019

@thewtex Well it looks like I did:

I put in the ITKVtkGlue_EXPORT_CODE_INSTALL part:

set(ITKVtkGlue_EXPORT_CODE_INSTALL "
set(VTK_DIR \"${VTK_DIR}\")

find_package(VTK NO_MODULE REQUIRED)

# included part starts here
  if(NOT COMMAND vtk_module_config)
    macro(vtk_module_config ns)   
       foreach(arg \${ARGN})  
        if(\${arg} MATCHES \"^[Vv][Tt][Kk]\")
          string(REGEX REPLACE \"^[Vv][Tt][Kk]\" \"\" _arg \${arg})
        else()
          set(_arg \${arg})
        endif()
        set(\${ns}_LIBRARIES \${\${ns}_LIBRARIES} VTK::\${_arg})
       endforeach()
    endmacro()
  endif()
# included part ends here

if(NOT VTK_VERSION)

(...continues)
")

Then in the ITKVtkGlue_EXPORT_CODE_BUILD I did the same:

set(ITKVtkGlue_EXPORT_CODE_BUILD "
if(NOT ITK_BINARY_DIR)
  set(VTK_DIR \"${VTK_DIR}\")
  
# included part starts here
  if(NOT COMMAND vtk_module_config)
    macro(vtk_module_config ns)   
       foreach(arg \${ARGN})  
        if(\${arg} MATCHES \"^[Vv][Tt][Kk]\")
          string(REGEX REPLACE \"^[Vv][Tt][Kk]\" \"\" _arg \${arg})
        else()
          set(_arg \${arg})
        endif()
        set(\${ns}_LIBRARIES \${\${ns}_LIBRARIES} VTK::\${_arg})
       endforeach()
    endmacro()
  endif()
# included part ends here

  find_package(VTK NO_MODULE REQUIRED)
(...continues)
")
@thewtex

This comment has been minimized.

Copy link
Member

thewtex commented Feb 6, 2019

@schmidje nice. Could you please create a pull request with the current WIP, so you get credit for your work?

CC: @mathstuf

@seanm

This comment has been minimized.

Copy link
Contributor

seanm commented Feb 8, 2019

@lorensen Bill, maybe since you got all the VTKExamples working with the recent VTK changes, you would know how to get ITK working with VTK again?

@schmidje

This comment has been minimized.

Copy link

schmidje commented Feb 10, 2019

@thewtex Well I could but first I would like to make sure it is working properly. I messed up some stuff with the update of itk, so I will try to make a test asap.

BR

@thewtex thewtex added this to the ITK v4.13.2 milestone Feb 11, 2019

@thewtex thewtex removed this from the ITK v4.13.2 milestone Feb 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment