Skip to content

Commit

Permalink
Merge branch 'kassane-dlang_bindgen'
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed May 13, 2024
2 parents 13554f6 + 32314cf commit c3f2067
Show file tree
Hide file tree
Showing 4 changed files with 574 additions and 1 deletion.
57 changes: 57 additions & 0 deletions .github/workflows/gen_bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ jobs:
with:
repository: floooh/sokol-rust
path: bindgen/sokol-rust
- uses: actions/checkout@v4
with:
repository: kassane/sokol-d
path: bindgen/sokol-d
- name: generate
run: |
cd bindgen
Expand Down Expand Up @@ -88,6 +92,12 @@ jobs:
name: ignore-me-rust
retention-days: 1
path: bindgen/sokol-rust/src
- name: upload-d-artifact
uses: actions/upload-artifact@v3
with:
name: ignore-me-d
retention-days: 1
path: bindgen/sokol-d/src/sokol

test-zig:
needs: gen-bindings
Expand Down Expand Up @@ -253,6 +263,32 @@ jobs:
cargo --version
cargo build --examples --verbose
test-d:
needs: gen-bindings
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
with:
repository: kassane/sokol-d
- uses: goto-bus-stop/setup-zig@v2
- uses: dlang-community/setup-dlang@v1
with:
compiler: ldc-master
- uses: actions/download-artifact@v3
with:
name: ignore-me-d
path: src/sokol
- name: prepare
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libgl1-mesa-dev libegl1-mesa-dev mesa-common-dev xorg-dev libasound-dev
- name: build
run: zig build --summary all

# only deploy the bindings for commits on the main branch
deploy-zig:
needs: test-zig
Expand Down Expand Up @@ -344,3 +380,24 @@ jobs:
git add -A
git diff-index --quiet HEAD || git commit -m "updated (https://github.com/floooh/sokol/commit/${{ github.sha }})"
git push
deploy-d:
needs: test-d
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: kassane/sokol-d
ssh-key: ${{ secrets.GHACTIONS_D_PUSH }}
- uses: actions/download-artifact@v3
with:
name: ignore-me-d
path: src/sokol
- name: "commit and push"
run: |
git config user.email "none"
git config user.name "GH Action"
git add -A
git diff-index --quiet HEAD || git commit -m "updated (https://github.com/floooh/sokol/commit/${{ github.sha }})"
git push
1 change: 1 addition & 0 deletions bindgen/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ sokol-nim/
sokol-zig/
sokol-odin/
sokol-rust/
sokol-d/
8 changes: 7 additions & 1 deletion bindgen/gen_all.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os, gen_nim, gen_zig, gen_odin, gen_rust
import os, gen_nim, gen_zig, gen_odin, gen_rust, gen_d

tasks = [
[ '../sokol_log.h', 'slog_', [] ],
Expand Down Expand Up @@ -30,6 +30,12 @@
[c_header_path, main_prefix, dep_prefixes] = task
gen_zig.gen(c_header_path, main_prefix, dep_prefixes)

# D
gen_d.prepare()
for task in tasks:
[c_header_path, main_prefix, dep_prefixes] = task
gen_d.gen(c_header_path, main_prefix, dep_prefixes)

# Rust
gen_rust.prepare()
for task in tasks:
Expand Down

0 comments on commit c3f2067

Please sign in to comment.