Skip to content
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

Add the ParMmg VTK components requirement if Mmg is built with -DPMMG_CALL arg #233

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions cmake/modules/optional-dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,24 @@ ENDIF ( )
SET ( USE_VTK "" CACHE STRING "Use VTK I/O (ON, OFF or <empty>)" )
SET_PROPERTY(CACHE USE_VTK PROPERTY STRINGS "ON" "OFF" "")

IF ( PMMG_CALL )
SET ( PMMG_VTK_MESS "Mmg -" )
ENDIF ( )


IF ( NOT DEFINED USE_VTK OR USE_VTK STREQUAL "" OR USE_VTK MATCHES " +" OR USE_VTK )
# Variable is not provided by the user or is setted to on

# Handle vtk components name change between v8.2 and v9
# Before v9
FIND_PACKAGE(VTK QUIET)
IF ( VTK_FOUND )
message (STATUS "VTK_VERSION: ${VTK_VERSION}")
message (STATUS "${PMMG_VTK_MESS} VTK_VERSION: ${VTK_VERSION}")

IF ( PMMG_CALL )
SET ( PMMG_VTK_COMP "vtkParallelCore vtkParallelMPI" )
ENDIF ( )

IF (VTK_VERSION VERSION_LESS "9.0.0")
find_package(VTK COMPONENTS
vtkCommonCore
Expand All @@ -117,8 +127,14 @@ IF ( NOT DEFINED USE_VTK OR USE_VTK STREQUAL "" OR USE_VTK MATCHES " +" OR USE_V
vtkIOParallel
vtkIOParallelXML
vtkIOXML
${PMMG_VTK_COMP}
QUIET)
ELSE()

IF ( PMMG_CALL )
SET ( PMMG_VTK_COMP "ParallelCore ParallelMPI" )
ENDIF ( )

# After v9
FIND_PACKAGE(VTK COMPONENTS
CommonCore
Expand All @@ -127,20 +143,21 @@ IF ( NOT DEFINED USE_VTK OR USE_VTK STREQUAL "" OR USE_VTK MATCHES " +" OR USE_V
IOParallel
IOParallelXML
IOXML
${PMMG_VTK_COMP}
QUIET)
ENDIF()

ELSEIF ( USE_VTK )
# USE_VTK is not empty so user explicitely ask for VTK...
# but it is not found: raise an error
MESSAGE(FATAL_ERROR "VTK library not found.")
MESSAGE(FATAL_ERROR "${PMMG_VTK_MESS} VTK library not found.")
ENDIF()
ENDIF()

IF ( VTK_FOUND AND NOT USE_VTK MATCHES OFF)
add_definitions(-DUSE_VTK)

MESSAGE ( STATUS "Compilation with VTK: add vtk, vtp and vtu I/O." )
MESSAGE ( STATUS "${PMMG_VTK_MESS} Compilation with VTK: add vtk, vtp and vtu I/O." )

IF( "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" LESS 8.90 )
INCLUDE ( ${VTK_USE_FILE} )
Expand Down