Skip to content

Commit 44c27e7

Browse files
authored
fix!: Improve C bindings package directory structure (#239)
1 parent fac6462 commit 44c27e7

File tree

2 files changed

+56
-25
lines changed

2 files changed

+56
-25
lines changed

.github/workflows/bindings.yml

Lines changed: 55 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,52 @@ jobs:
1212
include:
1313
- os: macOS-latest
1414
target: aarch64-apple-darwin
15-
path: macos-arm64
15+
path: macos/arm64
16+
shared-ext: dylib
17+
static-ext: a
1618
- os: macOS-latest
1719
target: x86_64-apple-darwin
18-
path: macos-x86_64
20+
path: macos/x86_64
21+
shared-ext: dylib
22+
static-ext: a
1923
- os: windows-2019
2024
target: aarch64-pc-windows-msvc
21-
path: win-arm64-msvc
25+
path: windows/arm64/msvc
26+
shared-ext: dll
27+
static-ext: lib
2228
- os: windows-2019
2329
target: i686-pc-windows-msvc
24-
path: win-x86-msvc
30+
path: windows/x86/msvc
31+
shared-ext: dll
32+
static-ext: lib
2533
- os: windows-2019
2634
target: x86_64-pc-windows-msvc
27-
path: win-x86_64-msvc
35+
path: windows/x86_64/msvc
36+
shared-ext: dll
37+
static-ext: lib
2838
- os: ubuntu-latest
2939
target: i686-pc-windows-gnu
3040
use-cross: true
31-
path: win-x86-mingw
41+
path: windows/x86/mingw
42+
shared-ext: dll
43+
static-ext: a
3244
- os: ubuntu-latest
3345
target: x86_64-pc-windows-gnu
3446
use-cross: true
35-
path: win-x86_64-mingw
47+
path: windows/x86_64/mingw
48+
shared-ext: dll
49+
static-ext: a
3650
- os: ubuntu-latest
3751
target: i686-unknown-linux-gnu
3852
use-cross: true
39-
path: linux-x86
53+
path: linux/x86
54+
shared-ext: so
55+
static-ext: a
4056
- os: ubuntu-latest
4157
target: x86_64-unknown-linux-gnu
42-
path: linux-x86_64
58+
path: linux/x86_64
59+
shared-ext: so
60+
static-ext: a
4361
name: cargo build
4462
steps:
4563
- uses: actions/checkout@v3
@@ -59,17 +77,27 @@ jobs:
5977
use-cross: ${{ matrix.use-cross || false }}
6078
args: --package accesskit_c --release --target ${{ matrix.target }}
6179

80+
- shell: bash
81+
run: |
82+
mkdir -p artifacts/${{ matrix.path }}/shared
83+
mkdir -p artifacts/${{ matrix.path }}/static
84+
85+
- if: startsWith(matrix.os, 'windows')
86+
run: |
87+
mv target/${{ matrix.target }}/release/accesskit.dll.lib artifacts/${{ matrix.path }}/shared/accesskit.lib
88+
mv target/${{ matrix.target }}/release/*.pdb artifacts/${{ matrix.path }}/shared
89+
- if: contains(matrix.path, 'mingw')
90+
run: mv target/${{ matrix.target }}/release/libaccesskit.dll.a artifacts/${{ matrix.path }}/shared/libaccesskit.a
91+
92+
- run: |
93+
mv target/${{ matrix.target }}/release/*.${{ matrix.shared-ext }} artifacts/${{ matrix.path }}/shared
94+
mv target/${{ matrix.target }}/release/*.${{ matrix.static-ext }} artifacts/${{ matrix.path }}/static
95+
6296
- name: Upload binaries
6397
uses: actions/upload-artifact@v3
6498
with:
65-
name: ${{ matrix.path }}
66-
path: |
67-
target/${{ matrix.target }}/release/*.a
68-
target/${{ matrix.target }}/release/*.dll
69-
target/${{ matrix.target }}/release/*.dylib
70-
target/${{ matrix.target }}/release/*.lib
71-
target/${{ matrix.target }}/release/*.pdb
72-
target/${{ matrix.target }}/release/*.so
99+
name: ${{ matrix.target }}
100+
path: artifacts
73101

74102
generate-headers:
75103
if: startsWith(github.ref_name, 'accesskit_c-v')
@@ -84,14 +112,17 @@ jobs:
84112

85113
- uses: actions/download-artifact@v3
86114
with:
87-
path: accesskit_c/lib
115+
path: artifacts
88116

89-
- run: mv accesskit_c/lib/headers accesskit_c/include
90-
- run: cp -r bindings/c/examples accesskit_c/
91-
- run: cp bindings/c/*.md accesskit_c/
92-
- run: cp LICENSE* accesskit_c/
93-
- run: mv accesskit_c ${{ github.ref_name }}
94-
- run: zip -r ${{ github.ref_name }}.zip ${{ github.ref_name }}
117+
- run: |
118+
mkdir -p accesskit_c/lib
119+
mv artifacts/headers accesskit_c/include
120+
cp -r artifacts/*/* accesskit_c/lib
121+
cp -r bindings/c/examples accesskit_c/
122+
cp bindings/c/*.md accesskit_c/
123+
cp LICENSE* accesskit_c/
124+
mv accesskit_c ${{ github.ref_name }}
125+
zip -r ${{ github.ref_name }}.zip ${{ github.ref_name }}
95126
96127
- uses: AButler/upload-release-assets@v2.0
97128
with:

bindings/c/examples/windows/build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
@echo off
22
cl /nologo /W3 /DUNICODE /D_UNICODE /I..\..\include /c hello_world.c
33
Rem This script assumes you are building this example from the downloaded package on a 64bit machine.
4-
link /NOLOGO /SUBSYSTEM:CONSOLE hello_world.obj ..\..\lib\win-x86_64-msvc\accesskit.lib advapi32.lib bcrypt.lib kernel32.lib ole32.lib oleaut32.lib shell32.lib uiautomationcore.lib user32.lib userenv.lib winspool.lib ws2_32.lib
4+
link /NOLOGO /SUBSYSTEM:CONSOLE hello_world.obj ..\..\lib\windows\x86_64\msvc\static\accesskit.lib advapi32.lib bcrypt.lib kernel32.lib ole32.lib oleaut32.lib shell32.lib uiautomationcore.lib user32.lib userenv.lib winspool.lib ws2_32.lib

0 commit comments

Comments
 (0)