miqt/cmd/genbindings
2024-08-25 19:08:28 +12:00
..
cachedir genbindings: generate multiple files in one run, cache clang ast files 2024-08-14 17:43:54 +12:00
clang2il_test.go genbindings: use state machine tokenization for template parameters 2024-08-19 19:11:19 +12:00
clang2il.go genbindings: initial work on inner class definitions 2024-08-25 19:08:28 +12:00
clangexec.go genbindings: misc 2024-08-15 19:51:31 +12:00
emitcabi.go genbindings: initial work on inner class definitions 2024-08-25 19:08:28 +12:00
emitgo.go genbindings: initial work on inner class definitions 2024-08-25 19:08:28 +12:00
exceptions.go genbindings: more exceptions 2024-08-24 11:46:51 +12:00
intermediate.go genbindings: initial work on inner class definitions 2024-08-25 19:08:28 +12:00
main.go genbindings: initial work on inner class definitions 2024-08-25 19:08:28 +12:00
README.md doc/README: update readme files 2024-08-25 16:06:16 +12:00
transformchildclasses.go genbindings: initial work on inner class definitions 2024-08-25 19:08:28 +12:00
transformoptional.go genbindings: support optional parameters for ctors 2024-08-25 12:50:48 +12:00
transformoverload.go genbindings: bind all Qt::constants as int 2024-08-25 17:50:14 +12:00
util.go genbindings: try to invent better names for function overloads 2024-08-15 19:50:50 +12:00

genbindings

The genbindings program regenerates the qt bindings.

Archicture design

Bindings are generated as follows:

  1. Scan input directory for header files.
  2. For each header file:
  3. Run clang --ast-dump=json to get a JSON ast.
    • This is somewhat slow, the results will be cached in ./cachedir after the first run.
  4. Convert Clang AST to our own intermediate representation.
  5. Emit CABI cpp/h pair.
    • The CABI is a projection of Qt into plain C. The translation unit itself is C++, but the header can be used as extern c.
  6. Emit Go binding file.

Configuration

It's tested to work on with Debian 12 / Qt 5.15 / Clang 14 / GCC 12.

You should check the following configuration:

  • Input directories containing Qt headers
  • All of exceptions.go