Skip to content

Commit d500b04

Browse files
committed
[#2]:svarga:docs, added initial readme-s
1 parent b93981d commit d500b04

2 files changed

Lines changed: 203 additions & 64 deletions

File tree

README.md

Lines changed: 77 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,36 @@
1-
<!---
2-
Copyright (c) 2018-2020 Steven Varga, Toronto,ON Canada
3-
Author: Varga, Steven <steven@vargaconsulting.ca>
4-
--->
51

6-
Source code transformation tool for HDF5 dataformat H5CPP header only library
7-
----------------------------------------------------------------------------------------------------
2+
[![CI](https://github.com/vargaconsulting/h5cpp-compiler/actions/workflows/ci.yml/badge.svg)](https://github.com/vargaconsulting/h5cpp-compiler/actions/workflows/ci.yml)
3+
[![codecov](https://codecov.io/gh/vargaconsulting/h5cpp-compiler/branch/main/graph/badge.svg)](https://codecov.io/gh/vargaconsulting/h5cpp-compiler)
4+
[![MIT License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
5+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.17069343.svg)](https://doi.org/10.5281/zenodo.17069343)
6+
7+
[![GitHub release](https://img.shields.io/github/v/release/vargaconsulting/h5cpp-compiler.svg)](https://github.com/vargaconsulting/h5cpp-compiler/releases)
8+
[![Documentation](https://img.shields.io/badge/docs-stable-blue)](https://vargaconsulting.github.io/h5cpp-compiler)
9+
10+
# Source code transformation tool for HDF5 dataformat H5CPP header only library
11+
## Build Matrix
12+
13+
| OS / Compiler | GCC 13 | GCC 14 | GCC 15 | Clang 14 | Clang 15 | Clang 17 |
14+
|---------------|-------------|-------------|-------------|---------------|---------------|---------------|
15+
| Ubuntu 22.04 |![gcc13][200]|![gcc14][201]|![gcc15][202]|![clang14][210]|![clang15][211]|![clang17][212]|
16+
| Ubuntu 24.04 |![gcc13][300]|![gcc14][301]|![gcc15][302]|![clang14][310]|![clang15][311]|![clang17][312]|
17+
| macOS |![gcc13][600]|![gcc14][601]|![gcc15][602]|![clang14][610]|![clang15][611]|![clang17][612]|
18+
| Windows |![gcc13][700]|![gcc13][701]|![gcc13][702]|![clang14][710]|![clang15][711]|![clang17][712]|
19+
820

921
This source code transformation tool simplifies the otherwise time consuming process of generating the shim code for HDF5 Compound datatypes by building the AST of a given TU translation unit, and identifying all POD datatypes referenced from H5CPP operators/functions.
1022
The result is a seamless persistence much similar to python, java or other reflection based languages.
1123

1224
The following excerpt shows the mechanism, how `vec` variable is marked by `h5::write` operator. When `h5cpp` tool is invoked it builds the full AST of the translation unit, finds the referenced types, then in topological order generates HDF5 COMPOUND datatype descriptors. The generated file has include guards, and meant to be used with [H5CPP template library](h5cpp.org). POD struct types may be arbitrary deep, embedded in POD C like arrays, and may be referenced from STL containers. Currently `stl::vector` is supported, but in time full support will be provided.
1325

26+
## Installation
27+
```bash
28+
sudo apt install build-essential cmake
29+
cmake -DCMAKE_BUILD_TYPE=Release -S . -B build
30+
cmake --build build --parallel
31+
sudo cmake --install build
32+
```
33+
1434
```cpp
1535
...
1636
std::vector<sn::example::Record> vec
@@ -68,64 +88,57 @@ namespace sn {
6888
/* END IGNORED STRUCTS */
6989
```
7090
71-
Install:
72-
----------
73-
Only **LLVM 6.0 is supported**, to compile from source you need both the llvm and clang-dev package installed:
74-
```
75-
sudo apt install llvm-6.0 llvm-6.0-dev libclang-6.0-dev # 640MB space needed
76-
make && make install # compile the source code transforation tool
77-
```
78-
optionally you can remove the development libraries, and install only the runtime
91+
92+
# Python virtual environment for this website
93+
94+
## Setup
95+
96+
```bash
97+
python3 -m venv .venv # Create a virtual env (Python 3.10+ recommended)
98+
source .venv/bin/activate # Activate: Linux / macOS
99+
# On Windows use: .venv\Scripts\activate
100+
101+
pip install --upgrade pip # Upgrade pip
102+
pip install mkdocs-material # Install MkDocs + Material theme
103+
pip install python-frontmatter jinja2 python-dateutil pyyaml # Extra deps
79104
```
80-
sudo apt purge llvm-6.0 libllvm-6.0-dev libclang-6.0-dev # remove development libraries
81-
sudo apt install libllvm6.0 libclang-common-6.0-dev # install runtime dependencies
105+
106+
## Run MkDocs locally
107+
108+
```bash
109+
source .venv/bin/activate
110+
mkdocs serve --dev-addr=127.0.0.1:9000 # Live preview at http://127.0.0.1:9000
111+
mkdocs build -v # Build static site locally
82112
```
83113

84-
Caveat:
85-
-------
86-
All LLVM version other than 6.0 is failing, or crashing including the clang++ chain. This is being investigated, and once resolved this message
87-
will be removed.
88-
89-
Usage:
90-
-------
91-
`h5cpp your_translation_unit.cpp -- -v $(CXXFLAGS) -Dgenerated.h`
92-
will run the compiler front end on the specified input, and outputs the necessary HDF5 type descriptors, or
93-
the error message if any.
94-
95-
96-
97-
[hdf5]: https://support.hdfgroup.org/HDF5/doc/H5.intro.html
98-
[1]: http://en.cppreference.com/w/cpp/container/vector
99-
[2]: http://arma.sourceforge.net
100-
[4]: https://support.hdfgroup.org/HDF5/doc/RM/RM_H5Front.html
101-
[5]: https://support.hdfgroup.org/HDF5/release/obtain5.html
102-
[6]: http://eigen.tuxfamily.org/index.php?title=Main_Page
103-
[7]: http://www.boost.org/doc/libs/1_65_1/libs/numeric/ublas/doc/matrix.htm
104-
[8]: https://julialang.org/
105-
[9]: https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_.28CSR.2C_CRS_or_Yale_format.29
106-
[10]: https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_column_.28CSC_or_CCS.29
107-
[11]: https://en.wikipedia.org/wiki/List_of_numerical_libraries#C++
108-
[12]: http://en.cppreference.com/w/cpp/concept/StandardLayoutType
109-
[40]: https://support.hdfgroup.org/HDF5/Tutor/HDF5Intro.pdf
110-
[99]: https://en.wikipedia.org/wiki/C_(programming_language)#Pointers
111-
[100]: http://arma.sourceforge.net/
112-
[101]: http://www.boost.org/doc/libs/1_66_0/libs/numeric/ublas/doc/index.html
113-
[102]: http://eigen.tuxfamily.org/index.php?title=Main_Page#Documentation
114-
[103]: https://sourceforge.net/projects/blitz/
115-
[104]: https://sourceforge.net/projects/itpp/
116-
[105]: http://dlib.net/linear_algebra.html
117-
[106]: https://bitbucket.org/blaze-lib/blaze
118-
[107]: https://github.com/wichtounet/etl
119-
[200]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_profiling_README.html
120-
[201]: http://h5cpp.org/examples.html
121-
[202]: http://h5cpp.org/modules.html
122-
[305]: md__home_steven_Documents_projects_h5cpp_docs_pages_compiler_trial.html#link_try_compiler
123-
[400]: https://www.meetup.com/Chicago-C-CPP-Users-Group/events/250655716/
124-
[401]: https://www.hdfgroup.org/2018/07/cpp-has-come-a-long-way-and-theres-plenty-in-it-for-users-of-hdf5/
125-
[999]: http://h5cpp.org/cgi/redirect.py
126-
[301]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_docs_pages_conversion.html
127-
[302]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_docs_pages_exceptions.html
128-
[303]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_docs_pages_compiler.html
129-
[304]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_docs_pages_linalg.html
130-
[305]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_docs_pages_install.html
131-
[400]: http://h5cpp.org/md__home_steven_Documents_projects_h5cpp_docs_pages_error_handling.html
114+
<!-- Ubuntu 22.04 -->
115+
[200]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-gcc-13.svg
116+
[201]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-gcc-14.svg
117+
[202]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-gcc-15.svg
118+
[210]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-clang-14.svg
119+
[211]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-clang-15.svg
120+
[212]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-clang-17.svg
121+
122+
<!-- Ubuntu 24.04 -->
123+
[300]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-gcc-13.svg
124+
[301]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-gcc-14.svg
125+
[302]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-gcc-15.svg
126+
[310]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-clang-14.svg
127+
[311]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-clang-15.svg
128+
[312]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-clang-17.svg
129+
130+
<!-- macOS latest -->
131+
[600]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-gcc-13.svg
132+
[601]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-gcc-14.svg
133+
[602]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-gcc-15.svg
134+
[610]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-clang-14.svg
135+
[611]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-clang-15.svg
136+
[612]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-clang-17.svg
137+
138+
<!-- Windows (clang & gcc) -->
139+
[700]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-gcc-13.svg
140+
[701]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-gcc-14.svg
141+
[702]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-gcc-15.svg
142+
[710]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-clang-14.svg
143+
[711]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-clang-15.svg
144+
[712]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-clang-17.svg

docs/index.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
hide:
3+
- toc
4+
---
5+
6+
<div class="flex flex-wrap gap-2">
7+
<a href="https://github.com/vargaconsulting/h5cpp-compiler/actions">
8+
<img src="https://img.shields.io/badge/CI-passing-brightgreen" class="h-6" />
9+
</a>
10+
<a href="https://codecov.io/gh/vargaconsulting/h5cpp-compiler">
11+
<img src="https://img.shields.io/codecov/c/github/vargaconsulting/h5cpp-compiler" class="h-6" />
12+
</a>
13+
<a href="LICENSE">
14+
<img src="https://img.shields.io/badge/license-MIT-green.svg" class="h-6" />
15+
</a>
16+
<a href="https://doi.org/10.5281/zenodo.17069343">
17+
<img src="https://zenodo.org/badge/DOI/10.5281/zenodo.17069343.svg" class="h-6" />
18+
</a>
19+
</div>
20+
21+
22+
| OS / Compiler | GCC 13 | GCC 14 | GCC 15 | Clang 14 | Clang 15 | Clang 17 |
23+
|---------------|-------------|-------------|-------------|---------------|---------------|---------------|
24+
| Ubuntu 22.04 |![gcc13][200]|![gcc14][201]|![gcc15][202]|![clang14][210]|![clang15][211]|![clang17][212]|
25+
| Ubuntu 24.04 |![gcc13][300]|![gcc14][301]|![gcc15][302]|![clang14][310]|![clang15][311]|![clang17][312]|
26+
| macOS |![gcc13][600]|![gcc14][601]|![gcc15][602]|![clang14][610]|![clang15][611]|![clang17][612]|
27+
| Windows |![gcc13][700]|![gcc13][701]|![gcc13][702]|![clang14][710]|![clang15][711]|![clang17][712]|
28+
29+
H5CPP compiler is an LLVM/Clang–powered **reverse schema compiler**. Instead of forcing you to design schemas up front, the H5CPP compiler dives into your existing C and C++ code, extracts full type graphs, and automatically generates persistence descriptors. Born out of the [H5CPP header-only library](http://h5cpp.org), the compiler eliminates the grind of hand-crafting shim code for HDF5 compound datatypes. Mark a variable with a persistence operator (like `h5::write`), and the H5CPP compiler will walk the AST, discover every dependent type, and in clean topological order emit a ready-to-use header with HDF5 descriptors. Self-contained, include-guarded, and built to drop straight into your workflow.
30+
31+
The payoff? **Non-intrusive, reflection-driven persistence for modern C and C++** — the ease of Python or Java–style serialization, but with the raw performance, type safety, and zero-overhead ethos that C and C++ demand. Complex POD structs? Deeply nested arrays? STL containers? No problem. The H5CPP compiler handles them with ease. Today it supports `std::vector`, tomorrow an ever-growing slice of the STL universe.
32+
33+
```cpp
34+
std::vector<sn::example::Record> vec
35+
= h5::utils::get_test_data<sn::example::Record>(20);
36+
37+
// mark vec with an h5:: operator and delegate
38+
// the details to h5cpp compiler
39+
h5::write(fd, "orm/partial/vector one_shot", vec );
40+
````
41+
42+
### Example Structs
43+
44+
```cpp
45+
namespace sn {
46+
namespace typecheck {
47+
struct Record {
48+
char _char; unsigned char _uchar; short _short; unsigned short _ushort;
49+
int _int; unsigned int _uint; long _long; unsigned long _ulong;
50+
long long int _llong; unsigned long long _ullong;
51+
float _float; double _double; long double _ldouble;
52+
bool _bool;
53+
// wide characters are not supported in HDF5
54+
// wchar_t _wchar; char16_t _wchar16; char32_t _wchar32;
55+
};
56+
}
57+
58+
namespace other {
59+
struct Record {
60+
MyUInt idx;
61+
MyUInt aa;
62+
double field_02[3];
63+
typecheck::Record field_03[4];
64+
};
65+
}
66+
67+
namespace example {
68+
struct Record {
69+
MyUInt idx;
70+
float field_02[7];
71+
sn::other::Record field_03[5];
72+
sn::other::Record field_04[5]; // optimized out, same as previous
73+
other::Record field_05[3][8]; // array of arrays
74+
};
75+
}
76+
77+
namespace not_supported_yet {
78+
// NON POD: not supported in phase 1
79+
struct Container {
80+
double idx;
81+
std::string field_05; // non-POD
82+
std::vector<example::Record> field_02; // non-POD
83+
};
84+
}
85+
86+
/* BEGIN IGNORED STRUCT */
87+
// These structs are not referenced with h5::read|h5::write|h5::create
88+
struct IgnoredRecord {
89+
signed long int idx;
90+
float field_0n;
91+
};
92+
/* END IGNORED STRUCT */
93+
}
94+
```
95+
96+
<!-- Ubuntu 22.04 -->
97+
[200]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-gcc-13.svg
98+
[201]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-gcc-14.svg
99+
[202]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-gcc-15.svg
100+
[210]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-clang-14.svg
101+
[211]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-clang-15.svg
102+
[212]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-22.04-clang-17.svg
103+
104+
<!-- Ubuntu 24.04 -->
105+
[300]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-gcc-13.svg
106+
[301]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-gcc-14.svg
107+
[302]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-gcc-15.svg
108+
[310]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-clang-14.svg
109+
[311]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-clang-15.svg
110+
[312]: https://vargaconsulting.github.io/h5cpp-compiler/badges/ubuntu-24.04-clang-17.svg
111+
112+
<!-- macOS latest -->
113+
[600]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-gcc-13.svg
114+
[601]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-gcc-14.svg
115+
[602]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-gcc-15.svg
116+
[610]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-clang-14.svg
117+
[611]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-clang-15.svg
118+
[612]: https://vargaconsulting.github.io/h5cpp-compiler/badges/macos-latest-clang-17.svg
119+
120+
<!-- Windows (clang & gcc) -->
121+
[700]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-gcc-13.svg
122+
[701]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-gcc-14.svg
123+
[702]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-gcc-15.svg
124+
[710]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-clang-14.svg
125+
[711]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-clang-15.svg
126+
[712]: https://vargaconsulting.github.io/h5cpp-compiler/badges/windows-latest-clang-17.svg

0 commit comments

Comments
 (0)