Skip to content

Commit 1c8e4f9

Browse files
author
steven varga
committed
Merge branch 'staging' into release
2 parents 544a544 + ac994cc commit 1c8e4f9

15 files changed

Lines changed: 374 additions & 4 deletions

File tree

.github/workflows/package.yml

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ jobs:
6363
shell: bash
6464
run: |
6565
ref="${GITHUB_REF_NAME}"
66-
echo "H5CPP_VERSION=${ref#v}" >> "$GITHUB_ENV"
66+
if [[ "$ref" == v* ]]; then
67+
echo "H5CPP_VERSION=${ref#v}" >> "$GITHUB_ENV"
68+
else
69+
echo "H5CPP_VERSION=1.12.99-test" >> "$GITHUB_ENV"
70+
fi
6771
6872
- name: Install LLVM toolchain (Linux)
6973
if: runner.os == 'Linux'
@@ -213,6 +217,15 @@ jobs:
213217
cpack -G "${{ matrix.generators }}" \
214218
-D "CPACK_PACKAGE_FILE_NAME=h5cpp-compiler-${H5CPP_VERSION}-${{ matrix.asset_suffix }}" \
215219
--config CPackConfig.cmake
220+
# macOS guard: productbuild must produce a real payload
221+
if [[ "${{ matrix.generators }}" == "productbuild" ]]; then
222+
pkg="h5cpp-compiler-${H5CPP_VERSION}-${{ matrix.asset_suffix }}.pkg"
223+
size=$(stat -f%z "$pkg" 2>/dev/null || stat -c%s "$pkg" 2>/dev/null)
224+
if (( size < 100000 )); then
225+
echo "macOS package is suspiciously small (${size} bytes) — likely empty" >&2
226+
exit 1
227+
fi
228+
fi
216229
env:
217230
CPACK_DEBIAN_PACKAGE_ARCHITECTURE: ${{ matrix.deb_arch }}
218231
CPACK_RPM_PACKAGE_ARCHITECTURE: ${{ matrix.rpm_arch }}
@@ -264,6 +277,70 @@ jobs:
264277
if-no-files-found: error
265278
path: dist/*.tar.gz
266279

280+
wine-smoke-test:
281+
name: Wine smoke-test / Windows NSIS
282+
needs: package
283+
runs-on: ubuntu-24.04
284+
if: startsWith(github.ref, 'refs/tags/')
285+
286+
steps:
287+
- name: Install Wine
288+
shell: bash
289+
run: |
290+
set -euxo pipefail
291+
sudo dpkg --add-architecture i386
292+
sudo apt-get update
293+
sudo apt-get install -y --no-install-recommends wine64 wine32 xvfb
294+
295+
- name: Download Windows artifact
296+
uses: actions/download-artifact@v8
297+
with:
298+
name: h5cpp-compiler-windows-latest-NSIS
299+
path: windows-artifact
300+
301+
- name: Smoke-test under Wine
302+
shell: bash
303+
run: |
304+
set -euxo pipefail
305+
export WINEPREFIX=/tmp/wine-smoke
306+
export WINEARCH=win64
307+
308+
# Initialize Wine prefix silently
309+
xvfb-run -a wine64 wineboot --init 2>/dev/null || true
310+
311+
# Locate the NSIS installer
312+
installer=( windows-artifact/h5cpp-compiler-*.exe )
313+
if [[ ! -f "${installer[0]}" ]]; then
314+
echo "No Windows installer found in artifact" >&2
315+
exit 1
316+
fi
317+
318+
# Silent install
319+
xvfb-run -a wine64 "${installer[0]}" /S
320+
321+
# Locate installed binary (glob handles versioned install dir)
322+
h5cpp_exe=( /tmp/wine-smoke/drive_c/Program\ Files/h5cpp-compiler/*/bin/h5cpp.exe )
323+
if [[ ! -f "${h5cpp_exe[0]}" ]]; then
324+
echo "h5cpp.exe not found after NSIS install" >&2
325+
exit 1
326+
fi
327+
328+
# Run smoke test
329+
output=$(xvfb-run -a wine64 "${h5cpp_exe[0]}" --version 2>&1)
330+
echo "$output"
331+
332+
# Validate expected output
333+
if ! grep -q "H5CPP:" <<< "$output"; then
334+
echo "Smoke test failed: missing H5CPP banner" >&2
335+
exit 1
336+
fi
337+
if ! grep -q "LLVM version" <<< "$output"; then
338+
echo "Smoke test failed: missing LLVM version string" >&2
339+
exit 1
340+
fi
341+
342+
echo "Wine smoke-test passed"
343+
267344
publish:
268345
name: Publish Release
269346
needs: [package, musl]

CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,14 @@ endif()
181181

182182
# Install directives
183183
include(GNUInstallDirs)
184-
install(TARGETS h5cpp DESTINATION ${CMAKE_INSTALL_BINDIR})
185-
install(FILES h5cpp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
184+
install(TARGETS h5cpp DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime)
185+
install(FILES h5cpp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT runtime)
186186

187187
# CMake helper modules for consumers
188188
install(
189189
DIRECTORY cmake/
190190
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/h5cpp-compiler
191+
COMPONENT runtime
191192
FILES_MATCHING PATTERN "*.cmake"
192193
)
193194

@@ -215,7 +216,11 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Source code transformation tool for HDF5
215216
set(CPACK_PACKAGE_CONTACT "steven@vargalabs.com")
216217
set(CPACK_PACKAGE_LICENSE "MIT")
217218
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT.txt")
218-
set(CPACK_MONOLITHIC_INSTALL 1)
219+
# MONOLITHIC is safe for DEB/RPM, but breaks productbuild on macOS
220+
# (CMake #18201: empty distribution XML when monolithic + productbuild)
221+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
222+
set(CPACK_MONOLITHIC_INSTALL 1)
223+
endif()
219224

220225
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
221226
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
@@ -235,6 +240,12 @@ endif()
235240

236241
include(CPack)
237242

243+
cpack_add_component(runtime
244+
DISPLAY_NAME "h5cpp-compiler"
245+
DESCRIPTION "Source code transformation tool for HDF5 H5CPP library"
246+
REQUIRED
247+
)
248+
238249
option(H5CPP_BUILD_TESTS "Build h5cpp-compiler fixture tests" ON)
239250
if(H5CPP_BUILD_TESTS)
240251
enable_testing()

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,37 @@ sudo cmake --install build
160160

161161
See `examples/cmake-integration/` for a complete working project.
162162

163+
## vcpkg
164+
165+
### Manifest mode
166+
167+
If you use vcpkg in [manifest mode](https://learn.microsoft.com/en-us/vcpkg/concepts/manifest-mode), run the following from the project root after cloning:
168+
169+
```bash
170+
vcpkg install
171+
```
172+
173+
This reads the `vcpkg.json` manifest and resolves the `llvm` dependency (with `clang` and `tools` features).
174+
175+
> **Note:** h5cpp-compiler is compatible with LLVM 18, 19, and 20. vcpkg currently provides `llvm` at 18.1.6.
176+
177+
### Registry port
178+
179+
To consume `h5cpp-compiler` through a custom vcpkg registry, copy the `vcpkg/` directory into your registry under `ports/h5cpp-compiler/`:
180+
181+
```
182+
ports/
183+
h5cpp-compiler/
184+
portfile.cmake
185+
vcpkg.json
186+
```
187+
188+
Add the port to your registry `versions/baseline.json`, then install it with:
189+
190+
```bash
191+
vcpkg install h5cpp-compiler
192+
```
193+
163194
## Compatibility
164195

165196
| h5cpp-compiler | h5cpp library |

conan/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# h5cpp-compiler Conan 2.x Recipe
2+
3+
This directory contains the Conan 2.x recipe for `h5cpp-compiler`.
4+
5+
## Creating the Package
6+
7+
From the repository root:
8+
9+
```bash
10+
conan create .
11+
```
12+
13+
## Consuming as a Tool Dependency
14+
15+
Add `h5cpp-compiler` to your consumer's `tool_requires`:
16+
17+
```python
18+
from conan import ConanFile
19+
20+
class MyProject(ConanFile):
21+
name = "my-project"
22+
version = "1.0.0"
23+
settings = "os", "compiler", "build_type", "arch"
24+
tool_requires = "h5cpp-compiler/1.12.6"
25+
```
26+
27+
In your `CMakeLists.txt`:
28+
29+
```cmake
30+
find_package(H5CPPCompiler REQUIRED)
31+
h5cpp_compiler_generate(
32+
INPUT ${CMAKE_CURRENT_SOURCE_DIR}/particle.cpp
33+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/particle_h5.hpp
34+
)
35+
target_sources(my_app PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/particle_h5.hpp)
36+
```
37+
38+
## Notes
39+
40+
- The recipe currently depends on `llvm-core/19.1.7` from ConanCenter.
41+
- LLVM 20 support is planned; update the requirement in `conanfile.py` once `llvm-core/20.x` is published.

conandata.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sources:
2+
"1.12.6":
3+
url: "https://github.com/vargalabs/h5cpp-compiler/archive/refs/tags/v1.12.6.tar.gz"
4+
sha256: "c5f5829cec4908ad93647c17f27d0a82b75a5413fcad8c99232ba2034d0149a2"

conanfile.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
from conan import ConanFile
2+
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
3+
from conan.tools.files import copy
4+
5+
6+
class H5CppCompilerConan(ConanFile):
7+
name = "h5cpp-compiler"
8+
version = "1.12.6"
9+
package_type = "application"
10+
settings = "os", "compiler", "build_type", "arch"
11+
exports_sources = (
12+
"CMakeLists.txt",
13+
"src/*",
14+
"cmake/*",
15+
"h5cpp.1",
16+
"COPYRIGHT*",
17+
"COPYRIGHT.txt",
18+
)
19+
20+
def layout(self):
21+
cmake_layout(self)
22+
23+
def requirements(self):
24+
# h5cpp-compiler is compatible with LLVM 18+, 19+, and 20.
25+
# ConanCenter currently provides llvm-core at 19.1.7.
26+
self.requires("llvm-core/19.1.7")
27+
28+
def generate(self):
29+
deps = CMakeDeps(self)
30+
deps.generate()
31+
tc = CMakeToolchain(self)
32+
tc.generate()
33+
34+
def build(self):
35+
cmake = CMake(self)
36+
cmake.configure()
37+
cmake.build()
38+
39+
def package(self):
40+
cmake = CMake(self)
41+
cmake.install()
42+
43+
def package_info(self):
44+
self.cpp_info.bindirs = ["bin"]
45+
self.cpp_info.libdirs = []
46+
self.cpp_info.includedirs = []
47+
48+
def package_id(self):
49+
# For a build-time tool, compiler and build_type do not affect the
50+
# package ID in a meaningful way for consumers that use it as a
51+
# tool_requires. Clearing them keeps the package ID stable.
52+
del self.info.settings.compiler
53+
del self.info.settings.build_type

spack/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Spack Package for h5cpp-compiler
2+
3+
This directory contains a custom Spack repository with the `h5cpp-compiler` package recipe.
4+
5+
## Adding the repository
6+
7+
```bash
8+
spack repo add /path/to/h5cpp-compiler/spack
9+
```
10+
11+
## Installing the package
12+
13+
```bash
14+
spack install h5cpp-compiler
15+
```
16+
17+
## Notes
18+
19+
- The recipe depends on `llvm +clang` because h5cpp-compiler uses Clang LibTooling.
20+
- CMake 3.14+ and Ninja are required at build time.
21+
- Tests are disabled during the Spack build (`H5CPP_BUILD_TESTS=OFF`).
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
2+
# Spack Project Developers. See the top-level COPYRIGHT file for details.
3+
#
4+
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
5+
6+
from spack.package import *
7+
8+
9+
class H5cppCompiler(CMakePackage):
10+
"""h5cpp-compiler is a CLI build-time tool that uses LLVM/Clang LibTooling
11+
to generate HDF5 C++ bindings from annotated source code.
12+
"""
13+
14+
homepage = "https://github.com/vargalabs/h5cpp-compiler"
15+
git = "https://github.com/vargalabs/h5cpp-compiler.git"
16+
url = "https://github.com/vargalabs/h5cpp-compiler/archive/refs/tags/v1.12.6.tar.gz"
17+
18+
maintainers("steven-varga")
19+
20+
license("MIT", checked_by="steven-varga")
21+
22+
version("1.12.6", sha256="c5f5829cec4908ad93647c17f27d0a82b75a5413fcad8c99232ba2034d0149a2")
23+
version("1.12.5", sha256="f8990bcbfe90a037b66535c36d6e06e7451491c4cdc9c6fae4dfc15d1b3812be")
24+
version("1.12.4", sha256="77461c9a482c5460a246724a479c803b011a6f95b94801493816d2c3ca70c732")
25+
version("1.12.3", sha256="d7eefa490746b361e83df166f50ea9133919224e5e81f893ad4e41176d310371")
26+
27+
depends_on("cmake@3.14:", type="build")
28+
depends_on("ninja", type="build")
29+
30+
# The project targets LLVM 20 and requires the Clang component (LibTooling).
31+
# Spack's llvm package provides clang via the +clang variant.
32+
depends_on("llvm +clang")
33+
34+
def cmake_args(self):
35+
args = [
36+
self.define("H5CPP_BUILD_TESTS", "OFF"),
37+
]
38+
return args

spack/repo.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
repo:
2+
namespace: vargalabs

test_package/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
project(test_package LANGUAGES CXX)
3+
4+
find_package(H5CPPCompiler REQUIRED)
5+
6+
add_executable(example src/example.cpp)

0 commit comments

Comments
 (0)