Skip to content

Commit 9e28acd

Browse files
Copilotwysaid
andauthored
When releasing, add the shared library version (#16)
* When releasing, add the shared library version. * Initial plan * Initial analysis: understand current release workflow Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> * Add dynamic library packages to release workflow Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> * Complete release workflow optimization - add dynamic library packages Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> * update * update * better naming --------- Co-authored-by: wy <this@wysaid.org> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com>
1 parent 697a21a commit 9e28acd

1 file changed

Lines changed: 126 additions & 40 deletions

File tree

.github/workflows/release.yml

Lines changed: 126 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -113,26 +113,57 @@ jobs:
113113
fail-fast: false
114114
matrix:
115115
include:
116+
# Static library builds (updated naming)
116117
- os: macos-latest
117-
name: macOS
118-
artifact_name: ccap-macos-universal
118+
name: macOS Static
119+
artifact_name: ccap-macos-universal-static
119120
build_type: Release
121+
shared: false
120122

121123
- os: windows-latest
122-
name: Windows
123-
artifact_name: ccap-msvc-x86_64
124+
name: Windows Static
125+
artifact_name: ccap-msvc-x86_64-static
124126
build_type: Release
127+
shared: false
125128

126129
- os: ubuntu-latest
127-
name: Linux
128-
artifact_name: ccap-linux-x86_64
130+
name: Linux Static
131+
artifact_name: ccap-linux-x86_64-static
129132
build_type: Release
133+
shared: false
130134

131135
- os: ubuntu-latest
132-
name: Linux ARM64
133-
artifact_name: ccap-linux-arm64
136+
name: Linux ARM64 Static
137+
artifact_name: ccap-linux-arm64-static
134138
build_type: Release
135139
arch: arm64
140+
shared: false
141+
142+
# Shared library builds (updated naming)
143+
- os: macos-latest
144+
name: macOS Shared
145+
artifact_name: ccap-macos-universal-shared
146+
build_type: Release
147+
shared: true
148+
149+
- os: windows-latest
150+
name: Windows Shared
151+
artifact_name: ccap-msvc-x86_64-shared
152+
build_type: Release
153+
shared: true
154+
155+
- os: ubuntu-latest
156+
name: Linux Shared
157+
artifact_name: ccap-linux-x86_64-shared
158+
build_type: Release
159+
shared: true
160+
161+
- os: ubuntu-latest
162+
name: Linux ARM64 Shared
163+
artifact_name: ccap-linux-arm64-shared
164+
build_type: Release
165+
arch: arm64
166+
shared: true
136167

137168
runs-on: ${{ matrix.os }}
138169

@@ -154,9 +185,17 @@ jobs:
154185
- name: Configure CMake
155186
shell: bash
156187
run: |
188+
# Set shared library flag based on matrix configuration
189+
SHARED_FLAG=""
190+
if [ "${{ matrix.shared }}" = "true" ]; then
191+
SHARED_FLAG="-DCCAP_BUILD_SHARED=ON"
192+
else
193+
SHARED_FLAG="-DCCAP_BUILD_SHARED=OFF"
194+
fi
195+
157196
if [ "${{ matrix.os }}" = "windows-latest" ]; then
158197
# Windows: Use multi-config generator (Visual Studio)
159-
cmake -B build -G "Visual Studio 17 2022" -A x64 -DCCAP_BUILD_EXAMPLES=ON -DCCAP_BUILD_TESTS=OFF
198+
cmake -B build -G "Visual Studio 17 2022" -A x64 -DCCAP_BUILD_EXAMPLES=ON -DCCAP_BUILD_TESTS=OFF $SHARED_FLAG
160199
elif [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
161200
# Linux: Use single-config generator
162201
if [ "${{ matrix.arch }}" = "arm64" ]; then
@@ -166,14 +205,14 @@ jobs:
166205
-DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
167206
-DCMAKE_SYSTEM_NAME=Linux \
168207
-DCMAKE_SYSTEM_PROCESSOR=aarch64 \
169-
-DCCAP_BUILD_EXAMPLES=ON -DCCAP_BUILD_TESTS=OFF
208+
-DCCAP_BUILD_EXAMPLES=ON -DCCAP_BUILD_TESTS=OFF $SHARED_FLAG
170209
else
171210
# Regular Linux x86_64
172-
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCCAP_BUILD_EXAMPLES=ON -DCCAP_BUILD_TESTS=OFF
211+
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCCAP_BUILD_EXAMPLES=ON -DCCAP_BUILD_TESTS=OFF $SHARED_FLAG
173212
fi
174213
else
175214
# macOS: Use single-config generator with universal binary
176-
cmake -B build -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCCAP_BUILD_EXAMPLES=ON -DCCAP_BUILD_TESTS=OFF
215+
cmake -B build -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCCAP_BUILD_EXAMPLES=ON -DCCAP_BUILD_TESTS=OFF $SHARED_FLAG
177216
fi
178217
179218
- name: Build project
@@ -215,9 +254,14 @@ jobs:
215254
# Copy Release version library files, keeping ccap.lib name
216255
cp build/Release/ccap.lib package/lib/ccap.lib || echo "Release static library not found"
217256
218-
# Copy dynamic libraries (if exist)
219-
cp build/Debug/ccapd.dll package/lib/ccapd.dll || echo "Debug dynamic library not found"
220-
cp build/Release/ccap.dll package/lib/ccap.dll || echo "Release dynamic library not found"
257+
# Copy shared libraries (if shared build)
258+
if [ "${{ matrix.shared }}" = "true" ]; then
259+
cp build/Debug/ccapd.dll package/lib/ccapd.dll || echo "Debug shared library not found"
260+
cp build/Release/ccap.dll package/lib/ccap.dll || echo "Release shared library not found"
261+
# Also copy import libraries for DLLs
262+
cp build/Debug/ccapd.lib package/lib/ccapd_import.lib || echo "Debug import library not found"
263+
cp build/Release/ccap.lib package/lib/ccap_import.lib || echo "Release import library not found"
264+
fi
221265
222266
# Copy example programs (both versions in examples directory)
223267
mkdir -p package/examples/Debug
@@ -229,11 +273,13 @@ jobs:
229273
if: matrix.os == 'macos-latest'
230274
shell: bash
231275
run: |
232-
# Copy static library
233-
cp build/libccap.a package/lib/ || echo "Static library not found"
234-
235-
# Copy dynamic library (if exists)
236-
cp build/libccap.dylib package/lib/ || echo "Dynamic library not found"
276+
if [ "${{ matrix.shared }}" = "true" ]; then
277+
# Copy shared library
278+
cp build/libccap.dylib package/lib/ || echo "Shared library not found"
279+
else
280+
# Copy static library
281+
cp build/libccap.a package/lib/ || echo "Static library not found"
282+
fi
237283
238284
# Copy example programs
239285
find build -name "*-print_camera" -exec cp {} package/examples/ \; || echo "Examples not found"
@@ -246,11 +292,13 @@ jobs:
246292
if: matrix.os == 'ubuntu-latest' && matrix.arch != 'arm64'
247293
shell: bash
248294
run: |
249-
# Copy static library
250-
cp build/libccap.a package/lib/ || echo "Static library not found"
251-
252-
# Copy dynamic library (if exists)
253-
cp build/libccap.so package/lib/ || echo "Dynamic library not found"
295+
if [ "${{ matrix.shared }}" = "true" ]; then
296+
# Copy shared library
297+
cp build/libccap.so package/lib/ || echo "Shared library not found"
298+
else
299+
# Copy static library
300+
cp build/libccap.a package/lib/ || echo "Static library not found"
301+
fi
254302
255303
# Copy example programs
256304
find build -name "0-print_camera" -exec cp {} package/examples/ \; || echo "Examples not found"
@@ -263,11 +311,13 @@ jobs:
263311
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'arm64'
264312
shell: bash
265313
run: |
266-
# Copy static library
267-
cp build/libccap.a package/lib/ || echo "Static library not found"
268-
269-
# Copy dynamic library (if exists)
270-
cp build/libccap.so package/lib/ || echo "Dynamic library not found"
314+
if [ "${{ matrix.shared }}" = "true" ]; then
315+
# Copy shared library
316+
cp build/libccap.so package/lib/ || echo "Shared library not found"
317+
else
318+
# Copy static library
319+
cp build/libccap.a package/lib/ || echo "Static library not found"
320+
fi
271321
272322
# Copy example programs (ARM64 cross-compiled)
273323
find build -name "0-print_camera" -exec cp {} package/examples/ \; || echo "Examples not found"
@@ -396,19 +446,35 @@ jobs:
396446
397447
### 📦 Downloads
398448
399-
**Supported Platforms:**
400-
- **macOS** (Universal Binary - supports Intel & Apple Silicon): `ccap-macos-universal.tar.gz`
401-
- **Windows** (MSVC x64 - includes Debug and Release versions): `ccap-msvc-x86_64.zip`
402-
- **Linux x86_64** (compatible with most distributions): `ccap-linux-x86_64.tar.gz`
403-
- **Linux ARM64** (compatible with Raspberry Pi, ARM servers, and other ARM64 boards): `ccap-linux-arm64.tar.gz`
449+
**Static Library Packages (for static linking):**
450+
- **macOS** (Universal Binary - supports Intel & Apple Silicon): `ccap-macos-universal-static.tar.gz`
451+
- **Windows** (MSVC x64 - includes Debug and Release versions): `ccap-msvc-x86_64-static.zip`
452+
- **Linux x86_64** (compatible with most distributions): `ccap-linux-x86_64-static.tar.gz`
453+
- **Linux ARM64** (compatible with Raspberry Pi, ARM servers, and other ARM64 boards): `ccap-linux-arm64-static.tar.gz`
454+
455+
**Shared Library Packages (for dynamic linking):**
456+
- **macOS** (Universal Binary - supports Intel & Apple Silicon): `ccap-macos-universal-shared.tar.gz`
457+
- **Windows** (MSVC x64 - includes Debug and Release versions): `ccap-msvc-x86_64-shared.zip`
458+
- **Linux x86_64** (compatible with most distributions): `ccap-linux-x86_64-shared.tar.gz`
459+
- **Linux ARM64** (compatible with Raspberry Pi, ARM servers, and other ARM64 boards): `ccap-linux-arm64-shared.tar.gz`
404460
405461
### 📁 Package Contents
406462
463+
**Static Library Packages:**
407464
- **Library Files**: Static library files for linking
408465
- Windows: `lib/ccap.lib` (Release version) and `lib/ccapd.lib` (Debug version)
409466
- macOS: `lib/libccap.a` (Universal Binary)
410467
- Linux x86_64: `lib/libccap.a` (x86_64)
411468
- Linux ARM64: `lib/libccap.a` (ARM64)
469+
470+
**Shared Library Packages:**
471+
- **Library Files**: Shared library files for runtime linking
472+
- Windows: `lib/ccap.dll` + `lib/ccap_import.lib` (Release), `lib/ccapd.dll` + `lib/ccapd_import.lib` (Debug)
473+
- macOS: `lib/libccap.dylib` (Universal Binary)
474+
- Linux x86_64: `lib/libccap.so` (x86_64)
475+
- Linux ARM64: `lib/libccap.so` (ARM64)
476+
477+
**All Packages Include:**
412478
- **Header Files**: Complete C++ API header files
413479
- **Example Programs**: 5 complete usage examples
414480
- Windows: `examples/Release/` and `examples/Debug/` directories contain corresponding versions
@@ -421,7 +487,8 @@ jobs:
421487
422488
### 🔧 Usage
423489
424-
1. Download the appropriate platform package
490+
**For Static Linking:**
491+
1. Download the appropriate static library package
425492
2. Extract to your project directory
426493
3. Add the `include` directory to your compiler's include path
427494
4. Link the corresponding library file:
@@ -432,6 +499,18 @@ jobs:
432499
- **Linux ARM64**: Link `lib/libccap.a`
433500
5. Refer to example code in the `examples` directory
434501
502+
**For Shared Linking:**
503+
1. Download the appropriate shared library package
504+
2. Extract to your project directory
505+
3. Add the `include` directory to your compiler's include path
506+
4. Link and configure runtime libraries:
507+
- **Windows Debug**: Link `lib/ccapd_import.lib`, ensure `lib/ccapd.dll` is in PATH or app directory
508+
- **Windows Release**: Link `lib/ccap_import.lib`, ensure `lib/ccap.dll` is in PATH or app directory
509+
- **macOS**: Link `lib/libccap.dylib`, ensure dylib is in DYLD_LIBRARY_PATH or install location
510+
- **Linux x86_64**: Link `lib/libccap.so`, ensure so is in LD_LIBRARY_PATH or install location
511+
- **Linux ARM64**: Link `lib/libccap.so`, ensure so is in LD_LIBRARY_PATH or install location
512+
5. Refer to example code in the `examples` directory
513+
435514
### 📋 System Requirements
436515
437516
- **macOS**: 10.13 or higher
@@ -479,9 +558,16 @@ jobs:
479558
echo "> 🛡️ **This release was only created after ALL tests passed successfully!**" >> $GITHUB_STEP_SUMMARY
480559
echo "" >> $GITHUB_STEP_SUMMARY
481560
echo "### 📦 Included Files:" >> $GITHUB_STEP_SUMMARY
482-
echo "- ccap-macos-universal.tar.gz" >> $GITHUB_STEP_SUMMARY
483-
echo "- ccap-msvc-x86_64.zip (includes Debug and Release versions)" >> $GITHUB_STEP_SUMMARY
484-
echo "- ccap-linux-x86_64.tar.gz" >> $GITHUB_STEP_SUMMARY
485-
echo "- ccap-linux-arm64.tar.gz" >> $GITHUB_STEP_SUMMARY
561+
echo "**Static Library Packages:**" >> $GITHUB_STEP_SUMMARY
562+
echo "- ccap-macos-universal-static.tar.gz" >> $GITHUB_STEP_SUMMARY
563+
echo "- ccap-msvc-x86_64-static.zip (includes Debug and Release versions)" >> $GITHUB_STEP_SUMMARY
564+
echo "- ccap-linux-x86_64-static.tar.gz" >> $GITHUB_STEP_SUMMARY
565+
echo "- ccap-linux-arm64-static.tar.gz" >> $GITHUB_STEP_SUMMARY
566+
echo "" >> $GITHUB_STEP_SUMMARY
567+
echo "**Shared Library Packages:**" >> $GITHUB_STEP_SUMMARY
568+
echo "- ccap-macos-universal-shared.tar.gz" >> $GITHUB_STEP_SUMMARY
569+
echo "- ccap-msvc-x86_64-shared.zip (includes Debug and Release versions)" >> $GITHUB_STEP_SUMMARY
570+
echo "- ccap-linux-x86_64-shared.tar.gz" >> $GITHUB_STEP_SUMMARY
571+
echo "- ccap-linux-arm64-shared.tar.gz" >> $GITHUB_STEP_SUMMARY
486572
echo "" >> $GITHUB_STEP_SUMMARY
487573
echo "Release page: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.release_type.outputs.tag_name }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)