Skip to content

Commit 9fddefa

Browse files
committed
Fix C bindings building for windows and macos
1 parent 50c4056 commit 9fddefa

File tree

1 file changed

+39
-12
lines changed

1 file changed

+39
-12
lines changed

.github/workflows/c_bindings.yml

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
# Releases artifacts to the github release tab
4646
release:
4747
name: Release ${{ matrix.crate-type }} for ${{ matrix.target }}
48-
runs-on: ${{ matrix.os }}
48+
runs-on: ${{ matrix.os_image }}
4949
strategy:
5050
fail-fast: false
5151
matrix:
@@ -54,19 +54,40 @@ jobs:
5454
include:
5555
- target: x86_64-pc-windows-gnu
5656
archive: zip
57-
os: windows-latest
57+
os_image: windows-latest
58+
os_name: windows
59+
cp_cmd: Copy-Item,
60+
cp_r_cmd: Copy-Item -Recurse,
5861
- target: x86_64-pc-windows-msvc
5962
archive: zip
60-
os: windows-latest
63+
os_image: windows-latest
64+
os_name: windows
65+
cp_cmd: Copy-Item,
66+
cp_r_cmd: Copy-Item -Recurse,
6167
- target: x86_64-apple-darwin
6268
archive: zip
63-
os: macos-latest
69+
os_image: macos-latest
70+
os_name: macos
71+
cp_cmd: cp,
72+
cp_r_cmd: cp -r,
73+
- target: aarch64-apple-darwin
74+
archive: zip
75+
os_image: macos-latest
76+
os_name: macos
77+
cp_cmd: cp,
78+
cp_r_cmd: cp -r,
6479
- target: x86_64-unknown-linux-musl
6580
archive: tar.gz
66-
os: ubuntu-22.04
81+
os_image: ubuntu-22.04
82+
os_name: linux
83+
cp_cmd: cp,
84+
cp_r_cmd: cp -r,
6785
- target: x86_64-unknown-linux-gnu
6886
archive: tar.gz
69-
os: ubuntu-22.04
87+
os_image: ubuntu-22.04
88+
os_name: linux
89+
cp_cmd: cp,
90+
cp_r_cmd: cp -r,
7091

7192
steps:
7293
- name: Checkout repo
@@ -77,6 +98,11 @@ jobs:
7798
with:
7899
targets: ${{ matrix.target }}
79100

101+
- name: Install other dependencies
102+
if: matrix.os_name == 'macos'
103+
run: |
104+
brew install tree
105+
80106
- name: Build lib
81107
run: cargo rustc --lib --features c_bindings --release --crate-type ${{ matrix.crate-type }} --target ${{ matrix.target }}
82108

@@ -86,12 +112,13 @@ jobs:
86112
87113
- name: Move files for packaging
88114
run: |
89-
mkdir -p package/lib package/include
90-
cp target/${{ matrix.target }}/release/libipl3checksum.a package/lib/ || cp target/${{ matrix.target }}/release/ipl3checksum.lib package/lib/
91-
cp -r bindings/c/include/* package/include/
92-
cp LICENSE package/ipl3checksum.LICENSE
93-
cp README.md package/ipl3checksum.README.md
94-
cp CHANGELOG.md package/ipl3checksum.CHANGELOG.md
115+
mkdir -p package/lib
116+
mkdir -p package/include
117+
${{ cp_cmd }} target/${{ matrix.target }}/release/libipl3checksum.a package/lib/ || cp target/${{ matrix.target }}/release/ipl3checksum.lib package/lib/
118+
${{ cp_r_cmd }} bindings/c/include/* package/include/
119+
${{ cp_cmd }} LICENSE package/ipl3checksum.LICENSE
120+
${{ cp_cmd }} README.md package/ipl3checksum.README.md
121+
${{ cp_cmd }} CHANGELOG.md package/ipl3checksum.CHANGELOG.md
95122
tree package
96123
97124
- name: Package .tar.gz

0 commit comments

Comments
 (0)