lvgl / lv_binding_cpp

[WIP] C++ binding for LVGL
MIT License
44 stars 20 forks source link

Progress on lv_cxx_bindgen #10

Open voltangle opened 8 months ago

voltangle commented 8 months ago

It's just that I started work on my implementation of a C++ binding generator, soo I would like to know if someone is already working on this, so that I can know if I should still continue work on mine Current progress is an implemented extractor of functions from .h files, and an abstract source code tree (a representation of all binding parts in memory) generator in progress.

kisvegabor commented 8 months ago

It's just that I started work on my implementation of a C++ binding generator

A generator would be great! Mostly I have seen only hand written C++ bindings.

As far as I know no one is actively working on it now. Please keep us posted about the progress.

voltangle commented 8 months ago

If you're interested, here's a link to the repo: https://github.com/dynamium/lv_cxx_bindgen

xinsuinizhuan commented 8 months ago

I plan to work with this. So recommended to update the lvgl code to the latest version

kisvegabor commented 8 months ago

I agree to this based on LVGL v9 (in current master). @kdschlosser is working on a simple JSON file containing the whole LVGL API in an easy to digest form. I hope it will go public soon.

voltangle commented 8 months ago

Now that sounds good! Because right now parsing all the source code is pretty hard to do right, especially with all the macros ngl Oh, and yes, if that JSON file becomes a thing, the generator can support both source code parsing and JSON, or better yet, have it separated into two utilities, the one that parses header files and extracts everything into a JSON file, and the one that generates all the bindings from the same JSON file

kisvegabor commented 8 months ago

See the discussion about the JSON file here: 5168

gjvanderheiden commented 8 months ago

I am! Got it working for version 8 en 9 with examples. Replace the lvgl dir with your fav. version. Generates with Python.

https://github.com/gjvanderheiden/lv_binding_cpp

This is weeks of work. I needed it to develop my own project.

gjvanderheiden commented 8 months ago

The only caveat is order of deletion, because the c lib deletes it's child objects.

This is all fine, as long as you declare your object in the same order as creation. Assuming you're not using raw pointers. (Then delete in the reverse order). Also tried to add a check, worked also, but wasn't sure about it being better

kisvegabor commented 8 months ago

Hi @gjvanderheiden,

Thank you for jumping in! It's great now we have 2 people working on it.

I suggest figuring out what the advantages of yours and @ggoraa's implementation are and try to unify them.

kisvegabor commented 8 months ago

I think the JSON file proposed in https://github.com/lvgl/lvgl/issues/5168 shall be used in the end so that the bindings can work from a common source.

gjvanderheiden commented 8 months ago

Sorry, I don't intend to redo my idea for a first version. I deleted my fork on GitHub.

I'm sorry, but my project is done as version 1. I've put many many many hours in the bindings and it is fully working for version 8 en 9, has examples, can wrap structs with assessors to name a few features. I did this in my own time. I'm talking about weeks full time. I wrote it, so I'm the owner of my code. Not to say I'm not open for suggestions, modifications, improvements. More to say I ment it as a take or leave over as is first version.

It could use json in the future, but now it's working. It also parses the #if LVUSE... statements around the methods. It also parses comments and detects and removes the C-object parameter as It is even uncertain of json could provide the level of detail I'm doing in my version.

I wish good luck to the project.

kisvegabor commented 8 months ago

I'm sorry to hear that. All I wanted to say is that we are smarter together and we can discuss how to do things better.

voltangle commented 7 months ago

By the way, is the reward still a thing? :D

kisvegabor commented 7 months ago

Sure, it is! :slightly_smiling_face:

boulabiar commented 7 months ago

Is there an update on this work or an example on how the generated API will look like? lvgl is now the best alternative to Qt embedded, but a good C++ support is mandatory for this.

kisvegabor commented 6 months ago

lvgl is now the best alternative to Qt embedded

Oh thank you! :blush:

but a good C++ support is mandatory for this.

I'm also curious about the current status. :eyes:

voltangle commented 6 months ago

I'm also curious about the current status. 👀

The status is "half way there" :)

I took a little break from development because of personal reasons (mainly exams and the start of the second semester in uni, but if I'm being honest, I also got a little carried away while playing around with Fusion 360, and started another project lmao 😅), but I plan to return very soon! Don't worry guys, the project is far from being dead, it's gonna be done no matter what :)

kisvegabor commented 6 months ago

Happy to hear that you haven't gave up! :muscle: :rocket: