summaryrefslogtreecommitdiffstats
path: root/tools/h5stat
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2010-05-13 16:01:50 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2010-05-13 16:01:50 (GMT)
commitae06433ab0ca13838c2762c8fad165a041d64c42 (patch)
tree72d645731c00953c3daf6dad8a1cf0dc97326943 /tools/h5stat
parent940931aa853602b0b6edfd4ca1a6526fd7975dd2 (diff)
downloadhdf5-ae06433ab0ca13838c2762c8fad165a041d64c42.zip
hdf5-ae06433ab0ca13838c2762c8fad165a041d64c42.tar.gz
hdf5-ae06433ab0ca13838c2762c8fad165a041d64c42.tar.bz2
[svn-r18793] Add files to support building library with CMake
Tested: Local linux
Diffstat (limited to 'tools/h5stat')
-rw-r--r--tools/h5stat/CMakeLists.txt122
1 files changed, 122 insertions, 0 deletions
diff --git a/tools/h5stat/CMakeLists.txt b/tools/h5stat/CMakeLists.txt
new file mode 100644
index 0000000..98a9dde
--- /dev/null
+++ b/tools/h5stat/CMakeLists.txt
@@ -0,0 +1,122 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5STAT)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the h5stat and test executables
+# --------------------------------------------------------------------
+ADD_EXECUTABLE (h5stat ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat.c)
+H5_NAMING (h5stat)
+TARGET_LINK_LIBRARIES (h5stat ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES h5stat)
+
+IF (BUILD_TESTING)
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5stat_gentest ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat_gentest.c)
+ H5_NAMING (h5stat_gentest)
+ TARGET_LINK_LIBRARIES (h5stat_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ #ADD_TEST (NAME h5stat_gentest COMMAND $<TARGET_FILE:h5stat_gentest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ # h5stat_gentest
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ SET (HDF5_REFERENCE_FILES
+ h5stat_help1.ddl
+ h5stat_help2.ddl
+ h5stat_filters.ddl
+ h5stat_filters-file.ddl
+ h5stat_filters-F.ddl
+ h5stat_filters-d.ddl
+ h5stat_filters-g.ddl
+ h5stat_filters-dT.ddl
+ h5stat_filters-UD.ddl
+ h5stat_filters-UT.ddl
+ h5stat_tsohm.ddl
+ h5stat_newgrat.ddl
+ h5stat_newgrat-UG.ddl
+ h5stat_newgrat-UA.ddl
+ )
+ SET (HDF5_REFERENCE_TEST_FILES
+ h5stat_filters.h5
+ h5stat_tsohm.h5
+ h5stat_newgrat.h5
+ )
+
+ FOREACH (ddl_file ${HDF5_REFERENCE_FILES})
+ SET (ddldest "${PROJECT_BINARY_DIR}/${ddl_file}")
+ #MESSAGE (STATUS " Translating ${ddl_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5stat
+ POST_BUILD
+ COMMAND ${XLATE_UTILITY}
+ ARGS ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest} -l3
+ )
+ ENDFOREACH (ddl_file ${HDF5_REFERENCE_FILES})
+
+ FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5stat
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ MACRO (ADD_H5_TEST resultfile resultcode)
+ ADD_TEST (
+ NAME H5STAT-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5stat>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDMACRO (ADD_H5_TEST file)
+
+# Test for help flag
+ ADD_H5_TEST (h5stat_help1 0 -h)
+ ADD_H5_TEST (h5stat_help2 0 --help)
+
+# Test file with groups, compressed datasets, user-applied fileters, etc.
+# h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4
+ ADD_H5_TEST (h5stat_filters 0 h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-file 0 -f h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-F 0 -F h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-d 0 -d h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-g 0 -g h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-dT 0 -dT h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-UD 0 -D h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-UT 0 -T h5stat_filters.h5)
+# h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c
+# as of release 1.8.0-alpha4
+ ADD_H5_TEST (h5stat_tsohm 0 h5stat_tsohm.h5)
+# h5stat_newgrat.h5 is generated by h5stat_gentest.c
+ ADD_H5_TEST (h5stat_newgrat 0 h5stat_newgrat.h5)
+ ADD_H5_TEST (h5stat_newgrat-UG 0 -G h5stat_newgrat.h5)
+ ADD_H5_TEST (h5stat_newgrat-UA 0 -A h5stat_newgrat.h5)
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5stat
+ RUNTIME DESTINATION
+ bin/tools
+)