From: Anthony Geay Date: Wed, 23 Mar 2022 05:18:04 +0000 (+0100) Subject: Forward SALOME_USE_MPI option to MEDREADER X-Git-Tag: V9_9_0a2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ba4150d3b93ebef27e64a67022a43c83b4df9f82;p=modules%2Fparavis.git Forward SALOME_USE_MPI option to MEDREADER --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bcc219f..f1fdd381 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,6 +73,7 @@ OPTION(SALOME_PARAVIS_BUILD_PLUGINS "Build PARAVIS plugins (MEDReader, etc ...)" OPTION(SALOME_PARAVIS_BUILD_CORBA_PLUGINS "Build PARAVIS CORBA plugins (ParaMEDCorba -- this requires the SALOME FIELDS module)" ON) OPTION(SALOME_PARAVIS_USE_GEOM_SOURCE "Import a GEOMETRY object to PARAVIS via its Corba IOR" OFF) OPTION(SALOME_PARAVIS_USE_SMESH_SOURCE "Import a MESH object to PARAVIS via its Corba IOR" OFF) +option(SALOME_USE_MPI "Activate parallel reading for MEDREADER" OFF) CMAKE_DEPENDENT_OPTION(SALOME_LIGHT_ONLY "Build SALOME Light only (no CORBA)" OFF "NOT SALOME_KERNEL_LIGHT_ONLY" ON) @@ -127,7 +128,6 @@ FIND_PACKAGE(SalomeQt5 REQUIRED) ## FIND_PACKAGE(SalomeParaView REQUIRED) - ## ## From MEDCoupling / MEDFile / or MEDModule (if CORBA plugin required): ## @@ -136,8 +136,12 @@ IF(SALOME_PARAVIS_BUILD_PLUGINS) # If CORBA plugins required, take in MED module IF(SALOME_PARAVIS_BUILD_CORBA_PLUGINS) SET(FIELDS_ROOT_DIR $ENV{FIELDS_ROOT_DIR} CACHE PATH "Path to the SALOME FIELDS module") - IF(EXISTS ${FIELDS_ROOT_DIR}) - FIND_PACKAGE(SalomeFIELDS) + IF(EXISTS ${FIELDS_ROOT_DIR}) + set(SALOME_USE_MPI_BEFORE ${SALOME_USE_MPI}) + #SalomeFIELDS may break SALOME_USE_MPI var ! + FIND_PACKAGE(SalomeFIELDS) + set(SALOME_USE_MPI ${SALOME_USE_MPI_BEFORE}) + unset(SALOME_USE_MPI_BEFORE) SALOME_LOG_OPTIONAL_PACKAGE(SalomeFIELDS SALOME_PARAVIS_BUILD_CORBA_PLUGINS) IF(SALOME_USE_MPI) SET(SALOME_PARAVIS_BUILD_INSITU ON) diff --git a/src/Plugins/CMakeLists.txt b/src/Plugins/CMakeLists.txt index 5a6ebd56..83a29e67 100644 --- a/src/Plugins/CMakeLists.txt +++ b/src/Plugins/CMakeLists.txt @@ -48,6 +48,12 @@ IF(SALOME_PARAVIS_USE_SMESH_SOURCE) LIST(APPEND _subdirs ParaSMESHCorba) ENDIF() +if(SALOME_USE_MPI) + # see https://stackoverflow.com/questions/20239334/cmake-set-subdirectory-options + # force to ON MEDREADER option instead of a simple set(MEDREADER_USE_MPI ON) + set(MEDREADER_USE_MPI ON CACHE BOOL "Activate parallel reading for MEDREADER" FORCE) +endif(SALOME_USE_MPI) + FOREACH(_dir ${_subdirs}) ADD_SUBDIRECTORY(${_dir}) ENDFOREACH() diff --git a/src/Plugins/MEDReader/CMakeLists.txt b/src/Plugins/MEDReader/CMakeLists.txt index 48f7cb11..4277d7a2 100644 --- a/src/Plugins/MEDReader/CMakeLists.txt +++ b/src/Plugins/MEDReader/CMakeLists.txt @@ -20,13 +20,14 @@ cmake_minimum_required(VERSION 3.8) project(MEDReader) -find_package(ParaView REQUIRED) +option(BUILD_SHARED_LIBS "Build shared libraries" ON) +option(MEDREADER_USE_MPI "Activate parallel reading for MEDREADER" OFF) -IF(SALOME_USE_MPI) - ADD_DEFINITIONS(-DMEDREADER_USE_MPI) -ENDIF(SALOME_USE_MPI) +find_package(ParaView REQUIRED) +if(MEDREADER_USE_MPI) + add_definitions(-DMEDREADER_USE_MPI) +endif(MEDREADER_USE_MPI) -option(BUILD_SHARED_LIBS "Build shared libraries" ON) enable_testing() include(GNUInstallDirs)