Skip to content

Conversation

@phcerdan
Copy link
Contributor

In modern VTK (> 8.90) the COMPONENT names don't have the "vtk" prefix.

This fix get the VTK version first, and then look for the COMPONENTS
with the right name, prepending ${_vtk_prefix} to the names.

Fix #241

@phcerdan phcerdan force-pushed the update_vtk_module_names_9 branch from 81195e0 to 4efbf33 Compare March 17, 2021 16:09
@phcerdan
Copy link
Contributor Author

phcerdan commented Mar 17, 2021

Windows-2019 error in CI is one of those filepath is too long from Windows...

@aylward
Copy link
Member

aylward commented Mar 17, 2021

This brings up the issue of whether or not ITKVtkGlue should be a requirement or not. At the top level CMakeLists.txt, the find_package(VTK) is conditional on ITKVtkGlue being enabled...and ITKVtkGlue requires QuickView.h which is part of ITKVtkGlue. I think we need to add ITKVtkGlue as a dependency in itk-modules so that order of building works.

@thewtex @dzenanz

@thewtex
Copy link
Member

thewtex commented Mar 17, 2021

This brings up the issue of whether or not ITKVtkGlue should be a requirement or not. At the top level CMakeLists.txt, the find_package(VTK) is conditional on ITKVtkGlue being enabled. We can either remove this condition or we need to make certain examples conditional on ITKVtkGlue being enabled (since they require VTK).

Checking this:

InsightSoftwareConsortium/ITKSoftwareGuide#150

It looks like it would make more sense to make ENABLE_QUICKVIEW a CMake cache option, then change the condition from if(Module_ITKVtkGlue to if(ENABLE_QUICKVIEW.

@aylward
Copy link
Member

aylward commented Mar 17, 2021

@thewtex -- QuickView.h is required by the code in SphinxExamples that are used by the VTK examples. QuickView.h is in ITK/Bridge/VTKGlue. I believe that means that we need to add VTKGlue as a dependency, but perhaps not?

@thewtex
Copy link
Member

thewtex commented Mar 17, 2021

QuickView.h is in ITK/Bridge/VTKGlue. I believe that means that we need to add VTKGlue as a dependency, but perhaps not?

Good catch. In that case the current setup seems desirable, correct? If we have ITKVtkGlue enabled, we can use the QuickView functionality, but we are not required to have a working ITKVtkGlue / VTK build.

@aylward
Copy link
Member

aylward commented Mar 17, 2021

I was getting QuickView.h not found, unless I added ITKVtkGlue as a depends in itk-modules.cmake. Perhaps that depends is needed for the path to be specified?

@phcerdan
Copy link
Contributor Author

Maybe there are some examples that require a if(ENABLE_QUICKVIEW) conditional.

add_subdirectory_if_module_enabled(VtkGlue)

@phcerdan
Copy link
Contributor Author

I cannot reproduce the QuickView.h not found after switching OFF the module VtkGlue in ITK.
The ENABLE_QUICKVIEW turns off in that case, but everything compiles.

@aylward
Copy link
Member

aylward commented Mar 17, 2021 via email

@aylward
Copy link
Member

aylward commented Mar 17, 2021 via email

@dzenanz
Copy link
Member

dzenanz commented Mar 17, 2021

There is also https://github.com/InsightSoftwareConsortium/ITKVTKGlue, so there could be some confusion between them. The remote one does not have ITK prefix in the name, the built-in one does.

@thewtex
Copy link
Member

thewtex commented Mar 17, 2021

To avoid complexity and modernize, I am wondering if we should replace the QuickView usage in the examples with Jupyter notebooks (and eventually vtk.js)? What do you think?

@phcerdan
Copy link
Contributor Author

The name is ITKVtkGlue. I was referring to that one.

@phcerdan
Copy link
Contributor Author

I think this could be simplified even more, we already do a find_package(VTK) in the top CMakeLists, where ENABLE_QUICKVIEW is set. Here:

set(ENABLE_QUICKVIEW ON)

We can set _vtk_prefix there.

@phcerdan phcerdan marked this pull request as draft March 17, 2021 19:16
@dzenanz
Copy link
Member

dzenanz commented Mar 17, 2021

Then individual examples would not be self-contained.

@phcerdan phcerdan force-pushed the update_vtk_module_names_9 branch from 4efbf33 to 3172250 Compare March 17, 2021 19:33
@phcerdan
Copy link
Contributor Author

phcerdan commented Mar 17, 2021

Last push re-use _vtk_prefix defined at top level when ITK has ITKVtkGlue (to reuse the find_package(VTK) there)

Individual examples define their own _vtk_prefix with the extra find_package(VTK)

@phcerdan phcerdan marked this pull request as ready for review March 17, 2021 19:36
@aylward
Copy link
Member

aylward commented Mar 17, 2021 via email

find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

find_package(VTK REQUIRED)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will change stand-alone build behavior of this and other similar examples. They used to work fine with VTK8- and throw a configure warning with VTK9+. Now they will work fine with VTK9+, but fail to work with VTK8-.

Copy link
Member

@dzenanz dzenanz Mar 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming that _vtk_prefix will be undefined (and therefore empty) if being built stand-alone.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you think this first find_package will change that? VTK is required anyway in these cases.

@thewtex
Copy link
Member

thewtex commented Mar 17, 2021

Do we need to declare a conditional depends on itkvtkglue in
itk-modules.init?

That may help when built as a remote module, but would need to be tested.

@thewtex
Copy link
Member

thewtex commented Mar 17, 2021

We may just want to support the latest released version of VTK, i.e. VTK 9, here to keep things simple.

@phcerdan
Copy link
Contributor Author

Do we need to declare a conditional depends on itkvtkglue in itk-modules.init?

I am not sure anything related to ITKVtkGlue has changed here, if this is tackled, should be in other PR.
These changes work with and without ITKVtkGlue (tested in remote/external build defining -DITK_DIR=...)

@phcerdan
Copy link
Contributor Author

This PR seems long, but is not complex, it defines _vtk_prefix based on VTK_VERSION. This requires an extra find_package(VTK) without components.
In the case ITK has the module ITKVtkGlue, we already find_package(VTK) in the top CMakelists.txt, so we take advantage and define _vtk_prefix there, at the top level.

The standalone examples define their own _vtk_prefix with an extra find_package(VTK).

@thewtex
Copy link
Member

thewtex commented Mar 18, 2021

@phcerdan could this please be rebased on master for a clean CI so we can get it merged? Gracias!

@phcerdan phcerdan force-pushed the update_vtk_module_names_9 branch from 3172250 to 222bd3d Compare March 18, 2021 11:01
In modern VTK (> 8.90) the COMPONENT names don't have the "vtk" prefix.

This fix get the VTK version first, and then look for the COMPONENTS
with the right name, prepending ${_vtk_prefix} to the names.

The examples using ITKVtkGlue (`ENABLE_QUICKVIEW` = ON) re-use the variable
`_vtk_prefix` defined in the top CMakeLists.

The examples that depend on `VTK` and `ITK without ITKVTKGlue` set
`_vtk_prefix` by their own.

Fix InsightSoftwareConsortium#241
@phcerdan phcerdan force-pushed the update_vtk_module_names_9 branch from 222bd3d to 9c045a1 Compare March 18, 2021 11:02
@phcerdan
Copy link
Contributor Author

Rebased on top of master @thewtex

Copy link
Member

@thewtex thewtex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phcerdan thanks!

@thewtex thewtex merged commit ddbd361 into InsightSoftwareConsortium:master Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update name of VTK components to be aware of VTK 9.0 changes.

4 participants