diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d51ed11..625c151 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,16 +42,26 @@ jobs: run: | VERSION=${GITHUB_REF#refs/tags/v} PKG_NAME="cddsctl-${VERSION}-linux-x86_64" + BIN=build/cli/cddsctl + # Split debug info: ship a stripped bin, keep symbols separately. + objcopy --only-keep-debug "$BIN" cddsctl.debug + objcopy --strip-debug --strip-unneeded "$BIN" + objcopy --add-gnu-debuglink=cddsctl.debug "$BIN" mkdir -p ${PKG_NAME}/bin - cp build/cli/cddsctl ${PKG_NAME}/bin/ + cp "$BIN" ${PKG_NAME}/bin/ tar -czvf ${PKG_NAME}.tar.gz ${PKG_NAME} + mkdir -p ${PKG_NAME}-debug + cp cddsctl.debug ${PKG_NAME}-debug/ + tar -czvf ${PKG_NAME}.debug.tar.gz ${PKG_NAME}-debug echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_ENV - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ${{ env.PKG_NAME }} - path: ${{ env.PKG_NAME }}.tar.gz + path: | + ${{ env.PKG_NAME }}.tar.gz + ${{ env.PKG_NAME }}.debug.tar.gz build-aarch64: name: Build Release (aarch64) @@ -86,16 +96,26 @@ jobs: run: | VERSION=${GITHUB_REF#refs/tags/v} PKG_NAME="cddsctl-${VERSION}-linux-aarch64" + BIN=build/cli/cddsctl + # Split debug info: ship a stripped bin, keep symbols separately. + objcopy --only-keep-debug "$BIN" cddsctl.debug + objcopy --strip-debug --strip-unneeded "$BIN" + objcopy --add-gnu-debuglink=cddsctl.debug "$BIN" mkdir -p ${PKG_NAME}/bin - cp build/cli/cddsctl ${PKG_NAME}/bin/ + cp "$BIN" ${PKG_NAME}/bin/ tar -czvf ${PKG_NAME}.tar.gz ${PKG_NAME} + mkdir -p ${PKG_NAME}-debug + cp cddsctl.debug ${PKG_NAME}-debug/ + tar -czvf ${PKG_NAME}.debug.tar.gz ${PKG_NAME}-debug echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_ENV - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ${{ env.PKG_NAME }} - path: ${{ env.PKG_NAME }}.tar.gz + path: | + ${{ env.PKG_NAME }}.tar.gz + ${{ env.PKG_NAME }}.debug.tar.gz release: name: Create Release @@ -158,7 +178,9 @@ jobs: - name: Create Release uses: softprops/action-gh-release@v2 with: - files: artifacts/*.tar.gz + files: | + artifacts/*.tar.gz + !artifacts/*.debug.tar.gz body_path: RELEASE_NOTES.md name: cddsctl ${{ github.ref_name }} env: diff --git a/.gitignore b/.gitignore index 64d1b00..1b26b35 100644 --- a/.gitignore +++ b/.gitignore @@ -43,9 +43,11 @@ # Build directory build/ -# 3rd_party generated directories +# 3rd_party generated directories (build trees + per-arch install prefixes) 3rd_party/yaml-cpp/ +3rd_party/yaml-cpp-*/ 3rd_party/iceoryx/ +3rd_party/iceoryx-*/ 3rd_party/cyclonedds-*/ 3rd_party/build/ diff --git a/CMakeLists.txt b/CMakeLists.txt index b4d6b1c..869b27e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,16 @@ message(STATUS "Target architecture: ${TARGET_ARCH_NAME}") # Debug symbols for all build types add_compile_options(-g) +# Let the linker drop unreferenced code from the statically-linked DDS stack +# (iceoryx/CycloneDDS), of which cddsctl uses only a fraction. +add_compile_options(-ffunction-sections -fdata-sections) +add_link_options(-Wl,--gc-sections) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() +add_compile_options($<$:-Os>) + # Use GNUInstallDirs for standard install paths include(GNUInstallDirs)