Skip to content

Commit ee65163

Browse files
committed
Integrate CPack
1 parent 57e792f commit ee65163

2 files changed

Lines changed: 31 additions & 18 deletions

File tree

.github/workflows/test.yml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,20 @@ jobs:
7979
- name: Build (Release)
8080
run: cmake --build build/${{ matrix.preset }} --config Release
8181

82+
- name: Package
83+
working-directory: build/${{ matrix.preset }}
84+
run: cpack -C Release
85+
86+
- name: Upload package
87+
uses: actions/upload-artifact@v6
88+
with:
89+
name: package-${{ matrix.compiler }}
90+
path: |
91+
build/${{ matrix.preset }}/Eggs.Assert-*.tar.gz
92+
build/${{ matrix.preset }}/Eggs.Assert-*.zip
93+
if-no-files-found: error
94+
retention-days: 7
95+
8296
# -----------------------------------------------------------------------
8397
# Shared library build
8498
# -----------------------------------------------------------------------
@@ -140,27 +154,11 @@ jobs:
140154
--prefix ${{ runner.temp }}/eggs-assert-install-static
141155
--config Release
142156

143-
- name: Upload installed package (static)
144-
uses: actions/upload-artifact@v6
145-
with:
146-
name: installed-package-static-${{ matrix.compiler }}
147-
path: ${{ runner.temp }}/eggs-assert-install-static
148-
if-no-files-found: error
149-
retention-days: 7
150-
151157
- name: Test Install (shared)
152158
run: cmake --install build/${{ matrix.preset }}-shared
153159
--prefix ${{ runner.temp }}/eggs-assert-install-shared
154160
--config Release
155161

156-
- name: Upload installed package (shared)
157-
uses: actions/upload-artifact@v6
158-
with:
159-
name: installed-package-shared-${{ matrix.compiler }}
160-
path: ${{ runner.temp }}/eggs-assert-install-shared
161-
if-no-files-found: error
162-
retention-days: 7
163-
164162
- name: Clean Source and Build Tree
165163
run: cmake -E rm -rf ./include ./src ./build
166164

CMakeLists.txt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
cmake_minimum_required(VERSION 3.24)
99
project(
1010
Eggs.Assert
11+
VERSION 1.0.0
1112
DESCRIPTION "A C++23 assert library with stacktrace"
1213
LANGUAGES C CXX
1314
)
@@ -47,7 +48,10 @@ endif()
4748
# Internal name _eggs_assert; downstream CMake code uses the alias Eggs::Assert.
4849
#
4950
add_library(_eggs_assert src/assert.cpp)
50-
set_target_properties(_eggs_assert PROPERTIES EXPORT_NAME Assert)
51+
set_target_properties(
52+
_eggs_assert
53+
PROPERTIES EXPORT_NAME Assert OUTPUT_NAME eggs_assert
54+
)
5155
target_compile_features(_eggs_assert PUBLIC cxx_std_23)
5256

5357
include(GenerateExportHeader)
@@ -113,7 +117,7 @@ if(ENABLE_INSTALL)
113117

114118
write_basic_package_version_file(
115119
${CMAKE_CURRENT_BINARY_DIR}/eggs.assert-config-version.cmake
116-
VERSION 1.0.0
120+
VERSION ${PROJECT_VERSION}
117121
COMPATIBILITY SameMajorVersion
118122
)
119123

@@ -123,4 +127,15 @@ if(ENABLE_INSTALL)
123127
${CMAKE_CURRENT_BINARY_DIR}/eggs.assert-config-version.cmake
124128
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/eggs.assert
125129
)
130+
131+
set(CPACK_PACKAGE_NAME "Eggs.Assert")
132+
set(CPACK_PACKAGE_VENDOR "Agustin K-ballo Berge, Fusion Fenix")
133+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
134+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
135+
if(WIN32)
136+
set(CPACK_GENERATOR ZIP)
137+
else()
138+
set(CPACK_GENERATOR TGZ)
139+
endif()
140+
include(CPack)
126141
endif()

0 commit comments

Comments
 (0)