Qt applications with Cargo

2018-10-30

This blog shows how Qt applications can be built with Cargo. The goal is to make compiling them as simple as installing Qt and running

qrep and mailmodel are examples. You can try qrep with

Rust Qt Binding Generator repository.

Why Cargo?

In previous blogs we built applications with CMake. CMake is probably the most widely used tool to compile Qt software. CMake uses Cargo to build the Rust parts.

CMake is a familiar tool for Qt developers, but not for Rust developers. For them, CMake is an unneeded hurdle. Rust Qt Binding Generator can be used with only Cargo. To do so you use the Rust way of building C++ code: build.rs.

build.rs

build.rs contains Rust code that is compiled and run by Cargo to build an application. Here is a simple build.rs file:

here.

Comments

Post a comment