doc/README: update readme files

This commit is contained in:
mappu 2024-08-25 16:06:16 +12:00
parent aca9773803
commit 6a1dcc4ed7
2 changed files with 58 additions and 1 deletions

View File

@ -1,10 +1,42 @@
![](doc/logo.svg)
![](https://img.shields.io/badge/License-MIT-green)
# MIQT
MIT-licensed Qt bindings for Go.
Developed against Clang 14, Qt 5.15, Debian 12
This is a straightforward binding of the Qt API using CGO. You must have a working Qt C++ development toolchain to use this Go binding.
## Project status
These bindings were newly started in August 2024. The bindings are functional. But, they may be immature in some ways. Please try out the bindings and raise issues if you have trouble. A detailed status is in the [TODO file](TODO).
## Supported platforms
|Platform|Linkage|Status
|---|---|---
|Linux|Static, Dynamic (.so)|✅ Works (Tested with Debian 12 / Qt 5.15 / Clang 14 / GCC 12)
|Windows|Static, Dynamic (.dll)|Should work, not tested
|macOS|Static, Dynamic (.dylib)|Should work, not tested
## License
- The Go bindings and tools in this repo are licensed under the MIT license
- You must also meet your Qt license obligations.
## FAQ
1. Why are the binaries so big?
Make sure to compile with `go build "-ldflags -s -w"`. This reduces the `helloworld` example from 42MB to 6MB.
Then, it's possible to reduce the size further with `upx --best` to 2MB or `upx --lzma` to 1.4MB.
2. Can I release a proprietary, commercial app with this binding?
Yes. You must also meet your Qt license obligations: either use Qt dynamically-linked dll/so/dylib files under the LGPL, or, purchase a Qt commercial license for static linking.
3. Why does it take so long to compile?
The first time the Qt bindings are compiled takes a long time. After this, it's fast. In a Dockerfile, you could cache the build step by running `go install github.com/mappu/miqt`.

25
cmd/genbindings/README.md Normal file
View File

@ -0,0 +1,25 @@
# 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`