]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Dealing with HDF5 compiled with mpi. addition of MPI_INCLUDES_DIR into HDF5_INCLUDES_...
authorageay <ageay>
Tue, 24 Apr 2012 07:33:05 +0000 (07:33 +0000)
committerageay <ageay>
Tue, 24 Apr 2012 07:33:05 +0000 (07:33 +0000)
salome_adm/cmake_files/FindHDF5.cmake

index df1ba775d52655c80b32215bd88f861d5d40b065..a5bb8eb085e469456caf70e71c2ce9f403193c60 100644 (file)
@@ -158,6 +158,26 @@ IF(HDF5_STATUS)
   ENDIF(HDF5_LIB)
 ENDIF(HDF5_STATUS)
 
+IF(HDF5_STATUS)
+  FILE(TO_NATIVE_PATH "${HDF5_INCLUDE_DIR}/H5public.h" HDF5_H5PUBLIC_FILE)
+  EXECUTE_PROCESS(
+    COMMAND ${PYTHON_EXECUTABLE} -c "import re,sys ; f=file(sys.argv[1]) ; s=f.read() ; c=re.compile('^#[\s]*include[\s]*\\\"(?P<nm>[A-Za-z0-9\-]+\.h)\\\"',re.M) ; sys.stdout.write(c.search(s).group('nm'))"
+            ${HDF5_H5PUBLIC_FILE}
+    OUTPUT_VARIABLE HDF5_H5PUBLIC_DEFS_FILE
+    )
+  FILE(TO_NATIVE_PATH "${HDF5_INCLUDE_DIR}/${HDF5_H5PUBLIC_DEFS_FILE}" HDF5_H5PUBLIC_DEFS_FILE)
+  EXECUTE_PROCESS(
+    COMMAND ${PYTHON_EXECUTABLE} -c "import re,sys ; f=file(sys.argv[1]) ; s=f.read() ; c=re.compile('^#[\s]*define[\s]+H5_HAVE_PARALLEL[\s]+(?P<nm>[\d]+)',re.M) ; m=c.search(s); exec('if m: sys.stdout.write(m.group(\'nm\'))') ; exec('if not m:\n  sys.stdout.write(\'0\');')"
+            ${HDF5_H5PUBLIC_DEFS_FILE}
+    OUTPUT_VARIABLE HD5_HAVE_PARALLEL
+    )
+  IF(HD5_HAVE_PARALLEL)
+    SET(HDF5_INCLUDES_DIR ${HDF5_INCLUDES_DIR} ${MPI_INCLUDES_DIR})
+    SET(HDF5_FLAGS "${HDF5_FLAGS} ${MPI_FLAGS}")
+    SET(HDF5_LIBS ${HDF5_LIBS} ${MPI_LIBS})
+  ENDIF(HD5_HAVE_PARALLEL)
+ENDIF(HDF5_STATUS)
+
 # ----
 
 IF(HDF5_STATUS)