rcalixte/libqt6zig-demo
Qt 6 demo for Zig
9747206aa1903e91d4cd55ff87679df772e38733.tar.gzDemo application using the MIT-licensed Qt 6 bindings for Zig
This demo application can be thought of as a simpler instructive template for using the main library than the examples. Please try out the demo application and start a discussion if you have any questions or issues relevant to this demo application.
The demo application within libqt6zig-demo is licensed under the MIT license.
sudo pkg install qt6-base
NOTE The
zigpackage will need to be downloaded and installed separately if the latest stable version is not available in the default repositories.
sudo apt install qt6-base-dev
NOTE The
zigpackage must be downloaded and installed separately.
sudo dnf install qt6-qtbase-devel
NOTE The
zigpackage will need to be downloaded and installed separately if the latest stable version is not available in the default repositories.
sudo pacman -S qt6-base
NOTE The
zigpackage will need to be downloaded and installed separately if the latest stable version is not available in the default repositories.
To install the Qt 6 dependency using Homebrew:
brew install qt6
IMPORTANT In recent versions of Qt 6, the symlinks are not correctly created at the time of installation and must be created manually for each framework. For the demo application, the following commands can be used to create the symlinks:
ln -s /opt/homebrew/lib/QtCore.framework/Headers /opt/homebrew/include/QtCore ln -s /opt/homebrew/lib/QtGui.framework/Headers /opt/homebrew/include/QtGui ln -s /opt/homebrew/lib/QtWidgets.framework/Headers /opt/homebrew/include/QtWidgets
The official Qt installer is also supported but will require manually creating the symlinks as above and using the extra-paths option described below, using the root of the include directory as the path value.
NOTE The
zigpackage will need to be downloaded and installed separately if the latest stable version is not available via Homebrew.
For Windows, use the official Qt installer and install a Qt version built with LLVM-MinGW.
NOTE The
zigpackage will need to be downloaded and installed separately.
Once the required packages are installed, the demo application can be built from the root of the repository:
zig build
To build and run the demo application:
zig build run
In the event that another system library path is needed e.g. a different Qt installation path, the extra-paths option supports this use case:
zig build -Dextra-paths="C:/Qt/6/llvm-mingw_64"
or
zig build -Dextra-paths={"/opt/qt6","/opt/lib/qt6"}
For Windows hosts, there is an additional option to specify the Qt installation directory. This is only required if passing in an alternate extra library path meant to override the default Qt library path:
zig build -Dextra-paths="C:/Qt/6/llvm-mingw_64" -DQTDIR="C:/Qt/6/llvm-mingw_64"
The demo application can be installed to the system in a non-default location by adding the --prefix-exe-dir option to the build command:
sudo zig build --prefix-exe-dir /usr/local/bin # creates /usr/local/bin/mdoutliner
The source code for the demo application can be found in the src directory of the repository.
| CachyOS + KDE |
| Fedora + KDE |
| FreeBSD + Xfce |
| Linux Mint + Cinnamon |
| macOS |
| Windows |
The first compilation should take less than a minute, far less on more recent or capable hardware.
Currently, only ReleaseFast, ReleaseSafe, and ReleaseSmall are supported. The Debug build mode is not supported. This may change in the future. The default build mode is ReleaseFast. To change the build mode:
zig build -Doptimize=ReleaseSmall
or
zig build --release=small
@mappu for the MIQT bindings that provided the phenomenal foundation for this project
@arnetheduck for proving the value of collaboration on the back-end of the library while working across different target languages