GoaLitiuM / bindbc-bgfx

Dynamic and static D bindings for bgfx
Boost Software License 1.0
21 stars 1 forks source link

Consider generating D bindings via IDL script #1

Closed bkaradzic closed 4 years ago

bkaradzic commented 4 years ago

Since D is C-like language, generating D bindings via IDL would be fairly trivial. See example of generating C# bindings: https://github.com/bkaradzic/bgfx/blob/master/scripts/bindings-cs.lua

By providing IDL script generator for D language, maintenance of your D language package would be drastically simplified.

GoaLitiuM commented 4 years ago

The latest commit (2d0d7735eac193356a57f229c087be4820d6b41d) now uses IDL generated bindings, will do a PR for the generator once I clean up the code a bit.

bkaradzic commented 4 years ago

:+1: Great!

All files you currently have inside bindbc-bgfx/source/bindbc/bgfx could go to bgfx/bindings/d. And then keep this repository just as is with copy of those files.

GoaLitiuM commented 4 years ago

The current implementation only generates types.d and funcs.d under the bindings folder, which then can replace the corresponding files in these bindings to target any future (or past) releases. Would this be enough?

bkaradzic commented 4 years ago

Yes, in bgfx just API is generated, all helper utilities are fine to stay inside your repo.

SrMordred commented 4 years ago

@GoaLitiuM Did u considered putting the scripts/steps that generate the bidings here on the repo? So that future contributors can generate correctly the API and keep pace with bgfx releases, if wanted/needed.

bkaradzic commented 4 years ago

I'll always have latest in bgfx. But any external repo should be locked to specific rev from bgfx (not the latest from the master).

GoaLitiuM commented 4 years ago

I simply used genie idl to generate the bindings from scratch (this assumes you know how to build bgfx with the genie tool), then you can simply replace funcs.d and types.d with the ones generated under bgfx/bindings/d directory. I'll try to keep this repo up-to-date as well as the bgfx API changes.