[MOAB-dev] r1324 - in MOAB/trunk: . mhdf
dcthomp at mcs.anl.gov
dcthomp at mcs.anl.gov
Tue Oct 23 14:03:32 CDT 2007
Author: dcthomp
Date: 2007-10-23 14:03:32 -0500 (Tue, 23 Oct 2007)
New Revision: 1324
Added:
MOAB/trunk/mhdf/CMakeLists.txt
Modified:
MOAB/trunk/CMakeLists.txt
MOAB/trunk/MBEntityHandle.h.in
MOAB/trunk/WriteHDF5.cpp
MOAB/trunk/config.h.cmake
Log:
ENH: Move the FindHDF CMake check inside MOAB_USE_HDF so we don't even
look for HDF if not required. Add the mhdf library when MOAB_USE_HDF
is turned on. Add HDF5 I/O classes to MOAB when building w/ HDF.
Modified: MOAB/trunk/CMakeLists.txt
===================================================================
--- MOAB/trunk/CMakeLists.txt 2007-10-23 18:54:21 UTC (rev 1323)
+++ MOAB/trunk/CMakeLists.txt 2007-10-23 19:03:32 UTC (rev 1324)
@@ -76,11 +76,6 @@
find_package( MPI )
endif ( MOAB_USE_MPI )
- # HDF5
- find_package( HDF5 )
- if ( HDF5_FOUND )
- check_function_exists( H5Pset_fapl_mpio MOAB_HDF_HAVE_PARALLEL )
- endif ( HDF5_FOUND )
# NetCDF
# Documentation
# Optional tools
@@ -96,24 +91,12 @@
option ( MOAB_BUILD_MBSURFPLOT "Build the mbsurfplot application?" ON )
option ( MOAB_BUILD_MBZOLTAN "Build the mbzoltan partitioner?" OFF )
option ( MOAB_BUILD_DAGMC "Build the dagmc tool?" ON )
+
+ option ( MOAB_USE_HDF "Include HDF I/O in the build?" OFF )
+
# iMesh
option ( MOAB_BUILD_IMESH "Build the iMesh interface?" ON )
- include( ${MOAB_SOURCE_DIR}/cmake/AutoconfHeader.cmake )
- # Define some more variables so they will be substituted properly in the autoconf files.
- set( MB_VERSION_MAJOR ${MOAB_VERSION_MAJOR} )
- set( MB_VERSION_MINOR ${MOAB_VERSION_MINOR} )
- set( MB_VERSION_PATCH ${MOAB_VERSION_PATCH} )
- set( MB_VERSION_STRING "\"${MOAB_VERSION_STRING}\"" )
-
- # Best we can do for now since there's no config.h.in in the repository...
- configure_file( ${MOAB_SOURCE_DIR}/config.h.cmake ${MOAB_BINARY_DIR}/config.h )
- # ... but the line below is what should *really* happen
- #autoconf_header( ${MOAB_SOURCE_DIR}/config.h.in ${MOAB_BINARY_DIR}/config.h )
-
- autoconf_header( ${MOAB_SOURCE_DIR}/MBVersion.h.in ${MOAB_BINARY_DIR}/MBVersion.h )
- autoconf_header( ${MOAB_SOURCE_DIR}/MBEntityHandle.h.in ${MOAB_BINARY_DIR}/MBEntityHandle.h )
-
# MOAB Library
set ( MOAB_LIB_SRCS
AEntityFactory.cpp
@@ -168,33 +151,41 @@
WriteTemplate.cpp
WriteVtk.cpp
)
- set_source_files_properties( ${MOAB_LIB_SRCS}
- COMPILE_FLAGS "-DIS_BUILDING_MB"
- )
include_directories(
${MOAB_SOURCE_DIR}
${MOAB_BINARY_DIR}
)
+
+ if ( MOAB_USE_HDF )
+ # HDF5
+ find_package( HDF5 )
+ if ( HDF5_FOUND )
+ check_function_exists( H5Pset_fapl_mpio MOAB_HDF_HAVE_PARALLEL )
+ set ( MOAB_LIB_SRCS
+ ${MOAB_LIB_SRCS}
+ ReadHDF5.cpp
+ WriteHDF5.cpp
+ )
+ include_directories(
+ ${HDF5_INCLUDE_DIRECTORIES}
+ ${MOAB_SOURCE_DIR}/mhdf/include
+ )
+ add_subdirectory( mhdf )
+ endif ( HDF5_FOUND )
+ endif ( MOAB_USE_HDF )
+
+ set_source_files_properties( ${MOAB_LIB_SRCS}
+ COMPILE_FLAGS "-DIS_BUILDING_MB"
+ )
add_library( moab
${MOAB_LIB_SRCS}
)
-
- if ( MOAB_USE_HDF )
- set ( MOAB_MHDF_LIB_SRCS
- ReadHDF5.cpp
- WriteHDF5.cpp
- )
- include_directories(
- ${HDF5_INCLUDE_DIRECTORIES}
- ${MOAB_SOURCE_DIR}/mhdf/include
- )
- add_library( mhdf
- ${MOAB_MHDF_LIB_SRCS}
- )
- target_link_libraries( mdf
+ if ( MOAB_USE_HDF AND HDF5_FOUND )
+ target_link_libraries( moab
+ mhdf
${HDF5_LIBRARIES}
)
- endif ( MOAB_USE_HDF )
+ endif ( MOAB_USE_HDF AND HDF5_FOUND )
## Tools/libraries dependent on MOAB:
@@ -213,4 +204,19 @@
# iMesh Babel
+ include( ${MOAB_SOURCE_DIR}/cmake/AutoconfHeader.cmake )
+ # Define some more variables so they will be substituted properly in the autoconf files.
+ set( MB_VERSION_MAJOR ${MOAB_VERSION_MAJOR} )
+ set( MB_VERSION_MINOR ${MOAB_VERSION_MINOR} )
+ set( MB_VERSION_PATCH ${MOAB_VERSION_PATCH} )
+ set( MB_VERSION_STRING "\"${MOAB_VERSION_STRING}\"" )
+ # Best we can do for now since there's no config.h.in in the repository...
+ configure_file( ${MOAB_SOURCE_DIR}/config.h.cmake ${MOAB_BINARY_DIR}/config.h )
+ # ... but the line below is what should *really* happen
+ #autoconf_header( ${MOAB_SOURCE_DIR}/config.h.in ${MOAB_BINARY_DIR}/config.h )
+
+ autoconf_header( ${MOAB_SOURCE_DIR}/MBVersion.h.in ${MOAB_BINARY_DIR}/MBVersion.h )
+ autoconf_header( ${MOAB_SOURCE_DIR}/MBEntityHandle.h.in ${MOAB_BINARY_DIR}/MBEntityHandle.h )
+
+
Modified: MOAB/trunk/MBEntityHandle.h.in
===================================================================
--- MOAB/trunk/MBEntityHandle.h.in 2007-10-23 18:54:21 UTC (rev 1323)
+++ MOAB/trunk/MBEntityHandle.h.in 2007-10-23 19:03:32 UTC (rev 1324)
@@ -1,6 +1,17 @@
#ifndef MB_ENTITY_HANDLE_H
#define MB_ENTITY_HANDLE_H
+/* Are we building with HDF? */
+/* autoconf may only set HAVE_HDF5_H and not HDF5_FOUND. */
+/* CMake may only set HDF5_FOUND. Having either implies HDF5_FILE */
+#undef HDF5_FOUND
+#undef HAVE_HDF5_H
+#ifdef HDF5_FOUND
+# define HAVE_HDF5_H
+#endif
+#ifdef HAVE_HDF5_H
+# define HDF5_FILE
+#endif
/* MOAB qualified HAVE_INTTYPES_H */
#undef MOAB_HAVE_INTTYPES_H
Modified: MOAB/trunk/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/WriteHDF5.cpp 2007-10-23 18:54:21 UTC (rev 1323)
+++ MOAB/trunk/WriteHDF5.cpp 2007-10-23 19:03:32 UTC (rev 1324)
@@ -25,6 +25,7 @@
// Creation Date : 04/01/04
//-------------------------------------------------------------------------
+#include "MBEntityHandle.h"
#ifndef HDF5_FILE
# error Attempt to compile WriteHDF5 with HDF5 support disabled
#endif
Modified: MOAB/trunk/config.h.cmake
===================================================================
--- MOAB/trunk/config.h.cmake 2007-10-23 18:54:21 UTC (rev 1323)
+++ MOAB/trunk/config.h.cmake 2007-10-23 19:03:32 UTC (rev 1324)
@@ -24,6 +24,7 @@
#cmakedefine HDF5_FOUND
#ifdef HDF5_FOUND
# define HAVE_HDF5_H
+# define HDF5_FILE
#endif /* HDF5_FOUND */
/* Define to 1 if you have the <inttypes.h> header file. */
Added: MOAB/trunk/mhdf/CMakeLists.txt
===================================================================
--- MOAB/trunk/mhdf/CMakeLists.txt (rev 0)
+++ MOAB/trunk/mhdf/CMakeLists.txt 2007-10-23 19:03:32 UTC (rev 1324)
@@ -0,0 +1,31 @@
+project(mhdf)
+
+include_directories(
+ ${HDF5_INCLUDE_DIRECTORIES}
+)
+
+set ( mhdf_LIB_SRCS
+ src/adjacency.c
+ src/connectivity.c
+ src/file-handle.c
+ src/file.c
+ src/nodes.c
+ src/sets.c
+ src/status.c
+ src/status.h
+ src/tags.c
+ src/util.c
+)
+
+add_library( mhdf
+ ${mhdf_LIB_SRCS}
+)
+
+target_link_libraries(
+ ${HDF5_LIBRARIES}
+)
+
+#include/mhdf.h \
+#src/file-handle.h \
+#src/names-and-paths.h \
+#src/util.h
More information about the moab-dev
mailing list