Skip to content

rcalixte/libqt6zig-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libqt6zig-demo

MIT License Static Badge

Builds


Demo 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.


TABLE OF CONTENTS

License

The demo application within libqt6zig-demo is licensed under the MIT license.

Building


FreeBSD (native)

sudo pkg install qt6-base

Note

The zig package will need to be downloaded and installed separately if the latest stable version is not available in the default repositories.


Linux (native)

Debian-based distributions

sudo apt install qt6-base-dev

Note

The zig package must be downloaded and installed separately.

Fedora-based distributions

sudo dnf install qt6-qtbase-devel

Note

The zig package will need to be downloaded and installed separately if the latest stable version is not available in the default repositories.

Arch-based distributions

sudo pacman -S qt6-base

Note

The zig package will need to be downloaded and installed separately if the latest stable version is not available in the default repositories.


macOS (native)

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 zig package will need to be downloaded and installed separately if the latest stable version is not available via Homebrew.


Windows (native)

For Windows, use the official Qt installer and install a Qt version built with LLVM-MinGW.

Note

The zig package 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.

Screenshots

cachy_kde
CachyOS + KDE
fedora_kde
Fedora + KDE
freebsd_xfce
FreeBSD + Xfce
mint_cinnamon
Linux Mint + Cinnamon
macos
macOS
windows
Windows

FAQ

Q1. How long does it take to compile the demo application?

The first compilation should take less than a minute, far less on more recent or capable hardware.

Q2. What build modes are supported by the demo application?

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

Special Thanks

  • @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

Releases

No releases published

Packages

No packages published

Languages