CMakeLists.txt for Catalyst 5.8

I’m working with @joeh to instrument a code with Catalyst and we’re having a tough time writing the CMakeLists.txt for the adapter for ParaView master (almost v5.8). I have something that’s working on my machine for the Fortran90FullExample but when Joe tries the same CMakeLists.txt he has a lot of linking issues so I’m guessing I’m not doing something correctly. My CMakeLists.txt is:

cmake_minimum_required(VERSION 3.14)
# C isn't stricly necessary for the project but it helps
# with finding the C MPI library
project(Fortran90FullExample Fortran CXX C)
find_package(MPI)

find_package(ParaView CONFIG COMPONENTS Catalyst PythonCatalyst)
if(NOT ParaView_FOUND)
  message("cannot find paraview")
  return()
endif()

add_executable(Fortran90FullExample
  FECxxAdaptor.cxx
  FEDriver.f90
  FEFortranAdaptor.f90)

target_link_libraries(Fortran90FullExample
  PRIVATE
    ${ParaView_LIBRARIES} ${VTK_LIBRARIES}
    MPI::MPI_Fortran)
set_property(TARGET Fortran90FullExample
  PROPERTY
    LINKER_LANGUAGE Fortran)

I looked at the ParaView Catalyst Guide for 5.8 and Section 3.7 still has the old way, i.e. ParaView 5.6 and earlier, for doing things. What’s the correct way to do this now?

As a side note, the guide also has the old editions stuff still in there and should also be updated.

Thanks,
Andy

Use ParaView::Catalyst and ParaView::PythonCatalyst here. You should also list the VTK modules you need explicitly.

There are docs in the repository. I guess they probably need updated for “normal” usage migration patterns (they just document plugin migration for now).

Ok, here’s what I changed it to:

cmake_minimum_required(VERSION 3.14)
# C isn't stricly necessary for the project but it helps
# with finding the C MPI library
project(Fortran90FullExample Fortran CXX C)
find_package(MPI)

find_package(ParaView CONFIG COMPONENTS Catalyst PythonCatalyst)
if(NOT ParaView_FOUND)
  message("cannot find paraview")
  return()
endif()

add_executable(Fortran90FullExample
  FECxxAdaptor.cxx
  FEDriver.f90
  FEFortranAdaptor.f90)

target_link_libraries(Fortran90FullExample
  PRIVATE
    ParaView::Catalyst ParaView::PythonCatalyst VTK::CommonDataModel
    MPI::MPI_Fortran)
set_property(TARGET Fortran90FullExample
  PROPERTY
    LINKER_LANGUAGE Fortran)

I probably don’t need quite that high of a CMake minimum version but that’s the version I’m using on my machine.

It looks good to me. Does that work? :slight_smile:

Yep, it’s working for me. I’ll check with @joeh though since my version was working before for me as well but wasn’t working for him on his machine.

@joeh says that this works for him with Python 2 on a Onyx@ERDC for master right now but it is having trouble finding Python 3. Should that be the case?

It should be if Python 3 isn’t installed on the machine :slight_smile: . Is it? We need headers as well, so the -dev or -devel package is needed too. It should say why it can’t find Python 3 (as in what bits are missing), so that output would be helpful.

Well, ParaView was built fine with Python 3. It was just the Catalyst example that was having issues finding Python 3, if I remember what @joeh said. And by finding Python 3 I mean I think it was a linking issue and not a CMake configure issue, but again I’m just guessing here as much as you are since I didn’t see the error.

Oh. Try the VTK_OPTIONAL_PYTHON_LINK flag if your deployment isn’t going to be “Python-flexible” and only use the one that was built against.

I was having problems with the CMake configuration for the Catalyst example not finding Python3 even though the ParaView superbuild was made with Python3, and even though the Python2 variant worked it did not use the one from the superbuild again instead it used the one from the system. So it is correct to think that if the system had Python3 installed in the default location it might have worked, but why can it not use the version of Python2 or Python3 that the superbuild built the ParaView 5.8.0 git master with.

Thanks,

Joe

Is it VTK/ParaView finding Python3 that fails or is it the project finding Python3 on its own that fails?

If the latter, is it doing find_package(PythonX) or the find_package(PythonInterp) and find_package(PythonLibs) pair?

it is this code that is failing to find Python3

`cmake_minimum_required(VERSION 3.14)
project(Fortran90FullExample Fortran CXX C)
find_package(MPI)

find_package(ParaView CONFIG COMPONENTS Catalyst PythonCatalyst)
if(NOT ParaView_FOUND)
message(“cannot find paraview”)
return()
endif()

add_executable(Fortran90FullExample
FECxxAdaptor.cxx
FEDriver.f90
FEFortranAdaptor.f90)

target_link_libraries(Fortran90FullExample
PRIVATE
ParaView::Catalyst ParaView::PythonCatalyst VTK::CommonDataModel
MPI::MPI_Fortran)
set_property(TARGET Fortran90FullExample
PROPERTY
LINKER_LANGUAGE Fortran)
`