Skip to content

Commit

Permalink
Add build of h5z-sperr and sperr lib
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 committed May 16, 2024
1 parent 9b53752 commit b3100dd
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
38 changes: 38 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,24 @@ def get_snappy_clib(field=None):
return config[field]


def get_sperr_clib(field=None):
"""sperr static lib build config"""
sperr_dir = "src/SPERR"

config = dict(
sources=glob(f"{sperr_dir}/src/*.cpp"),
include_dirs=[f"{sperr_dir}/include"],
macros=[
("SPERR_VERSION_MAJOR", 0),
("USE_VANILLA_CONFIG", 1),
],
cflags=["-std=c++20"], # TODO
)
if field is None:
return 'sperr', config
return config[field]


def get_zfp_clib(field=None):
"""ZFP static lib build config"""
cflags = ['-O3', '-ffast-math', '-std=c99', '-fopenmp']
Expand Down Expand Up @@ -1148,6 +1166,24 @@ def get_sz3_plugin():
PLUGIN_LIB_DEPENDENCIES['sz3'] = ('zstd',)


def get_sperr_plugin():
h5z_sperr_dir = "src/H5Z-SPERR"

return HDF5PluginExtension(
"hdf5plugin.plugins.libh5sperr",
sources=[f"{h5z_sperr_dir}/src/h5z-sperr.c"],
include_dirs=get_sperr_clib("include_dirs") + [f"{h5z_sperr_dir}/include"],
extra_link_args=['-lstdc++'],
define_macros=[
("SPERR_VERSION_MAJOR", 0),
("USE_VANILLA_CONFIG", 1),
],
)


PLUGIN_LIB_DEPENDENCIES['sperr'] = ("sperr",)


def apply_filter_strip(libraries, extensions, dependencies):
"""Strip C libraries and extensions according to HDF5PLUGIN_STRIP env. var."""
stripped_filters = set(
Expand Down Expand Up @@ -1183,6 +1219,7 @@ def apply_filter_strip(libraries, extensions, dependencies):
get_charls_clib(),
get_lz4_clib(),
get_snappy_clib(),
get_sperr_clib(),
get_zfp_clib(),
get_zlib_clib(),
get_zstd_clib(),
Expand All @@ -1200,6 +1237,7 @@ def apply_filter_strip(libraries, extensions, dependencies):
get_zstandard_plugin(),
get_sz_plugin(),
get_sz3_plugin(),
get_sperr_plugin(),
],
dependencies=PLUGIN_LIB_DEPENDENCIES,
)
Expand Down
1 change: 1 addition & 0 deletions src/hdf5_dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ static struct {
NAME = *((hid_t *)dlsym(handle, #NAME))

DEF_DEFAULT_VARIABLE(H5E_ARGS_g);
DEF_DEFAULT_VARIABLE(H5E_BADSIZE_g);
DEF_DEFAULT_VARIABLE(H5E_BADTYPE_g);
DEF_DEFAULT_VARIABLE(H5E_BADVALUE_g);
DEF_DEFAULT_VARIABLE(H5E_CANTGET_g);
Expand Down

0 comments on commit b3100dd

Please sign in to comment.