Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bindgen: D language #955

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -238,6 +248,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 @@ -329,3 +365,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