Skip to content

Latest commit

 

History

History
118 lines (76 loc) · 2.79 KB

build.md

File metadata and controls

118 lines (76 loc) · 2.79 KB

How to build resvg

General

Currently, resvg supports only two backend: Qt and cairo.

You can build them separately or together.

To enable a backend use the --features option of the cargo:

# Build with a Qt backend
cargo build --release --features="qt-backend"
# or with a cairo backend
cargo build --release --features="cairo-backend"
# or with both.
cargo build --release --features="qt-backend cairo-backend"

Rust

The library requires Rust >= 1.22.

Qt backend

Qt backend requires only QtCore and QtGui libraries. And the JPEG image format plugin (eg. plugins/imageformats/libqjpeg.so).

Technically, any Qt 5 version should work, but we support only Qt >= 5.6.

cairo backend

We use pango for text rendering, so you have to install/build it too with a pangocairo library.

Windows

  1. Install Rust with a stable-i686-pc-windows-gnu target.
  2. Install MSYS2.

Qt backend

Only MinGW 32bit version is supported. MSVS should work too, but it is not tested.

Install Qt MinGW 32bit using an official installer.

In the MSYS2 Shell:

# We use Qt 5.9.3 for example.

# Prepare PATH.
export PATH="/c/Qt/5.9.3/mingw53_32/bin:/c/Qt/Tools/mingw530_32/bin:/c/Users/$USER/.cargo/bin:$PATH"

# Build.
QT_DIR=/c/Qt/5.9.3/mingw53_32 cargo.exe build --release --features "qt-backend"

cairo backend

Install GTK+ dependencies using MSYS2 as explained here.

We do not need the whole GTK+, so we can install only pango (which will install cairo too) and gdk-pixbuf2:

pacman -S mingw-w64-i686-pango mingw-w64-i686-gdk-pixbuf2

Then run this command in the MSYS2 MinGW Shell:

cargo.exe build --release --features "cairo-backend"

Linux

Qt backend

Install Qt 5 using your distributive package manager.

cargo build --release --features "qt-backend"

If you don't want to use the system Qt you can alter it with the PKG_CONFIG_PATH variable.

PKG_CONFIG_PATH='/path_to_qt/lib/pkgconfig' cargo build --release --features "qt-backend"

cairo backend

Install cairo, pango(with pangocairo) and gdk-pixbuf using your distributive's package manager.

For Ubuntu its libpango1.0-dev and libgdk-pixbuf2.0-dev.

cargo build --release --features "cairo-backend"

macOS

Install Rust.

Qt backend

Install Qt using an official installer.

QT_DIR=/Users/$USER/Qt/5.9.3/clang_64 cargo build --release --features "qt-backend"

cairo backend

Not supported.