Building filter plugins

Hello!

I use CMake to build HDF5 on Windows. The library can be built quite
straightforwardly, albeit it does take some time.

Now suppose I want to build filter plugins. In principle, only HDF5
headers are needed for that, incl. H5pubconf.h. What is the best/fastest
way to generate H5pubconf.h, using CMake? “cmake --build” works of
course, but it’s painfully slow.
Also, what are the minimal commands/dependencies I should add to
CMakeLists.txt, in case I elect to create one for my filter?

Best wishes,
Andrey Paramonov

Hi Andrey

the library itself builds extremely fast, you probably build all libraries and unit tests and maybe run them as well depending on your flags.

TBH I have a simple VS project structure and I only build the HDF5 C library.

I build my filters into separate DLLs so there’s no need to rebuild the library.

HTH

Dimitris

Hi Dimitris!

09.04.2018 19:45, Dimitris Servis пишет:

the library itself builds extremely fast, you probably build all
libraries and unit tests and maybe run them as well depending on your flags.

TBH I have a simple VS project structure and I only build the HDF5 C
library.

I build my filters into separate DLLs so there’s no need to rebuild the
library.

The latter is true. However, H5pubconf.h is required to build separate
DLLs, and that can only be obtained with “cmake --build”, to my best
knowledge. It there a faster/more optimal way?

BTW, what CMake keys you are using to build just the DLL?

Best wishes,
Andrey Paramonov

P.S: That’s all on Windows, on *nix the things are much simpler
(H5pubconf.h is readily available in /usr/include/hdf5/).

Hello!

09.04.2018 20:09, Andrey Paramonov пишет:

However, H5pubconf.h is required to build separate
DLLs, and that can only be obtained with “cmake --build”, to my best
knowledge. It there a faster/more optimal way?

BTW, what CMake keys you are using to build just the DLL?

P.S: That’s all on Windows, on *nix the things are much simpler
(H5pubconf.h is readily available in /usr/include/hdf5/).

Probably H5pubconf.h issue should be considered a feature request then? :wink:

Best wishes,
Andrey Paramonov

H5pubconf.h is built dynamically when the HDF5 library is configured and built. H5pubconf.h is specific to the type of platform you are executing your application.
So to build the plugins you need an installation of the HDF5 library, either by building or installing a binary.

Allen

Hello Allen!

18.04.2018 16:54, byrn пишет:

H5pubconf.h is built dynamically when the HDF5 library is configured and
built. H5pubconf.h is specific to the type of platform you are executing
your application.

True.

So to build the plugins you need an installation of the HDF5 library,
either by building or installing a binary.

No :slight_smile: A counter-example: I can build

with
$ gcc -O3 -shared -o zstd.so -fPIC zstd_h5plugin.c
or

cl /LD /MD /Ox zstd_h5plugin.c /I path\to\hdf5\src /I
path\to\H5pubconf.h /I path\to\zstd\src /link zstd.lib
neither of which requires HDF5 .so/.dll.

So, it will be useful if HDF5 build system is able to create
H5pubconf.h, uncoupled from lengthy .so/.dll build.

And again, what is the magik line to build HDF5 C library only, without
tests and utils?

Best wishes,
Andrey Paramonov

Actually, for H5pubconf.h you only need to configure.

i.e.
cmake -C /config/cmake/cacheinit.cmake
DTGZPATH:PATH= -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=“TGZ” -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_ANSI_CFLAGS:STRING=-fPIC

Hello Allen!

18.04.2018 17:57, byrn пишет:

Actually, for H5pubconf.h you only need to configure.

i.e.
cmake -C /config/cmake/cacheinit.cmake
DTGZPATH:PATH= -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=“TGZ”
-DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_ANSI_CFLAGS:STRING=-fPIC

Thank you for the insight! It appeared that my cmake call was only a
hair from success: the command
cmake -G “Visual Studio 15” -C
n:/CMake-hdf5-1.10.2/hdf5-1.10.2/config/cmake/cacheinit.cmake
-DHDF5_BUILD_FORTRAN=NO n:/CMake-hdf5-1.10.2/hdf5-1.10.2
worked, and created the precious H5pubconf.h.

But I suspect it still does a lot of extraneous work. What is the cmake
line to configure for just the C library build, without
Fortran/Java/tests/utils?

Best wishes,
Andrey Paramonov

Eliminate the cacheinit reference then the library defaults will be used - however configuration does very little (other then setting the options to non-default values) w.r.t optional components.

Beware of cacheinit.cmake settings you want.

Allen