VTK_PYTHON_OPTIONAL_LINK

In Windows using Anaconda Python 3.7.1, I had to switch this off in order to get a build. I was getting the following error:
LINK : fatal error LNK1104: cannot open file 'python37.lib'
It relates to this commit:
Merge topic ‘reenable-vtk-python-optional-link’

4c9c2e1a7a Remove the block preventing the use of VTK_PYTHON_OPTIONAL_LINK

Hmm. Our buildbots probably aren’t using 3.13 yet, so were oblivious to it.

Cc: @scottwittenburg The conditional check should probably be APPLE rather than FALSE while the other platform issues are tracked down.

Is that because it seems to be working on OSX? Is that a better way forward for the moment that reverting the previous topic?

I think whatever we end up doing, a round of ParaView testing needs to be done before it lands in VTK again.

I also had to set
VTK_PYTHON_OPTIONAL_LINK=OFF
and
VTK_WINDOWS_PYTHON_DEBUGGABLE=ON
to get it to build with Visual Studio 2017 on Windows 10 from the VTK master branch

I suspect that the VTK::Python code needs an update in the face of VTK_WINDOWS_PYTHON_DEBUGGABLE to use the debug library target. I don’t have Windows handy at the moment, but if you want to delve in, changing the vtk_python_target variable based on it would be the place to focus on.

It turns out VTK_PYTHON_OPTIONAL_LINK is off and hidden by default on Windows, so that wasn’t the issue.

The solution seems to be that VTK_WINDOWS_PYTHON_DEBUGGABLE should default to ON when building in debug mode, but I think that would require a feature change for CMake cmake_dependent_option()

Could you please file an issue describing the problem?

See https://gitlab.kitware.com/vtk/vtk/-/issues/17749. The problem seems to be here.
image

Setting VTK_WINDOWS_PYTHON_DEBUGGABLE=ON prevents UNDEF_DEBUG but this then requires some other trickery to get the python wrappers to use the release version - described here https://gitlab.kitware.com/paraview/paraview/-/issues/19428#note_919269