From 5526ca65d1c2802653c9af57714eac2e83e4e158 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 8 May 2018 11:58:01 -0600 Subject: [PATCH 1/2] created libhdf5, moved some files --- CMakeLists.txt | 1 + Makefile.am | 9 ++++----- configure.ac | 11 ++++++++--- libsrc4/nc4file.c => libhdf5/hdf5file.c | 0 {libsrc4 => libhdf5}/nc4hdf.c | 0 {libsrc4 => libhdf5}/nc4info.c | 0 liblib/CMakeLists.txt | 2 ++ liblib/Makefile.am | 8 +++++++- libsrc4/CMakeLists.txt | 2 +- libsrc4/Makefile.am | 6 +++--- 10 files changed, 26 insertions(+), 13 deletions(-) rename libsrc4/nc4file.c => libhdf5/hdf5file.c (100%) rename {libsrc4 => libhdf5}/nc4hdf.c (100%) rename {libsrc4 => libhdf5}/nc4info.c (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cd5c7b3f..8555f7347 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1632,6 +1632,7 @@ ENDIF(USE_PNETCDF) IF(USE_HDF5) add_subdirectory(libsrc4) + add_subdirectory(libhdf5) ENDIF(USE_HDF5) IF(USE_HDF4) diff --git a/Makefile.am b/Makefile.am index 4fe5be7f9..ed55a212e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,9 +7,6 @@ # Ed Hartnett, Ward Fisher - - - # This directory stores libtool macros, put there by aclocal. ACLOCAL_AMFLAGS = -I m4 @@ -45,6 +42,7 @@ endif if USE_NETCDF4 H5_TEST_DIR = h5_test LIBSRC4_DIR = libsrc4 +LIBHDF5 = libhdf5 NC_TEST4 = nc_test4 endif @@ -86,8 +84,9 @@ endif # and run. ncgen must come before ncdump, because their tests # depend on it. SUBDIRS = include $(H5_TEST_DIR) libdispatch libsrc $(LIBSRC4_DIR) \ -$(LIBSRCP) $(LIBHDF4) $(OCLIB) $(DAP2) ${DAP4} liblib $(NCGEN3) \ -$(NCGEN) $(NCDUMP) ${PLUGIN_DIR} $(TESTDIRS) docs $(EXAMPLES) +$(LIBSRCP) $(LIBHDF4) $(LIBHDF5) $(OCLIB) $(DAP2) ${DAP4} liblib \ +$(NCGEN3) $(NCGEN) $(NCDUMP) ${PLUGIN_DIR} $(TESTDIRS) docs \ +$(EXAMPLES) # Remove these generated files, for a distclean. DISTCLEANFILES = VERSION comps.txt test_prog libnetcdf.settings \ diff --git a/configure.ac b/configure.ac index 24be60290..7f822df91 100644 --- a/configure.ac +++ b/configure.ac @@ -180,6 +180,7 @@ AC_MSG_CHECKING([whether we should build netCDF-4]) AC_ARG_ENABLE([netcdf-4], [AS_HELP_STRING([--disable-netcdf-4], [do not build with netcdf-4 (else HDF5 and zlib required)])]) test "x$enable_netcdf_4" = xno || enable_netcdf_4=yes +enable_hdf5=enable_netcdf_4 # Synonym AC_ARG_ENABLE([netcdf4], [AS_HELP_STRING([--disable-netcdf4], @@ -909,6 +910,7 @@ AC_CHECK_LIB([m], [floor], [], if test "x$enable_netcdf_4" = xyes; then + AC_DEFINE([USE_HDF5], [1], [if true, use HDF5]) AC_DEFINE([USE_NETCDF4], [1], [if true, build netCDF-4]) AC_DEFINE([H5_USE_16_API], [1], [use HDF5 1.6 API]) @@ -1202,6 +1204,7 @@ AM_CONDITIONAL(USE_PNETCDF_DIR, [test ! "x$PNETCDFDIR" = x]) AM_CONDITIONAL(USE_LOGGING, [test "x$enable_logging" = xyes]) AM_CONDITIONAL(CROSS_COMPILING, [test "x$cross_compiling" = xyes]) AM_CONDITIONAL(USE_NETCDF4, [test x$enable_netcdf_4 = xyes]) +AM_CONDITIONAL(USE_HDF5, [test x$enable_hdf5 = xyes]) AM_CONDITIONAL(USE_HDF4, [test x$enable_hdf4 = xyes]) AM_CONDITIONAL(USE_HDF4_FILE_TESTS, [test x$enable_hdf4_file_tests = xyes]) AM_CONDITIONAL(USE_RENAMEV3, [test x$enable_netcdf_4 = xyes -o x$enable_dap = xyes]) @@ -1335,6 +1338,7 @@ AC_SUBST(HAS_NC2,[$nc_build_v2]) AC_SUBST(HAS_NC4,[$enable_netcdf_4]) AC_SUBST(HAS_CDF5,[$enable_cdf5]) AC_SUBST(HAS_HDF4,[$enable_hdf4]) +AC_SUBST(HAS_HDF5,[$enable_hdf5]) AC_SUBST(HAS_PNETCDF,[$enable_pnetcdf]) AC_SUBST(HAS_HDF5,[$enable_netcdf_4]) AC_SUBST(HAS_LOGGING, [$enable_logging]) @@ -1440,14 +1444,15 @@ AC_MSG_NOTICE([generating header files and makefiles]) AC_CONFIG_FILES([Makefile nc-config netcdf.pc - libnetcdf.settings - postinstall.sh - include/netcdf_meta.h + libnetcdf.settings + postinstall.sh + include/netcdf_meta.h include/Makefile h5_test/Makefile hdf4_test/Makefile libsrc/Makefile libsrc4/Makefile + libhdf5/Makefile libsrcp/Makefile ncdump/Makefile ncgen3/Makefile diff --git a/libsrc4/nc4file.c b/libhdf5/hdf5file.c similarity index 100% rename from libsrc4/nc4file.c rename to libhdf5/hdf5file.c diff --git a/libsrc4/nc4hdf.c b/libhdf5/nc4hdf.c similarity index 100% rename from libsrc4/nc4hdf.c rename to libhdf5/nc4hdf.c diff --git a/libsrc4/nc4info.c b/libhdf5/nc4info.c similarity index 100% rename from libsrc4/nc4info.c rename to libhdf5/nc4info.c diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt index 1afc85486..b8c5f1dbc 100644 --- a/liblib/CMakeLists.txt +++ b/liblib/CMakeLists.txt @@ -7,6 +7,8 @@ SET(liblib_LIBS dispatch netcdf3) IF(USE_HDF5 OR USE_NETCDF4) SET(liblib_LIBS ${liblib_LIBS} netcdf4) + SET(liblib_LIBS ${liblib_LIBS} netcdfhdf5) + ENDIF() IF(USE_PNETCDF) diff --git a/liblib/Makefile.am b/liblib/Makefile.am index fd8c00af3..0aeaf90c5 100644 --- a/liblib/Makefile.am +++ b/liblib/Makefile.am @@ -40,11 +40,17 @@ AM_CPPFLAGS += -I${top_srcdir}/libsrcp libnetcdf_la_LIBADD += ${top_builddir}/libsrcp/libnetcdfp.la endif # USE_PNETCDF +# + hdf5 +if USE_NETCDF4 +AM_CPPFLAGS += -I${top_srcdir}/libhdf5 +libnetcdf_la_LIBADD += ${top_builddir}/libhdf5/libnchdf5.la +endif # USE_NETCDF4 + # + hdf4 if USE_HDF4 AM_CPPFLAGS += -I${top_srcdir}/libhdf4 libnetcdf_la_LIBADD += ${top_builddir}/libhdf4/libnchdf4.la -endif # USE_PNETCDF +endif # USE_HDF4 # + dap if ENABLE_DAP diff --git a/libsrc4/CMakeLists.txt b/libsrc4/CMakeLists.txt index 75ca5208d..837cd9d49 100644 --- a/libsrc4/CMakeLists.txt +++ b/libsrc4/CMakeLists.txt @@ -1,6 +1,6 @@ # Process these files with m4. -SET(libsrc4_SOURCES nc4dispatch.c nc4attr.c nc4dim.c nc4file.c nc4grp.c nc4type.c nc4var.c ncfunc.c nc4internal.c nc4hdf.c nc4info.c ncindex.c) +SET(libsrc4_SOURCES nc4dispatch.c nc4attr.c nc4dim.c nc4grp.c nc4type.c nc4var.c ncfunc.c nc4internal.c ncindex.c) IF(LOGGING) SET(libsrc4_SOURCES ${libsrc4_SOURCES} error4.c) diff --git a/libsrc4/Makefile.am b/libsrc4/Makefile.am index e6d74e2ee..0c59d6ae8 100644 --- a/libsrc4/Makefile.am +++ b/libsrc4/Makefile.am @@ -10,9 +10,9 @@ libnetcdf4_la_CPPFLAGS = ${AM_CPPFLAGS} # This is our output. The netCDF-4 convenience library. noinst_LTLIBRARIES = libnetcdf4.la -libnetcdf4_la_SOURCES = nc4dispatch.c nc4attr.c nc4dim.c nc4file.c \ -nc4grp.c nc4hdf.c nc4internal.c nc4type.c nc4var.c ncfunc.c error4.c \ -nc4info.c nc4printer.c ncindex.c +libnetcdf4_la_SOURCES = nc4dispatch.c nc4attr.c nc4dim.c nc4grp.c \ +nc4internal.c nc4type.c nc4var.c ncfunc.c error4.c nc4printer.c \ +ncindex.c EXTRA_DIST = CMakeLists.txt From a68f57a0e51ed9f2521114e8728d8491c62ff824 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 8 May 2018 12:20:55 -0600 Subject: [PATCH 2/2] added missing files --- libhdf5/CMakeLists.txt | 18 ++++++++++++++++++ libhdf5/Makefile.am | 27 +++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 libhdf5/CMakeLists.txt create mode 100644 libhdf5/Makefile.am diff --git a/libhdf5/CMakeLists.txt b/libhdf5/CMakeLists.txt new file mode 100644 index 000000000..9a0e86d15 --- /dev/null +++ b/libhdf5/CMakeLists.txt @@ -0,0 +1,18 @@ +## This is a CMake file, part of Unidata's netCDF package. +# Copyright 2018, see the COPYRIGHT file for more information. +# +# This builds the HDF5 dispatch layer. +# +# Ed Hartnett + +# The source files for the HDF5 dispatch layer. +SET(libnchdf5_SOURCES nc4hdf.c nc4info.c hdf5file.c) +# SET(libnchdf5_SOURCES hdf5file.c nc4hdf.c hdf5attr.c hdf5dispatch.c +# hdf5var.c hdf5type.c hdf5internal.c hdf5dim.c hdf5grp.c nc4info.c) + +# Build the HDF4 dispatch layer as a library that will be included in +# the netCDF library. +add_library(netcdfhdf5 OBJECT ${libnchdf5_SOURCES}) + +# Remember to package this file for CMake builds. +ADD_EXTRA_DIST(${libnchdf5_SOURCES} CMakeLists.txt) diff --git a/libhdf5/Makefile.am b/libhdf5/Makefile.am new file mode 100644 index 000000000..258fbeb56 --- /dev/null +++ b/libhdf5/Makefile.am @@ -0,0 +1,27 @@ +# This is part of Unidata's netCDF package. Copyright 2018, see the +# COPYRIGHT file for more information. + +# Build the HDF5 dispatch layer. + +# Ed Hartnett + +# Get AM_CPPFLAGS. +include $(top_srcdir)/lib_flags.am +libnetcdf4_la_CPPFLAGS = ${AM_CPPFLAGS} + +# This is our output. The HDF5 convenience library. +noinst_LTLIBRARIES = libnchdf5.la + +# The source files. +libnchdf5_la_SOURCES = nc4hdf.c nc4info.c hdf5file.c +# libnchdf5_la_SOURCES = nc4hdf.c nc4info.c hdf5file.c hdf5attr.c \ +# hdf5dispatch.c hdf5var.c hdf5type.c hdf5internal.c hdf5dim.c \ +# hdf5grp.c + +# Package this for cmake build. +EXTRA_DIST = CMakeLists.txt + + + + +