From e4a11555177d8c4dbfef8fd749623d14a5edb2ca Mon Sep 17 00:00:00 2001 From: MichalPelka Date: Thu, 29 Oct 2026 00:13:13 +0100 Subject: [PATCH] Fix Debian package and attach it to releases The DEB was not installable: its Version field was ".." (undefined HDMAPPING_VERSION_* variables), it depended on -dev packages instead of runtime libraries, it linked the bundled libtbb.so.12 without shipping or depending on it, and it packaged headers/static libs/CMake configs of bundled third-party subprojects (eigen, glew, raylib), clashing with libeigen3-dev and libglew-dev. - Use PROJECT_VERSION for the package version. - Let dpkg-shlibdeps derive runtime dependencies. - Install apps into an "applications" component and package only it. - Build the DEB against system oneTBB. - Attach the .deb to published GitHub releases again. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0158FTTCgGdHGX1Qp1qEFyXb --- .github/workflows/cmake-linux-deb.yml | 12 +++++++++++- CMakeLists.txt | 9 +++++++-- cmake/install_app.cmake | 9 ++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake-linux-deb.yml b/.github/workflows/cmake-linux-deb.yml index b9025b29c..6f4cd2d84 100644 --- a/.github/workflows/cmake-linux-deb.yml +++ b/.github/workflows/cmake-linux-deb.yml @@ -7,6 +7,8 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + release: + types: [ published ] env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) @@ -18,6 +20,8 @@ jobs: # You can convert this to a matrix build if you need cross-platform coverage. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix runs-on: ubuntu-24.04 + permissions: + contents: write steps: - name: Load repository cache @@ -42,7 +46,7 @@ jobs: - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_WITH_UTILITY_APPLICATION=ON -DBUILD_WITH_BUNDLED_FREEGLUT=0 -DBUILD_WITH_BUNDLED_EIGEN=0 -DBUILD_WITH_BUNDLED_LIBLASZIP=0 -DBUILD_TESTING=ON -DCPACK_PACKAGE_FILE_NAME=hd_mapping-${{env.VERSION}}-amd64 + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_WITH_UTILITY_APPLICATION=ON -DBUILD_WITH_BUNDLED_FREEGLUT=0 -DBUILD_WITH_BUNDLED_EIGEN=0 -DBUILD_WITH_BUNDLED_LIBLASZIP=0 -DBUILD_WITH_BUNDLED_ONETBB=0 -DBUILD_TESTING=ON -DCPACK_PACKAGE_FILE_NAME=hd_mapping-${{env.VERSION}}-amd64 - name: Build # Build your program with the given configuration @@ -59,3 +63,9 @@ jobs: with: name: hd_mapping-deb-${{env.VERSION}} path: ${{github.workspace}}/build/*.deb + + - name: Attach to GitHub release + if: github.event_name == 'release' + uses: softprops/action-gh-release@v2 + with: + files: ${{github.workspace}}/build/*.deb diff --git a/CMakeLists.txt b/CMakeLists.txt index 04ee15eb0..2ed22b08e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,12 +198,17 @@ disable_target_warnings(Fusion) # CPack configuration set(CPACK_PACKAGE_NAME "hd_mapping") -set(CPACK_PACKAGE_VERSION "${HDMAPPING_VERSION_MAJOR}.${HDMAPPING_VERSION_MINOR}.${HDMAPPING_VERSION_PATCH}") +set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") +# Package only the applications, not the headers, static libs and CMake configs +# that bundled third-party subprojects (eigen, glew, raylib, ...) install. +set(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};${PROJECT_NAME};${HDMAPPING_INSTALL_COMPONENT};/") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "HD Mapping debian package for Mandeye") set(CPACK_PACKAGE_CONTACT "januszbedkowski@gmail.com") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Janusz Bedkowski ") -set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.28), libstdc++6 (>= 8.3.0), freeglut3-dev, libeigen3-dev, liblaszip-dev") +# Derive runtime dependencies (libglut, liblaszip, libtbb, libopencv-*, ...) +# from the packaged binaries instead of listing them by hand. +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) if(WIN32) set(CPACK_GENERATOR "ZIP") else() diff --git a/cmake/install_app.cmake b/cmake/install_app.cmake index e1925f80d..ac50092fc 100644 --- a/cmake/install_app.cmake +++ b/cmake/install_app.cmake @@ -6,6 +6,9 @@ include_guard() set(HDMAPPING_BINARY_PREFIX "hdmapping-" CACHE STRING "Prefix applied to installed executable names") +# Install component holding the applications; CPack packages only this one. +set(HDMAPPING_INSTALL_COMPONENT "applications") + # hdmapping_install_app(...) # # Installs each target into /bin as "${HDMAPPING_BINARY_PREFIX}", @@ -18,7 +21,7 @@ set(HDMAPPING_BINARY_PREFIX "hdmapping-" CACHE STRING # binary verbatim, so the installed executable keeps the build-tree RUNPATH # (build/3rdparty/LASzip/lib) instead of having it stripped, and would resolve # the bundled liblaszip.so from the build directory rather than the system -# liblaszip that CPACK_DEBIAN_PACKAGE_DEPENDS declares. So install(TARGETS) +# liblaszip the DEB depends on. So install(TARGETS) # stays responsible for the copy (and its RPATH rewriting), and the file is # renamed immediately afterwards by an install-time script. # @@ -32,7 +35,7 @@ function(hdmapping_install_app) message(FATAL_ERROR "hdmapping_install_app: no such target '${target_name}'") endif() - install(TARGETS ${target_name} RUNTIME DESTINATION bin) + install(TARGETS ${target_name} RUNTIME DESTINATION bin COMPONENT ${HDMAPPING_INSTALL_COMPONENT}) # Declared after the install(TARGETS) above and in the same directory, # so it runs after it. @@ -45,6 +48,6 @@ function(hdmapping_install_app) file(RENAME \"\${_hdmapping_plain}\" \"\${_hdmapping_prefixed}\") message(STATUS \"Installing: \${_hdmapping_prefixed}\") endif() - ") + " COMPONENT ${HDMAPPING_INSTALL_COMPONENT}) endforeach() endfunction()