]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
Forward SALOME_USE_MPI option to MEDREADER
authorAnthony Geay <anthony.geay@edf.fr>
Wed, 23 Mar 2022 05:18:04 +0000 (06:18 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Wed, 23 Mar 2022 05:18:52 +0000 (06:18 +0100)
CMakeLists.txt
src/Plugins/CMakeLists.txt
src/Plugins/MEDReader/CMakeLists.txt

index 3bcc219f81885c8afcc0bdcf828b4f583cb4bf73..f1fdd3812efd294534dd6d2b03b50d8a885d789b 100644 (file)
@@ -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)
index 5a6ebd56b94547a0f839cb26cada569bbd0ce8cf..83a29e67b6cb00028a2a220edc6910a7dda8f005 100644 (file)
@@ -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()
index 48f7cb117556041fe69e9e3f45acf86b9cf2b4a4..4277d7a2a5f84e6827cf0a23d40d0a8bbbee608d 100644 (file)
 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)