Skip to content

Commit 7190d27

Browse files
committed
[#19]:svarga:fix, macOS productbuild empty package by using explicit CPack component
1 parent 84a8ddd commit 7190d27

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

.github/workflows/package.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Package
33
on:
44
push:
55
tags: ['v*']
6+
branches: ['19-fix-macos-productbuild']
67

78
permissions:
89
contents: write
@@ -213,6 +214,15 @@ jobs:
213214
cpack -G "${{ matrix.generators }}" \
214215
-D "CPACK_PACKAGE_FILE_NAME=h5cpp-compiler-${H5CPP_VERSION}-${{ matrix.asset_suffix }}" \
215216
--config CPackConfig.cmake
217+
# macOS guard: productbuild must produce a real payload
218+
if [[ "${{ matrix.generators }}" == "productbuild" ]]; then
219+
pkg="h5cpp-compiler-${H5CPP_VERSION}-${{ matrix.asset_suffix }}.pkg"
220+
size=$(stat -f%z "$pkg" 2>/dev/null || stat -c%s "$pkg" 2>/dev/null)
221+
if (( size < 100000 )); then
222+
echo "macOS package is suspiciously small (${size} bytes) — likely empty" >&2
223+
exit 1
224+
fi
225+
fi
216226
env:
217227
CPACK_DEBIAN_PACKAGE_ARCHITECTURE: ${{ matrix.deb_arch }}
218228
CPACK_RPM_PACKAGE_ARCHITECTURE: ${{ matrix.rpm_arch }}

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()

0 commit comments

Comments
 (0)