Skip to content

Commit

Permalink
Merge pull request #43 from byrnHDF/master-ex-16
Browse files Browse the repository at this point in the history
Fix support for 1.6 API
  • Loading branch information
lrknox authored Nov 29, 2023
2 parents 08fb93d + 6b7b69a commit 7b82524
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 24 deletions.
17 changes: 11 additions & 6 deletions C/H5D/C_sourcefiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
)
endif ()

set (1_8_examples
h5ex_d_nbit
h5ex_d_sofloat
h5ex_d_soint
h5ex_d_transform
)
if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.8" AND NOT ${${EXAMPLE_VARNAME}_USE_16_API})
set (1_8_examples
h5ex_d_nbit
h5ex_d_sofloat
h5ex_d_soint
h5ex_d_transform
)
else ()
set (1_8_examples)
endif ()

2 changes: 1 addition & 1 deletion C/H5G/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ if (HDF5_BUILD_TOOLS)
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})
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_h5ex_g_compact
POST_BUILD
Expand Down
18 changes: 11 additions & 7 deletions C/H5G/C_sourcefiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ set (common_examples
h5ex_g_traverse
)

set (1_8_examples
h5ex_g_compact
h5ex_g_corder
h5ex_g_phase
h5ex_g_intermediate
h5ex_g_visit
)
if (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.8" AND NOT ${${EXAMPLE_VARNAME}_USE_16_API})
set (1_8_examples
h5ex_g_compact
h5ex_g_corder
h5ex_g_phase
h5ex_g_intermediate
h5ex_g_visit
)
else ()
set (1_8_examples)
endif ()
1 change: 1 addition & 0 deletions C/H5T/16/h5ex_t_objrefatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ main(void)
hid_t space; /* Dataspace Handle */
hid_t dset; /* Dataset Handle */
hid_t obj; /* Object Handle */
hid_t attr; /* Attribute Handle */
herr_t status;
hsize_t dims[1] = {DIM0};
hobj_ref_t wdata[DIM0]; /* Write buffer */
Expand Down
43 changes: 33 additions & 10 deletions C/H5T/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,29 @@ endforeach ()
if (HDF5_BUILD_TOOLS)
foreach (example_name ${common_examples})
if (NOT ${example_name} STREQUAL "h5ex_t_convert")
if (HDF5_VERSION_MAJOR VERSION_EQUAL "1.6")
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/16/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
)
else ()
if (${example_name} STREQUAL "h5ex_t_vlen" OR ${example_name} STREQUAL "h5ex_t_vlenatt")
if (HDF5_VERSION_STRING VERSION_GREATER_EQUAL "1.14.3")
if (${H5_LIBVER_DIR} EQUAL 16 AND ${example_name} STREQUAL "h5ex_t_vlenatt")
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/16/114/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
)
else ()
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/114/${example_name}.ddl ${example_name}.ddl
)
endif ()
elseif (${H5_LIBVER_DIR} EQUAL 16)
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/114/${example_name}.ddl ${example_name}.ddl
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/16/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
)
else ()
add_custom_command (
Expand Down Expand Up @@ -172,12 +180,21 @@ if (HDF5_BUILD_TOOLS)
)
endif ()
elseif (HDF5_VERSION_MAJOR VERSION_GREATER_EQUAL "1.12")
if (${H5_LIBVER_DIR} EQUAL 16)
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/16/112/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
)
else ()
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/18/112/${example_name}.ddl ${example_name}.ddl
)
endif ()
else ()
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
Expand Down Expand Up @@ -235,6 +252,13 @@ if (HDF5_BUILD_TOOLS)
)
endif ()
endif ()
elseif (${H5_LIBVER_DIR} EQUAL 16)
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/tfiles/16/${example_name}.ddl ${PROJECT_BINARY_DIR}/${example_name}.ddl
)
else ()
add_custom_command (
TARGET ${EXAMPLE_VARNAME}_${example_name}
Expand All @@ -244,7 +268,6 @@ if (HDF5_BUILD_TOOLS)
)
endif ()
endif ()
endif ()
endforeach ()

# foreach (example_name ${1_8_examples})
Expand Down
18 changes: 18 additions & 0 deletions C/H5T/tfiles/16/114/h5ex_t_vlenatt.ddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
HDF5 "h5ex_t_vlenatt.h5" {
GROUP "/" {
DATASET "DS1" {
DATATYPE H5T_STD_I32LE
DATASPACE SCALAR
DATA {
(0): 0
}
ATTRIBUTE "A1" {
DATATYPE H5T_VLEN { H5T_STD_I32LE }
DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
DATA {
(0): (3, 2, 1), (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144)
}
}
}
}
}

0 comments on commit 7b82524

Please sign in to comment.