mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
.. | ||
cachedir | ||
clang2il_test.go | ||
clang2il.go | ||
clangexec.go | ||
config-allowlist.go | ||
config-libraries.go | ||
emitcabi.go | ||
emitgo.go | ||
intermediate.go | ||
main.go | ||
README.md | ||
transformblocklist.go | ||
transformchildclasses_test.go | ||
transformchildclasses.go | ||
transformctors.go | ||
transformoptional.go | ||
transformoverload.go | ||
transformredundant.go | ||
transformtypedefs_test.go | ||
transformtypedefs.go | ||
util.go |
genbindings
The genbindings
program regenerates the Qt bindings.
Architecture design
Bindings are generated in two passes:
Pass 1
- Scan input directory for header files.
- For each header file:
- 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. - Strip all Clang AST nodes that were included from other files, to only consider the header's own definitions.
- This is somewhat slow, the results will be cached in
- Convert Clang AST to our own intermediate representation.
- Run some transformations on the intermediate representation.
- Cache and collect the global state of all known class names, enum names, and typedefs.
Pass 2
- For each intermediate-representation AST:
- 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.
- Emit Go binding file.
- The Go binding uses CGO to call into the CABI binding.
Configuration
It's tested to work on with Debian 12 with system packages (Qt 5.15 / Qt 6.4 / Clang 14 / GCC 12).
You should check the following configuration:
config-libraries.go
: Input directories containing Qt headersconfig-allowlist.go
: Check everything