From 366f2d94a3f5ee20287de8062a2a2c895e9eb856 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 22 Dec 2023 15:17:05 -0600 Subject: Add CMake api checks to test the new Examples folder. (#3907) * Fix missing build-mode value * Use 110 version file only for the 1.10 library * Fix H5_LIBVER_DIR variable * Disable 1.6 API tests for now. --- .github/workflows/cmake.yml | 4 + .github/workflows/main-cmake-spc.yml | 264 +++++++++++++++++++++++++++ CMakeLists.txt | 20 +- HDF5Examples/C/H5D/16/h5ex_d_alloc.c | 13 +- HDF5Examples/C/H5D/16/h5ex_d_checksum.c | 12 +- HDF5Examples/C/H5D/16/h5ex_d_chunk.c | 18 +- HDF5Examples/C/H5D/16/h5ex_d_compact.c | 11 +- HDF5Examples/C/H5D/16/h5ex_d_extern.c | 11 +- HDF5Examples/C/H5D/16/h5ex_d_fillval.c | 21 ++- HDF5Examples/C/H5D/16/h5ex_d_gzip.c | 18 +- HDF5Examples/C/H5D/16/h5ex_d_hyper.c | 16 +- HDF5Examples/C/H5D/16/h5ex_d_rdwr.c | 10 +- HDF5Examples/C/H5D/16/h5ex_d_shuffle.c | 18 +- HDF5Examples/C/H5D/16/h5ex_d_szip.c | 19 +- HDF5Examples/C/H5D/16/h5ex_d_unlimadd.c | 23 ++- HDF5Examples/C/H5D/16/h5ex_d_unlimgzip.c | 23 ++- HDF5Examples/C/H5D/16/h5ex_d_unlimmod.c | 20 +- HDF5Examples/C/H5D/CMakeLists.txt | 2 +- HDF5Examples/C/H5G/CMakeLists.txt | 8 +- HDF5Examples/C/H5T/CMakeLists.txt | 2 +- HDF5Examples/JAVA/H5J/Java_sourcefiles.cmake | 2 +- config/cmake/HDF5ExampleCache.cmake | 13 +- 22 files changed, 449 insertions(+), 99 deletions(-) create mode 100644 .github/workflows/main-cmake-spc.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 84fe010..c22c753 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -11,6 +11,10 @@ permissions: # in parallel. We just have one job, but the matrix items defined below will # run in parallel. jobs: + call-workflow-special-cmake: + name: "CMake Special Workflows" + uses: ./.github/workflows/main-cmake-spc.yml + call-debug-thread-cmake: name: "CMake Debug Thread-Safety Workflows" uses: ./.github/workflows/main-cmake.yml diff --git a/.github/workflows/main-cmake-spc.yml b/.github/workflows/main-cmake-spc.yml new file mode 100644 index 0000000..9531035 --- /dev/null +++ b/.github/workflows/main-cmake-spc.yml @@ -0,0 +1,264 @@ +name: hdf5 dev CMake special CI + +# Controls when the action will run. Triggers the workflow on a call +on: + workflow_call: + +permissions: + contents: read + +# A workflow run is made up of one or more jobs that can run sequentially or +# in parallel. We just have one job, but the matrix items defined below will +# run in parallel. +jobs: + # + # SPECIAL CMake BUILDS + # + # These are not built into the matrix and instead + # become NEW configs as their name would clobber one of the matrix + # names (so make sure the names are UNIQUE). + # + + build_v1_6: + name: "gcc DBG v1.6 default API" + runs-on: ubuntu-latest + steps: + # SETUP + - name: Install Linux Dependencies + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz + sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev + sudo apt install gcc-12 g++-12 gfortran-12 + echo "CC=gcc-12" >> $GITHUB_ENV + echo "CXX=g++-12" >> $GITHUB_ENV + echo "FC=gfortran-12" >> $GITHUB_ENV + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Get Sources + uses: actions/checkout@v4.1.1 + + # + # CMAKE CONFIGURE + # + - name: CMake Configure + run: | + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_TOOLCHAIN_FILE=config/toolchain/gcc.cmake \ + -DBUILD_SHARED_LIBS=ON \ + -DHDF5_ENABLE_ALL_WARNINGS=ON \ + -DHDF5_ENABLE_PARALLEL:BOOL=OFF \ + -DHDF5_BUILD_CPP_LIB:BOOL=ON \ + -DHDF5_BUILD_FORTRAN=ON \ + -DHDF5_BUILD_JAVA=ON \ + -DHDF5_BUILD_DOC=OFF \ + -DLIBAEC_USE_LOCALCONTENT=OFF \ + -DZLIB_USE_LOCALCONTENT=OFF \ + -DHDF5_ENABLE_MIRROR_VFD:BOOL=ON \ + -DHDF5_ENABLE_DIRECT_VFD:BOOL=ON \ + -DHDF5_ENABLE_ROS3_VFD:BOOL=ON \ + -DH5_NO_DEPRECATED_SYMBOLS:BOOL=OFF \ + -DDEFAULT_API_VERSION:STRING=v16 \ + $GITHUB_WORKSPACE + shell: bash + + # + # BUILD + # + - name: CMake Build + run: cmake --build . --parallel 3 --config Debug + working-directory: ${{ runner.workspace }}/build + + # + # RUN TESTS - disable until some tests are fixed + # +# - name: CMake Run Tests +# run: ctest . --parallel 2 -C Debug -V +# working-directory: ${{ runner.workspace }}/build + + build_v1_10: + name: "gcc DBG v1.10 default API (build only)" + runs-on: ubuntu-latest + steps: + # SETUP + - name: Install Linux Dependencies + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz + sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev + sudo apt install gcc-12 g++-12 gfortran-12 + echo "CC=gcc-12" >> $GITHUB_ENV + echo "CXX=g++-12" >> $GITHUB_ENV + echo "FC=gfortran-12" >> $GITHUB_ENV + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Get Sources + uses: actions/checkout@v4.1.1 + + # + # CMAKE CONFIGURE + # + - name: CMake Configure + run: | + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_TOOLCHAIN_FILE=config/toolchain/gcc.cmake \ + -DBUILD_SHARED_LIBS=ON \ + -DHDF5_ENABLE_ALL_WARNINGS=ON \ + -DHDF5_ENABLE_PARALLEL:BOOL=OFF \ + -DHDF5_BUILD_CPP_LIB:BOOL=ON \ + -DHDF5_BUILD_FORTRAN=ON \ + -DHDF5_BUILD_JAVA=ON \ + -DHDF5_BUILD_DOC=OFF \ + -DLIBAEC_USE_LOCALCONTENT=OFF \ + -DZLIB_USE_LOCALCONTENT=OFF \ + -DHDF5_ENABLE_MIRROR_VFD:BOOL=ON \ + -DHDF5_ENABLE_DIRECT_VFD:BOOL=ON \ + -DHDF5_ENABLE_ROS3_VFD:BOOL=ON \ + -DH5_NO_DEPRECATED_SYMBOLS:BOOL=OFF \ + -DDEFAULT_API_VERSION:STRING=v110 \ + $GITHUB_WORKSPACE + shell: bash + + # + # BUILD + # + - name: CMake Build + run: cmake --build . --parallel 3 --config Debug + working-directory: ${{ runner.workspace }}/build + + # + # RUN TESTS + # + - name: CMake Run Tests + run: ctest . --parallel 2 -C Debug -V + working-directory: ${{ runner.workspace }}/build + + build_v1_12: + name: "gcc DBG v1.12 default API (build only)" + runs-on: ubuntu-latest + steps: + # SETUP + - name: Install Linux Dependencies + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz + sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev + sudo apt install gcc-12 g++-12 gfortran-12 + echo "CC=gcc-12" >> $GITHUB_ENV + echo "CXX=g++-12" >> $GITHUB_ENV + echo "FC=gfortran-12" >> $GITHUB_ENV + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Get Sources + uses: actions/checkout@v4.1.1 + + # + # CMAKE CONFIGURE + # + - name: CMake Configure + run: | + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_TOOLCHAIN_FILE=config/toolchain/gcc.cmake \ + -DBUILD_SHARED_LIBS=ON \ + -DHDF5_ENABLE_ALL_WARNINGS=ON \ + -DHDF5_ENABLE_PARALLEL:BOOL=OFF \ + -DHDF5_BUILD_CPP_LIB:BOOL=ON \ + -DHDF5_BUILD_FORTRAN=ON \ + -DHDF5_BUILD_JAVA=ON \ + -DHDF5_BUILD_DOC=OFF \ + -DLIBAEC_USE_LOCALCONTENT=OFF \ + -DZLIB_USE_LOCALCONTENT=OFF \ + -DHDF5_ENABLE_MIRROR_VFD:BOOL=ON \ + -DHDF5_ENABLE_DIRECT_VFD:BOOL=ON \ + -DHDF5_ENABLE_ROS3_VFD:BOOL=ON \ + -DH5_NO_DEPRECATED_SYMBOLS:BOOL=OFF \ + -DDEFAULT_API_VERSION:STRING=v112 \ + $GITHUB_WORKSPACE + shell: bash + + # + # BUILD + # + - name: CMake Build + run: cmake --build . --parallel 3 --config Debug + working-directory: ${{ runner.workspace }}/build + + # + # RUN TESTS + # + - name: CMake Run Tests + run: ctest . --parallel 2 -C Debug -V + working-directory: ${{ runner.workspace }}/build + + build_v1_14: + name: "gcc DBG v1.14 default API (build only)" + runs-on: ubuntu-latest + steps: + # SETUP + - name: Install Linux Dependencies + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz + sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev + sudo apt install gcc-12 g++-12 gfortran-12 + echo "CC=gcc-12" >> $GITHUB_ENV + echo "CXX=g++-12" >> $GITHUB_ENV + echo "FC=gfortran-12" >> $GITHUB_ENV + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Get Sources + uses: actions/checkout@v4.1.1 + + # + # CMAKE CONFIGURE + # + - name: CMake Configure + run: | + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_TOOLCHAIN_FILE=config/toolchain/gcc.cmake \ + -DBUILD_SHARED_LIBS=ON \ + -DHDF5_ENABLE_ALL_WARNINGS=ON \ + -DHDF5_ENABLE_PARALLEL:BOOL=OFF \ + -DHDF5_BUILD_CPP_LIB:BOOL=ON \ + -DHDF5_BUILD_FORTRAN=ON \ + -DHDF5_BUILD_JAVA=ON \ + -DHDF5_BUILD_DOC=OFF \ + -DLIBAEC_USE_LOCALCONTENT=OFF \ + -DZLIB_USE_LOCALCONTENT=OFF \ + -DHDF5_ENABLE_MIRROR_VFD:BOOL=ON \ + -DHDF5_ENABLE_DIRECT_VFD:BOOL=ON \ + -DHDF5_ENABLE_ROS3_VFD:BOOL=ON \ + -DH5_NO_DEPRECATED_SYMBOLS:BOOL=OFF \ + -DDEFAULT_API_VERSION:STRING=v114 \ + $GITHUB_WORKSPACE + shell: bash + + # + # BUILD + # + - name: CMake Build + run: cmake --build . --parallel 3 --config Debug + working-directory: ${{ runner.workspace }}/build + + # + # RUN TESTS + # + - name: CMake Run Tests + run: ctest . --parallel 2 -C Debug -V + working-directory: ${{ runner.workspace }}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index e73b7f9..b45c63a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -418,6 +418,7 @@ set (HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org") set (HDF5_VERSION_STRING ${HDF5_PACKAGE_VERSION}) set (HDF5_VERSION_MAJOR ${HDF5_PACKAGE_VERSION_MAJOR}) set (HDF5_VERSION_MINOR ${HDF5_PACKAGE_VERSION_MINOR}) +set (H5_LIBVER_DIR ${H5_VERS_MAJOR}${H5_VERS_MINOR}) #----------------------------------------------------------------------------- # Include some macros for reusable code @@ -1026,15 +1027,20 @@ endif () #----------------------------------------------------------------------------- # Include filter plugins #----------------------------------------------------------------------------- -include (CMakePlugins.cmake) +if (${H5_LIBVER_DIR} EQUAL 16 OR DEFAULT_API_VERSION MATCHES "v16") + set (HDF5_ENABLE_PLUGIN_SUPPORT OFF CACHE BOOL "" FORCE) + message (VERBOSE "Filter PLUGINs cannot be used with 1.6 API") +else () + include (CMakePlugins.cmake) -if (HDF5_PACKAGE_EXTLIBS AND NOT HDF5_NO_PACKAGES) - if (HDF5_ENABLE_PLUGIN_SUPPORT AND PLUGIN_FOUND) - PACKAGE_PLUGIN_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) -# option (HDF5_TEST_PLUGIN "Execute plugin tests" ON) -# mark_as_advanced (HDF5_TEST_PLUGIN) + if (HDF5_PACKAGE_EXTLIBS AND NOT HDF5_NO_PACKAGES) + if (HDF5_ENABLE_PLUGIN_SUPPORT AND PLUGIN_FOUND) + PACKAGE_PLUGIN_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) +# option (HDF5_TEST_PLUGIN "Execute plugin tests" ON) +# mark_as_advanced (HDF5_TEST_PLUGIN) -# TEST_PLUGIN_LIBRARY () +# TEST_PLUGIN_LIBRARY () + endif () endif () endif () diff --git a/HDF5Examples/C/H5D/16/h5ex_d_alloc.c b/HDF5Examples/C/H5D/16/h5ex_d_alloc.c index d4ae7b9..78f0ce8 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_alloc.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_alloc.c @@ -26,13 +26,18 @@ int main(void) { - hid_t file, space, dset1, dset2, dcpl; + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset1 = H5I_INVALID_HID; + hid_t dset2 = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; /* Handles */ herr_t status; H5D_space_status_t space_status; - hsize_t dims[2] = {DIM0, DIM1}, storage_size; - int wdata[DIM0][DIM1], /* Write buffer */ - i, j; + hsize_t dims[2] = {DIM0, DIM1}; + hsize_t storage_size; + int wdata[DIM0][DIM1]; /* Write buffer */ + hsize_t i, j; /* * Initialize data. diff --git a/HDF5Examples/C/H5D/16/h5ex_d_checksum.c b/HDF5Examples/C/H5D/16/h5ex_d_checksum.c index ce057aa..a03e004 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_checksum.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_checksum.c @@ -27,7 +27,10 @@ int main(void) { - hid_t file, space, dset, dcpl; + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; /* Handles */ herr_t status; htri_t avail; @@ -35,9 +38,10 @@ main(void) hsize_t dims[2] = {DIM0, DIM1}, chunk[2] = {CHUNK0, CHUNK1}; size_t nelmts; unsigned int flags, filter_info; - int wdata[DIM0][DIM1], /* Write buffer */ - rdata[DIM0][DIM1], /* Read buffer */ - max, i, j; + int wdata[DIM0][DIM1]; /* Write buffer */ + int rdata[DIM0][DIM1]; /* Read buffer */ + int max; + hsize_t i, j; /* * Check if the Fletcher32 filter is available and can be used for diff --git a/HDF5Examples/C/H5D/16/h5ex_d_chunk.c b/HDF5Examples/C/H5D/16/h5ex_d_chunk.c index b19e7c7..4697261 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_chunk.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_chunk.c @@ -27,13 +27,21 @@ int main(void) { - hid_t file, space, dset, dcpl; /* Handles */ + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; herr_t status; H5D_layout_t layout; - hsize_t dims[2] = {DIM0, DIM1}, chunk[2] = {CHUNK0, CHUNK1}, start[2], stride[2], count[2], block[2]; - int wdata[DIM0][DIM1], /* Write buffer */ - rdata[DIM0][DIM1], /* Read buffer */ - i, j; + hsize_t dims[2] = {DIM0, DIM1}; + hsize_t chunk[2] = {CHUNK0, CHUNK1}; + hsize_t start[2]; + hsize_t stride[2]; + hsize_t count[2]; + hsize_t block[2]; + int wdata[DIM0][DIM1]; /* Write buffer */ + int rdata[DIM0][DIM1]; /* Read buffer */ + hsize_t i, j; /* * Initialize data to "1", to make it easier to see the selections. diff --git a/HDF5Examples/C/H5D/16/h5ex_d_compact.c b/HDF5Examples/C/H5D/16/h5ex_d_compact.c index 2d199ec..0c10a87 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_compact.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_compact.c @@ -22,13 +22,16 @@ int main(void) { - hid_t file, space, dset, dcpl; /* Handles */ + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; herr_t status; H5D_layout_t layout; hsize_t dims[2] = {DIM0, DIM1}; - int wdata[DIM0][DIM1], /* Write buffer */ - rdata[DIM0][DIM1], /* Read buffer */ - i, j; + int wdata[DIM0][DIM1]; /* Write buffer */ + int rdata[DIM0][DIM1]; /* Read buffer */ + hsize_t i, j; /* * Initialize data. diff --git a/HDF5Examples/C/H5D/16/h5ex_d_extern.c b/HDF5Examples/C/H5D/16/h5ex_d_extern.c index f0cc60d..6291c3c 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_extern.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_extern.c @@ -25,13 +25,16 @@ int main(void) { - hid_t file, space, dset, dcpl; /* Handles */ + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; herr_t status; hsize_t dims[2] = {DIM0, DIM1}; char name[NAME_BUF_SIZE]; - int wdata[DIM0][DIM1], /* Write buffer */ - rdata[DIM0][DIM1], /* Read buffer */ - i, j; + int wdata[DIM0][DIM1]; /* Write buffer */ + int rdata[DIM0][DIM1]; /* Read buffer */ + hsize_t i, j; /* * Initialize data. diff --git a/HDF5Examples/C/H5D/16/h5ex_d_fillval.c b/HDF5Examples/C/H5D/16/h5ex_d_fillval.c index e2fd100..4f6eee3 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_fillval.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_fillval.c @@ -30,15 +30,20 @@ int main(void) { - hid_t file, space, dset, dcpl; /* Handles */ + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; herr_t status; - hsize_t dims[2] = {DIM0, DIM1}, extdims[2] = {EDIM0, EDIM1}, maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}, - chunk[2] = {CHUNK0, CHUNK1}; - int wdata[DIM0][DIM1], /* Write buffer */ - rdata[DIM0][DIM1], /* Read buffer */ - rdata2[EDIM0][EDIM1], /* Read buffer for - extension */ - fillval, i, j; + hsize_t dims[2] = {DIM0, DIM1}; + hsize_t extdims[2] = {EDIM0, EDIM1}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk[2] = {CHUNK0, CHUNK1}; + int wdata[DIM0][DIM1]; /* Write buffer */ + int rdata[DIM0][DIM1]; /* Read buffer */ + int rdata2[EDIM0][EDIM1]; /* Read buffer for extension */ + int fillval; + hsize_t i, j; /* * Initialize data. diff --git a/HDF5Examples/C/H5D/16/h5ex_d_gzip.c b/HDF5Examples/C/H5D/16/h5ex_d_gzip.c index cd44d8e..2b35559 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_gzip.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_gzip.c @@ -26,16 +26,22 @@ int main(void) { - hid_t file, space, dset, dcpl; /* Handles */ + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; herr_t status; htri_t avail; H5Z_filter_t filter_type; - hsize_t dims[2] = {DIM0, DIM1}, chunk[2] = {CHUNK0, CHUNK1}; + hsize_t dims[2] = {DIM0, DIM1}; + hsize_t chunk[2] = {CHUNK0, CHUNK1}; size_t nelmts; - unsigned int flags, filter_info; - int wdata[DIM0][DIM1], /* Write buffer */ - rdata[DIM0][DIM1], /* Read buffer */ - max, i, j; + unsigned int flags; + unsigned int filter_info; + int wdata[DIM0][DIM1]; /* Write buffer */ + int rdata[DIM0][DIM1]; /* Read buffer */ + int max; + hsize_t i, j; /* * Check if gzip compression is available and can be used for both diff --git a/HDF5Examples/C/H5D/16/h5ex_d_hyper.c b/HDF5Examples/C/H5D/16/h5ex_d_hyper.c index df361d6..1d81ec2 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_hyper.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_hyper.c @@ -25,12 +25,18 @@ int main(void) { - hid_t file, space, dset; /* Handles */ + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; herr_t status; - hsize_t dims[2] = {DIM0, DIM1}, start[2], stride[2], count[2], block[2]; - int wdata[DIM0][DIM1], /* Write buffer */ - rdata[DIM0][DIM1], /* Read buffer */ - i, j; + hsize_t dims[2] = {DIM0, DIM1}; + hsize_t start[2]; + hsize_t stride[2]; + hsize_t count[2]; + hsize_t block[2]; + int wdata[DIM0][DIM1]; /* Write buffer */ + int rdata[DIM0][DIM1]; /* Read buffer */ + hsize_t i, j; /* * Initialize data to "1", to make it easier to see the selections. diff --git a/HDF5Examples/C/H5D/16/h5ex_d_rdwr.c b/HDF5Examples/C/H5D/16/h5ex_d_rdwr.c index 4b6a56a..fbdc180 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_rdwr.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_rdwr.c @@ -22,12 +22,14 @@ int main(void) { - hid_t file, space, dset; /* Handles */ + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; herr_t status; hsize_t dims[2] = {DIM0, DIM1}; - int wdata[DIM0][DIM1], /* Write buffer */ - rdata[DIM0][DIM1], /* Read buffer */ - i, j; + int wdata[DIM0][DIM1]; /* Write buffer */ + int rdata[DIM0][DIM1]; /* Read buffer */ + hsize_t i, j; /* * Initialize data. diff --git a/HDF5Examples/C/H5D/16/h5ex_d_shuffle.c b/HDF5Examples/C/H5D/16/h5ex_d_shuffle.c index cff4730..137b4b8 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_shuffle.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_shuffle.c @@ -27,16 +27,22 @@ int main(void) { - hid_t file, space, dset, dcpl; /* Handles */ + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; herr_t status; htri_t avail; H5Z_filter_t filter_type; - hsize_t dims[2] = {DIM0, DIM1}, chunk[2] = {CHUNK0, CHUNK1}; + hsize_t dims[2] = {DIM0, DIM1}; + hsize_t chunk[2] = {CHUNK0, CHUNK1}; size_t nelmts; - unsigned int flags, filter_info; - int wdata[DIM0][DIM1], /* Write buffer */ - rdata[DIM0][DIM1], /* Read buffer */ - max, nfilters, i, j; + unsigned int flags; + unsigned int filter_info; + int wdata[DIM0][DIM1]; /* Write buffer */ + int rdata[DIM0][DIM1]; /* Read buffer */ + int max, nfilters; + int i, j; /* * Check if gzip compression is available and can be used for both diff --git a/HDF5Examples/C/H5D/16/h5ex_d_szip.c b/HDF5Examples/C/H5D/16/h5ex_d_szip.c index 6ecc6ef..cf2f639 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_szip.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_szip.c @@ -26,16 +26,23 @@ int main(void) { - hid_t file, space, dset, dcpl; /* Handles */ + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; + herr_t status; htri_t avail; H5Z_filter_t filter_type; - hsize_t dims[2] = {DIM0, DIM1}, chunk[2] = {CHUNK0, CHUNK1}; + hsize_t dims[2] = {DIM0, DIM1}; + hsize_t chunk[2] = {CHUNK0, CHUNK1}; size_t nelmts; - unsigned int flags, filter_info; - int wdata[DIM0][DIM1], /* Write buffer */ - rdata[DIM0][DIM1], /* Read buffer */ - max, i, j; + unsigned int flags; + unsigned int filter_info; + int wdata[DIM0][DIM1]; /* Write buffer */ + int rdata[DIM0][DIM1]; /* Read buffer */ + int max; + hsize_t i, j; /* * Check if szip compression is available and can be used for both diff --git a/HDF5Examples/C/H5D/16/h5ex_d_unlimadd.c b/HDF5Examples/C/H5D/16/h5ex_d_unlimadd.c index 1c271d3..6f855ea 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_unlimadd.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_unlimadd.c @@ -29,15 +29,22 @@ int main(void) { - hid_t file, space, dset, dcpl; /* Handles */ + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; herr_t status; - hsize_t dims[2] = {DIM0, DIM1}, extdims[2] = {EDIM0, EDIM1}, maxdims[2], chunk[2] = {CHUNK0, CHUNK1}, - start[2], count[2]; - int wdata[DIM0][DIM1], /* Write buffer */ - wdata2[EDIM0][EDIM1], /* Write buffer for - extension */ - **rdata, /* Read buffer */ - ndims, i, j; + hsize_t dims[2] = {DIM0, DIM1}; + hsize_t extdims[2] = {EDIM0, EDIM1}; + hsize_t maxdims[2]; + hsize_t chunk[2] = {CHUNK0, CHUNK1}; + hsize_t start[2]; + hsize_t count[2]; + int wdata[DIM0][DIM1]; /* Write buffer */ + int wdata2[EDIM0][EDIM1]; /* Write buffer for extension */ + int **rdata = NULL; /* Read buffer */ + int ndims; + hsize_t i, j; /* * Initialize data. diff --git a/HDF5Examples/C/H5D/16/h5ex_d_unlimgzip.c b/HDF5Examples/C/H5D/16/h5ex_d_unlimgzip.c index 3e90506..227b3aa 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_unlimgzip.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_unlimgzip.c @@ -30,19 +30,26 @@ int main(void) { - hid_t file, space, dset, dcpl; /* Handles */ + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; herr_t status; htri_t avail; H5Z_filter_t filter_type; - hsize_t dims[2] = {DIM0, DIM1}, extdims[2] = {EDIM0, EDIM1}, maxdims[2], chunk[2] = {CHUNK0, CHUNK1}, - start[2], count[2]; + hsize_t dims[2] = {DIM0, DIM1}; + hsize_t extdims[2] = {EDIM0, EDIM1}; + hsize_t maxdims[2]; + hsize_t chunk[2] = {CHUNK0, CHUNK1}; + hsize_t start[2]; + hsize_t count[2]; size_t nelmts; unsigned int flags, filter_info; - int wdata[DIM0][DIM1], /* Write buffer */ - wdata2[EDIM0][EDIM1], /* Write buffer for - extension */ - **rdata, /* Read buffer */ - ndims, i, j; + int wdata[DIM0][DIM1]; /* Write buffer */ + int wdata2[EDIM0][EDIM1]; /* Write buffer for extension */ + int **rdata = NULL; /* Read buffer */ + int ndims; + hsize_t i, j; /* * Check if gzip compression is available and can be used for both diff --git a/HDF5Examples/C/H5D/16/h5ex_d_unlimmod.c b/HDF5Examples/C/H5D/16/h5ex_d_unlimmod.c index 6601427..f06a1ff 100644 --- a/HDF5Examples/C/H5D/16/h5ex_d_unlimmod.c +++ b/HDF5Examples/C/H5D/16/h5ex_d_unlimmod.c @@ -29,14 +29,20 @@ int main(void) { - hid_t file, space, dset, dcpl; /* Handles */ + hid_t file = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; herr_t status; - hsize_t dims[2] = {DIM0, DIM1}, extdims[2] = {EDIM0, EDIM1}, maxdims[2], chunk[2] = {CHUNK0, CHUNK1}; - int wdata[DIM0][DIM1], /* Write buffer */ - wdata2[EDIM0][EDIM1], /* Write buffer for - extension */ - **rdata, /* Read buffer */ - ndims, i, j; + hsize_t dims[2] = {DIM0, DIM1}; + hsize_t extdims[2] = {EDIM0, EDIM1}; + hsize_t maxdims[2]; + hsize_t chunk[2] = {CHUNK0, CHUNK1}; + int wdata[DIM0][DIM1]; /* Write buffer */ + int wdata2[EDIM0][EDIM1]; /* Write buffer for extension */ + int **rdata = NULL; /* Read buffer */ + int ndims; + hsize_t i, j; /* * Initialize data. diff --git a/HDF5Examples/C/H5D/CMakeLists.txt b/HDF5Examples/C/H5D/CMakeLists.txt index 02f9ac7..b530f4c 100644 --- a/HDF5Examples/C/H5D/CMakeLists.txt +++ b/HDF5Examples/C/H5D/CMakeLists.txt @@ -7,7 +7,7 @@ project (HDF5Examples_C_H5D C) include (C_sourcefiles.cmake) foreach (example_name ${common_examples}) - if (${H5_LIBVER_DIR} EQUAL 16) + if (${H5_LIBVER_DIR} EQUAL 16 OR ${EXAMPLE_VARNAME}_USE_16_API) add_executable (${EXAMPLE_VARNAME}_${example_name} ${PROJECT_SOURCE_DIR}/16/${example_name}.c) else () add_executable (${EXAMPLE_VARNAME}_${example_name} ${PROJECT_SOURCE_DIR}/${example_name}.c) diff --git a/HDF5Examples/C/H5G/CMakeLists.txt b/HDF5Examples/C/H5G/CMakeLists.txt index f517199..308349a 100644 --- a/HDF5Examples/C/H5G/CMakeLists.txt +++ b/HDF5Examples/C/H5G/CMakeLists.txt @@ -7,7 +7,7 @@ project (HDF5Examples_C_H5G C) include (C_sourcefiles.cmake) foreach (example_name ${common_examples}) - if (${H5_LIBVER_DIR} EQUAL 16) + if (${H5_LIBVER_DIR} EQUAL 16 OR ${EXAMPLE_VARNAME}_USE_16_API) add_executable (${EXAMPLE_VARNAME}_${example_name} ${PROJECT_SOURCE_DIR}/16/${example_name}.c) else () add_executable (${EXAMPLE_VARNAME}_${example_name} ${PROJECT_SOURCE_DIR}/${example_name}.c) @@ -37,7 +37,7 @@ foreach (example_name ${common_examples}) endif () endforeach () -if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.8") +if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.8" AND NOT ${EXAMPLE_VARNAME}_USE_16_API) foreach (example_name ${1_8_examples}) add_executable (${EXAMPLE_VARNAME}_${example_name} ${PROJECT_SOURCE_DIR}/${example_name}.c) target_compile_options(${EXAMPLE_VARNAME}_${example_name} @@ -212,7 +212,7 @@ if (H5EX_BUILD_TESTING) h5ex_g_iterate h5ex_g_traverse ) - if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.8") + if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.8" AND NOT ${EXAMPLE_VARNAME}_USE_16_API) set (exfiles ${exfiles} h5ex_g_visit ) @@ -369,7 +369,7 @@ if (H5EX_BUILD_TESTING) ADD_DUMP_TEST (h5ex_g_create) ADD_H5_CMP_TEST (h5ex_g_iterate) ADD_H5_CMP_TEST (h5ex_g_traverse) - if (NOT ${H5_LIBVER_DIR} EQUAL 16) + if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.8" AND NOT ${EXAMPLE_VARNAME}_USE_16_API) ADD_H5_DUMP2_TEST (h5ex_g_compact) ADD_H5_CMP_TEST (h5ex_g_corder) ADD_H5_CMP_TEST (h5ex_g_phase) diff --git a/HDF5Examples/C/H5T/CMakeLists.txt b/HDF5Examples/C/H5T/CMakeLists.txt index fb5a4e4..8c4084f 100644 --- a/HDF5Examples/C/H5T/CMakeLists.txt +++ b/HDF5Examples/C/H5T/CMakeLists.txt @@ -7,7 +7,7 @@ project (HDF5Examples_C_H5T C) include (C_sourcefiles.cmake) foreach (example_name ${common_examples}) - if (${H5_LIBVER_DIR} EQUAL 16) + if (${H5_LIBVER_DIR} EQUAL 16 OR ${EXAMPLE_VARNAME}_USE_16_API) add_executable (${EXAMPLE_VARNAME}_${example_name} ${PROJECT_SOURCE_DIR}/16/${example_name}.c) else () add_executable (${EXAMPLE_VARNAME}_${example_name} ${PROJECT_SOURCE_DIR}/${example_name}.c) diff --git a/HDF5Examples/JAVA/H5J/Java_sourcefiles.cmake b/HDF5Examples/JAVA/H5J/Java_sourcefiles.cmake index c643a16..e78e12e 100644 --- a/HDF5Examples/JAVA/H5J/Java_sourcefiles.cmake +++ b/HDF5Examples/JAVA/H5J/Java_sourcefiles.cmake @@ -10,7 +10,7 @@ set (HDF_JAVA_EXAMPLES HDF5GroupDatasetCreate.java HDF5SubsetSelect.java ) -if (NOT ${EXAMPLE_VARNAME}_USE_110_API AND H5_LIBVER_DIR EQUAL 110) +if (H5_LIBVER_DIR EQUAL 110) set (HDF_JAVA_EXAMPLES ${HDF_JAVA_EXAMPLES} 110/HDF5FileStructure.java ) diff --git a/config/cmake/HDF5ExampleCache.cmake b/config/cmake/HDF5ExampleCache.cmake index f5fb620..6ac9cc0 100644 --- a/config/cmake/HDF5ExampleCache.cmake +++ b/config/cmake/HDF5ExampleCache.cmake @@ -27,18 +27,19 @@ set (EXAMPLE_VARNAME "H5") set (H5EX_RESOURCES_DIR ${HDF_RESOURCES_DIR}) message (STATUS "HDF5 Example H5EX_RESOURCES_DIR: ${H5EX_RESOURCES_DIR}") if (DEFAULT_API_VERSION MATCHES "v16") - set (H5_LIBVER_DIR 16) + set (H5_USE_16_API ON) elseif (DEFAULT_API_VERSION MATCHES "v18") - set (H5_LIBVER_DIR 18) + set (H5_USE_18_API ON) elseif (DEFAULT_API_VERSION MATCHES "v110") - set (H5_LIBVER_DIR 110) + set (H5_USE_110_API ON) elseif (DEFAULT_API_VERSION MATCHES "v112") - set (H5_LIBVER_DIR 112) + set (H5_USE_112_API ON) elseif (DEFAULT_API_VERSION MATCHES "v114") - set (H5_LIBVER_DIR 114) + set (H5_USE_114_API ON) elseif (DEFAULT_API_VERSION MATCHES "v116") - set (H5_LIBVER_DIR 116) + set (H5_USE_116_API ON) endif () +message (STATUS "HDF5 H5_LIBVER_DIR: ${H5_LIBVER_DIR} HDF5_API_VERSION: ${DEFAULT_API_VERSION}") if (NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) set (USE_SHARED_LIBS OFF CACHE BOOL "Use Shared Libraries for Examples" FORCE) -- cgit v0.12