-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc: move to sigrok version of libserialport
- Loading branch information
Showing
37 changed files
with
805 additions
and
408 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
name: libzedmd | ||
on: | ||
push: | ||
|
||
pull_request: | ||
|
||
defaults: | ||
|
@@ -15,7 +14,7 @@ jobs: | |
outputs: | ||
tag: ${{ steps.version.outputs.tag }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- id: version | ||
|
@@ -28,104 +27,176 @@ jobs: | |
echo "tag=${TAG}" >> $GITHUB_OUTPUT | ||
build: | ||
name: Build libzedmd-${{ matrix.platform }} | ||
name: Build libzedmd-${{ matrix.platform }}-${{ matrix.arch }} | ||
runs-on: ${{ matrix.os }} | ||
needs: [ version ] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: windows-latest | ||
platform: win-x64 | ||
platform-name: x64 | ||
platform: win | ||
arch: x64 | ||
- os: windows-latest | ||
platform: win-x86 | ||
platform-name: Win32 | ||
- os: macos-latest | ||
platform: macOS-x64 | ||
- os: macos-latest | ||
platform: macOS-arm64 | ||
platform: win | ||
arch: x86 | ||
- os: macos-latest | ||
platform: ios-arm64 | ||
platform: macos | ||
arch: arm64 | ||
- os: macos-latest | ||
platform: tvos-arm64 | ||
platform: macos | ||
arch: x64 | ||
- os: ubuntu-latest | ||
platform: linux-x64 | ||
platform: linux | ||
arch: x64 | ||
- os: ubuntu-latest | ||
platform: android-arm64-v8a | ||
platform: linux | ||
arch: aarch64 | ||
- os: ubuntu-latest | ||
platform: android | ||
arch: arm64-v8a | ||
- os: macos-latest | ||
platform: ios | ||
arch: arm64 | ||
- os: macos-latest | ||
platform: tvos | ||
arch: arm64 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Checkout libserialport | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: PPUC/libserialport | ||
path: libserialport | ||
- run: mv libserialport ../libserialport | ||
- name: Build libzedmd-${{ matrix.platform }} | ||
- uses: actions/checkout@v4 | ||
- if: (matrix.platform == 'win') | ||
name: Add msbuild to path (win runner) | ||
uses: microsoft/[email protected] | ||
- if: (matrix.platform == 'macos') | ||
name: Add autoconf and automake (mac runner) | ||
run: | | ||
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | ||
if [[ "${{ matrix.platform-name }}" == "Win32" ]]; then | ||
cmake -G "Visual Studio 17 2022" -A ${{ matrix.platform-name }} -B build -DUSE_WIN32=ON | ||
else | ||
cmake -G "Visual Studio 17 2022" -A ${{ matrix.platform-name }} -B build | ||
fi | ||
cmake --build build --config Release | ||
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then | ||
if [[ "${{ matrix.platform }}" == "macOS-arm64" ]]; then | ||
cmake -DCMAKE_BUILD_TYPE=Release -B build/Release -DUSE_OSXARM=ON | ||
elif [[ "${{ matrix.platform }}" == "macOS-x64" ]]; then | ||
cmake -DCMAKE_BUILD_TYPE=Release -B build/Release -DUSE_OSXINTEL=ON | ||
elif [[ "${{ matrix.platform }}" == "ios-arm64" ]]; then | ||
cmake -DCMAKE_BUILD_TYPE=Release -B build/Release -DUSE_IOS=ON | ||
elif [[ "${{ matrix.platform }}" == "tvos-arm64" ]]; then | ||
cmake -DCMAKE_BUILD_TYPE=Release -B build/Release -DUSE_TVOS=ON | ||
fi | ||
cmake --build build/Release | ||
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then | ||
if [[ "${{ matrix.platform }}" == "android-arm64-v8a" ]]; then | ||
cmake -DCMAKE_BUILD_TYPE=Release -B build/Release -DUSE_ANDROID=ON | ||
else | ||
cmake -DCMAKE_BUILD_TYPE=Release -B build/Release | ||
fi | ||
cmake --build build/Release | ||
brew install autoconf automake | ||
- if: (!(matrix.platform == 'linux' && matrix.arch == 'aarch64')) | ||
name: Build libzedmd-${{ matrix.platform }}-${{ matrix.arch }} | ||
run: | | ||
./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh | ||
if [[ "${{ matrix.platform }}" == "win" ]]; then | ||
if [[ "${{ matrix.arch }}" == "x86" ]]; then | ||
cmake -G "Visual Studio 17 2022" -A Win32 -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build | ||
else | ||
cmake -G "Visual Studio 17 2022" -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build | ||
fi | ||
cmake --build build --config Release | ||
else | ||
if [[ "$(uname)" == "Darwin" ]]; then | ||
NUM_PROCS=$(sysctl -n hw.ncpu) | ||
else | ||
NUM_PROCS=$(nproc) | ||
fi | ||
cmake -DCMAKE_BUILD_TYPE=Release -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build | ||
cmake --build build -- -j${NUM_PROCS} | ||
fi | ||
- run: | | ||
- if: (matrix.platform == 'linux' && matrix.arch == 'aarch64') | ||
name: Build libzedmd-${{ matrix.platform }}-${{ matrix.arch }} (arm runner) | ||
uses: pguyot/arm-runner-action@v2 | ||
with: | ||
base_image: raspios_lite_arm64:latest | ||
image_additional_mb: 4096 | ||
cpu: cortex-a53 | ||
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64 | ||
bind_mount_repository: true | ||
commands: | | ||
apt-get update -y --allow-releaseinfo-change | ||
apt-get install --no-install-recommends -y pkg-config cmake autoconf automake libtool | ||
./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh | ||
NUM_PROCS=$(nproc) | ||
cmake -DCMAKE_BUILD_TYPE=Release -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build | ||
cmake --build build -- -j${NUM_PROCS} | ||
- name: Prepare artifacts | ||
id: artifacts | ||
run: | | ||
mkdir tmp | ||
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | ||
cp build/Release/zedmd* tmp | ||
if [[ "${{ matrix.platform }}" == "win" ]]; then | ||
ARTIFACT_PATH="tmp" | ||
if [[ "${{ matrix.arch }}" == "x86" ]]; then | ||
cp build/Release/zedmd.lib tmp | ||
cp build/Release/zedmd.dll tmp | ||
else | ||
cp build/Release/zedmd64.lib tmp | ||
cp build/Release/zedmd64.dll tmp | ||
fi | ||
cp build/Release/zedmd_static.lib tmp | ||
cp build/Release/libserialport.lib tmp | ||
cp build/Release/libserialport.dll tmp | ||
cp build/Release/zedmd_test_s.exe tmp | ||
cp build/Release/zedmd_test.exe tmp | ||
else | ||
cp build/Release/libzedmd* tmp | ||
ARTIFACT_PATH="libzedmd-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz" | ||
if [[ "${{ matrix.platform }}" == "macos" ]]; then | ||
cp build/libzedmd.a tmp | ||
cp build/libzedmd.*.dylib tmp | ||
cp build/libserialport.dylib tmp | ||
cp build/zedmd_test_s tmp | ||
cp build/zedmd_test tmp | ||
elif [[ "${{ matrix.platform }}" == "linux" ]]; then | ||
cp build/libzedmd.a tmp | ||
cp build/libzedmd.so.* tmp | ||
cp build/libserialport.so.* tmp | ||
cp build/zedmd_test_s tmp | ||
cp build/zedmd_test tmp | ||
elif [[ "${{ matrix.platform }}" == "ios" || "${{ matrix.platform }}" == "tvos" ]]; then | ||
cp build/libzedmd.a tmp | ||
cp build/libzedmd.*.dylib tmp | ||
elif [[ "${{ matrix.platform }}" == "android" ]]; then | ||
cp build/libzedmd.a tmp | ||
cp build/libzedmd.so tmp | ||
fi | ||
cd tmp | ||
tar -czvf ../${ARTIFACT_PATH} * | ||
fi | ||
- uses: actions/upload-artifact@v3 | ||
echo "artifact_path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: libzedmd-${{ needs.version.outputs.tag }}-${{ matrix.platform }} | ||
path: tmp | ||
name: libzedmd-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }} | ||
path: ${{ steps.artifacts.outputs.artifact_path }} | ||
|
||
post-build: | ||
runs-on: macos-latest | ||
needs: [ version, build ] | ||
name: Build libzedmd-macOS | ||
name: Build libzedmd-macos | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
- run: | | ||
mkdir libzedmd-${{ needs.version.outputs.tag }}-macOS | ||
lipo -create -output libzedmd-${{ needs.version.outputs.tag }}-macOS/libzedmd.dylib \ | ||
libzedmd-${{ needs.version.outputs.tag }}-macOS-x64/libzedmd.dylib \ | ||
libzedmd-${{ needs.version.outputs.tag }}-macOS-arm64/libzedmd.dylib | ||
- uses: actions/upload-artifact@v3 | ||
- name: Unpack artifacts | ||
run: | | ||
cd libzedmd-${{ needs.version.outputs.tag }}-macos-x64 | ||
tar -xzvf libzedmd-${{ needs.version.outputs.tag }}-macos-x64.tar.gz | ||
cd .. | ||
cd libzedmd-${{ needs.version.outputs.tag }}-macos-arm64 | ||
tar -xzvf libzedmd-${{ needs.version.outputs.tag }}-macos-arm64.tar.gz | ||
- name: Combine macos architectures | ||
run: | | ||
mkdir tmp | ||
lipo -create -output tmp/libzedmd-${{ needs.version.outputs.tag }}.dylib \ | ||
libzedmd-${{ needs.version.outputs.tag }}-macos-arm64/libzedmd.${{ needs.version.outputs.tag }}.dylib \ | ||
libzedmd-${{ needs.version.outputs.tag }}-macos-x64/libzedmd.${{ needs.version.outputs.tag }}.dylib | ||
lipo -create -output tmp/libserialport.dylib \ | ||
libzedmd-${{ needs.version.outputs.tag }}-macos-arm64/libserialport.dylib \ | ||
libzedmd-${{ needs.version.outputs.tag }}-macos-x64/libserialport.dylib | ||
lipo -create -output tmp/zedmd_test \ | ||
libzedmd-${{ needs.version.outputs.tag }}-macos-arm64/zedmd_test \ | ||
libzedmd-${{ needs.version.outputs.tag }}-macos-x64/zedmd_test | ||
lipo -create -output tmp/zedmd_test_s \ | ||
libzedmd-${{ needs.version.outputs.tag }}-macos-arm64/zedmd_test_s \ | ||
libzedmd-${{ needs.version.outputs.tag }}-macos-x64/zedmd_test_s | ||
- name: Prepare artifacts | ||
run: | | ||
cd tmp | ||
tar -czvf ../libzedmd-${{ needs.version.outputs.tag }}-macos.tar.gz * | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: libzedmd-${{ needs.version.outputs.tag }}-macOS | ||
path: libzedmd-${{ needs.version.outputs.tag }}-macOS | ||
name: libzedmd-${{ needs.version.outputs.tag }}-macos | ||
path: libzedmd-${{ needs.version.outputs.tag }}-macos.tar.gz | ||
- name: Package | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
zip -r libzedmd-${{ needs.version.outputs.tag }}-win-x64.zip libzedmd-${{ needs.version.outputs.tag }}-win-x64 | ||
zip -r libzedmd-${{ needs.version.outputs.tag }}-win-x86.zip libzedmd-${{ needs.version.outputs.tag }}-win-x86 | ||
zip -r libzedmd-${{ needs.version.outputs.tag }}-ios-arm64.zip libzedmd-${{ needs.version.outputs.tag }}-ios-arm64 | ||
zip -r libzedmd-${{ needs.version.outputs.tag }}-tvos-arm64.zip libzedmd-${{ needs.version.outputs.tag }}-tvos-arm64 | ||
zip -r libzedmd-${{ needs.version.outputs.tag }}-linux-x64.zip libzedmd-${{ needs.version.outputs.tag }}-linux-x64 | ||
zip -r libzedmd-${{ needs.version.outputs.tag }}-android-arm64-v8a.zip libzedmd-${{ needs.version.outputs.tag }}-android-arm64-v8a | ||
zip -r libzedmd-${{ needs.version.outputs.tag }}-macOS.zip libzedmd-${{ needs.version.outputs.tag }}-macOS | ||
zip -r libzedmd-${{ needs.version.outputs.tag }}-win-x86.zip libzedmd-${{ needs.version.outputs.tag }}-win-x86 | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
@@ -134,8 +205,11 @@ jobs: | |
files: | | ||
libzedmd-${{ needs.version.outputs.tag }}-win-x64.zip | ||
libzedmd-${{ needs.version.outputs.tag }}-win-x86.zip | ||
libzedmd-${{ needs.version.outputs.tag }}-ios-arm64.zip | ||
libzedmd-${{ needs.version.outputs.tag }}-tvos-arm64.zip | ||
libzedmd-${{ needs.version.outputs.tag }}-linux-x64.zip | ||
libzedmd-${{ needs.version.outputs.tag }}-android-arm64-v8a.zip | ||
libzedmd-${{ needs.version.outputs.tag }}-macOS.zip | ||
libzedmd-${{ needs.version.outputs.tag }}-macos-arm64/libzedmd-${{ needs.version.outputs.tag }}-macos-arm64.tar.gz | ||
libzedmd-${{ needs.version.outputs.tag }}-macos-x64/libzedmd-${{ needs.version.outputs.tag }}-macos-x64.tar.gz | ||
libzedmd-${{ needs.version.outputs.tag }}-macos.tar.gz | ||
libzedmd-${{ needs.version.outputs.tag }}-linux-x64/libzedmd-${{ needs.version.outputs.tag }}-linux-x64.tar.gz | ||
libzedmd-${{ needs.version.outputs.tag }}-linux-aarch64/libzedmd-${{ needs.version.outputs.tag }}-linux-aarch64.tar.gz | ||
libzedmd-${{ needs.version.outputs.tag }}-ios-arm64/libzedmd-${{ needs.version.outputs.tag }}-ios-arm64.tar.gz | ||
libzedmd-${{ needs.version.outputs.tag }}-tvos-arm64/libzedmd-${{ needs.version.outputs.tag }}-tvos-arm64.tar.gz | ||
libzedmd-${{ needs.version.outputs.tag }}-android-arm64-v8a/libzedmd-${{ needs.version.outputs.tag }}-android-arm64-v8a.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.