mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
Update examples with 1.6 api and static libs (#3874)
* Update examples with 1.6 api and static libs * Only check for STATIC only builds * Do not calculate version as library has already.
This commit is contained in:
@@ -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 ()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ()
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 (
|
||||
@@ -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}
|
||||
@@ -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}
|
||||
@@ -244,7 +268,6 @@ if (HDF5_BUILD_TOOLS)
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# foreach (example_name ${1_8_examples})
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
-10
@@ -30,17 +30,19 @@ message (STATUS "HDF5 H5_LIBVER_DIR: ${H5_LIBVER_DIR}")
|
||||
#-----------------------------------------------------------------------------
|
||||
# parse the full version number from H5public.h and include in H5_VERS_INFO
|
||||
#-----------------------------------------------------------------------------
|
||||
find_file (_h5public_h H5public.h ${H5EX_HDF5_INCLUDE_DIRS})
|
||||
file (READ ${_h5public_h} _h5public_h_contents)
|
||||
if(NOT DEFINED _h5public_h_contents)
|
||||
find_file (_h5public_h H5public.h ${H5EX_HDF5_INCLUDE_DIRS})
|
||||
file (READ ${_h5public_h} _h5public_h_contents)
|
||||
|
||||
string (REGEX REPLACE ".*#define[ \t]+H5_VERS_MAJOR[ \t]+([0-9]*).*$"
|
||||
"\\1" H5_VERS_MAJOR ${_h5public_h_contents})
|
||||
string (REGEX REPLACE ".*#define[ \t]+H5_VERS_MINOR[ \t]+([0-9]*).*$"
|
||||
"\\1" H5_VERS_MINOR ${_h5public_h_contents})
|
||||
string (REGEX REPLACE ".*#define[ \t]+H5_VERS_RELEASE[ \t]+([0-9]*).*$"
|
||||
"\\1" H5_VERS_RELEASE ${_h5public_h_contents})
|
||||
string (REGEX REPLACE ".*#define[ \t]+H5_VERS_SUBRELEASE[ \t]+\"([0-9A-Za-z._-]*)\".*$"
|
||||
"\\1" H5_VERS_SUBRELEASE ${_h5public_h_contents})
|
||||
string (REGEX REPLACE ".*#define[ \t]+H5_VERS_MAJOR[ \t]+([0-9]*).*$"
|
||||
"\\1" H5_VERS_MAJOR ${_h5public_h_contents})
|
||||
string (REGEX REPLACE ".*#define[ \t]+H5_VERS_MINOR[ \t]+([0-9]*).*$"
|
||||
"\\1" H5_VERS_MINOR ${_h5public_h_contents})
|
||||
string (REGEX REPLACE ".*#define[ \t]+H5_VERS_RELEASE[ \t]+([0-9]*).*$"
|
||||
"\\1" H5_VERS_RELEASE ${_h5public_h_contents})
|
||||
string (REGEX REPLACE ".*#define[ \t]+H5_VERS_SUBRELEASE[ \t]+\"([0-9A-Za-z._-]*)\".*$"
|
||||
"\\1" H5_VERS_SUBRELEASE ${_h5public_h_contents})
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
set(CMAKE_TEST_LIB_DIRECTORY "${HDF5_TOOLS_DIR}")
|
||||
|
||||
@@ -10,10 +10,17 @@ set (H5EX_BUILD_EXAMPLES ${HDF5_BUILD_EXAMPLES} CACHE BOOL "Build H5PL Examples"
|
||||
|
||||
#preset HDF5 cache vars to this projects libraries instead of searching
|
||||
set (H5EX_HDF5_HEADER "H5pubconf.h" CACHE STRING "Name of HDF5 header" FORCE)
|
||||
set (H5EX_HDF5_LINK_LIBS ${HDF5_LIBSH_TARGET} CACHE STRING "HDF5 target" FORCE)
|
||||
#set (H5EX_HDF5_INCLUDE_DIRS $<TARGET_PROPERTY:${HDF5_LIBSH_TARGET},INCLUDE_DIRECTORIES> CACHE PATH "HDF5 include dirs" FORCE)
|
||||
set (H5EX_HDF5_INCLUDE_DIRS "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR}" CACHE PATH "HDF5 include dirs" FORCE)
|
||||
set (H5EX_HDF5_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE STRING "HDF5 build folder" FORCE)
|
||||
|
||||
set (H5EX_HDF5_DUMP_EXECUTABLE $<TARGET_FILE:h5dump-shared> CACHE STRING "HDF5 h5dump target" FORCE)
|
||||
set (H5EX_HDF5_REPACK_EXECUTABLE $<TARGET_FILE:h5repack-shared> CACHE STRING "HDF5 h5repack target" FORCE)
|
||||
if (NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
|
||||
set (USE_SHARED_LIBS OFF CACHE BOOL "Use Shared Libraries for Examples" FORCE)
|
||||
set (H5EX_HDF5_LINK_LIBS ${HDF5_LIB_TARGET} CACHE STRING "HDF5 target" FORCE)
|
||||
else ()
|
||||
set (USE_SHARED_LIBS ON CACHE BOOL "Use Shared Libraries for Examples" FORCE)
|
||||
set (H5EX_HDF5_LINK_LIBS ${HDF5_LIBSH_TARGET} CACHE STRING "HDF5 target" FORCE)
|
||||
endif ()
|
||||
|
||||
set (H5EX_HDF5_DUMP_EXECUTABLE $<TARGET_FILE:h5dump${tgt_file_ext}> CACHE STRING "HDF5 h5dump target" FORCE)
|
||||
set (H5EX_HDF5_REPACK_EXECUTABLE $<TARGET_FILE:h5repack${tgt_file_ext}> CACHE STRING "HDF5 h5repack target" FORCE)
|
||||
|
||||
Reference in New Issue
Block a user