Commit 5f94d7a9 authored by RazrFalcon's avatar RazrFalcon

Added MSVC support.

New build docs.

Closes #72, Closes #75
parent e08ad166
:toc:
:toc-title:
= How to build *resvg*
== Into
*resvg* doesn't include a 2D graphics library and uses external ones via https://en.wikipedia.org/wiki/Foreign_function_interface[FFI].
Their support is implemented separately, therefore we call them _backends_.
You can build them separately or together. +
At the moment, there are only two backends: *Qt* and *cairo*.
The first one uses the https://www.qt.io/[Qt framework] and the second one uses the
https://www.cairographics.org/[cairo] library.
Since *resvg* is a https://www.rust-lang.org/[Rust] library, you should build it via `cargo`. +
To enable a backend use the `--features` option:
```bash
# 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"
```
== Dependencies
- The library requires the latest stable
https://www.rust-lang.org/tools/install[Rust].
- _Qt backend_ requires only `QtCore` and `QtGui` libraries
and the JPEG image format plugin (aka `plugins/imageformats/qjpeg`). +
Technically, any Qt 5 version should work, but we only support Qt >= 5.6.
- _cairo backend_ requires https://www.cairographics.org/[cairo] itself and https://www.pango.org/[pango] for text rendering (with the `pangocairo` glue library, which is an optional part of the `pango`). +
There is no specific minimal supported version at the moment.
== Windows
=== Qt backend via MSVC
Install `stable-x86_64-pc-windows-msvc` https://www.rust-lang.org/tools/install[Rust] target.
Install Qt built with MSVC via an
http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe[official installer].
Build using `cmd.exe`:
```batch
set PATH=%userprofile%\.cargo\bin;%PATH%
set QT_DIR=C:\Qt\5.12.0\msvc2015_64
cargo.exe build --release --features "qt-backend"
```
Instead of `msvc2015_64` you can use any other Qt MSVC build. Even 32-bit one. +
We are using Qt 5.12.0 just for example.
=== Qt backend via MinGW
Install `stable-i686-pc-windows-gnu` https://www.rust-lang.org/tools/install[Rust] target.
Install Qt built with MinGW 32-bit via an
http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe[official installer]. +
64-bit version, available since Qt 5.12, will not work due to https://github.com/rust-lang/rust/issues/47048[#47048].
Build using `cmd.exe`:
```batch
set PATH=C:\Qt\5.11.3\mingw53_32\bin;C:\Qt\Tools\mingw530_32\bin;%userprofile%\.cargo\bin;%PATH%
set QT_DIR=C:\Qt\5.11.3\mingw53_32
cargo.exe build --release --features "qt-backend"
```
Instead of `mingw53_32` you can use any other Qt mingw build. +
We are using Qt 5.11.3 just for example.
=== cairo backend via MSYS2
Install `stable-x86_64-pc-windows-gnu` https://www.rust-lang.org/tools/install[Rust] target.
Install GTK+ dependencies using MSYS2 as explained
http://gtk-rs.org/docs/requirements.html#windows[here].
We do not need the whole GTK+, so we can install only `pango` (which will install
`cairo` too) and `gdk-pixbuf2`:
```bash
pacman -S mingw-w64-x86_64-pango mingw-w64-x86_64-gdk-pixbuf2
cargo.exe build --release --features "cairo-backend"
```
You can use x86/i686 target in the same way.
== Linux
=== Qt backend
Install Qt 5 using your distributive package manager and then build *resvg*:
```bash
cargo build --release --features "qt-backend"
```
If you don't want to use a system Qt, you can alter it with the `PKG_CONFIG_PATH` variable.
```bash
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 package manager.
For Ubuntu its `libpango1.0-dev` (will pull `cairo` too) and `libgdk-pixbuf2.0-dev`.
```bash
cargo build --release --features "cairo-backend"
```
== macOS
=== Qt backend
Using https://brew.sh/[homebrew]:
```bash
brew install qt
QT_DIR=/usr/local/opt/qt cargo build --release --features "qt-backend"
```
Or an
http://download.qt.io/official_releases/online_installers/qt-unified-mac-x64-online.dmg[official Qt installer]:
```bash
QT_DIR=/Users/$USER/Qt/5.12.0/clang_64 cargo build --release --features "qt-backend"
```
We are using Qt 5.12.0 just for example.
=== cairo backend
Using https://brew.sh/[homebrew]:
```bash
brew install cairo pango gdk-pixbuf
cargo build --release --features "cairo-backend"
```
......@@ -9,6 +9,7 @@ This changelog also contains important changes in dependencies.
## [Unreleased]
### Added
- (resvg) Nested `clipPath` support.
- (resvg) MSVC support.
- (rendersvg) `font-family`, `font-size` and `languages` to args.
- (usvg) `systemLanguage` attribute support.
- (usvg) Default font family and size is configurable now.
......
......@@ -44,7 +44,7 @@ pangocairo = { version = "0.6", optional = true }
# qt backend
#resvg-qt = { version = "0.3", optional = true }
resvg-qt = { git = "https://github.com/RazrFalcon/resvg-qt", rev = "6e616b4", optional = true }
resvg-qt = { git = "https://github.com/RazrFalcon/resvg-qt", rev = "0fde4c9", optional = true }
#resvg-qt = { path = "../resvg-qt", optional = true }
[features]
......
......@@ -88,10 +88,6 @@ It also includes alternative libraries.
- Inkscape and Batik are slow just because.
- [More details.](https://github.com/RazrFalcon/resvg-test-suite/blob/master/tools/perf/README.md)
## Backends
*resvg* supports [Qt] and [cairo] backends.
## Project structure
- `resvg` - rendering backends implementation
......@@ -105,10 +101,6 @@ It also includes alternative libraries.
All other dependencies aren't written by me for this project.
## Build
See [docs/build.md](docs/build.md) for details.
## License
*resvg* is licensed under the [MPLv2.0](https://www.mozilla.org/en-US/MPL/).
......
......@@ -11,7 +11,7 @@ cargo build --release --features="cairo-backend"
cargo build --release --features="qt-backend cairo-backend"
```
See [docs/build.md](../docs/build.md) for details.
See [BUILD.adoc](../BUILD.adoc) for details.
This will build a dynamic library. There is no point in building the static
library since it will depend on Qt/cairo anyway.
......
# 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`:
```bash
# 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.(dll/so/dylib)`).
Technically, any Qt 5 version should work, but we only support Qt >= 5.6.
### cairo backend
We are using `pango` for text rendering, so you have to build it too.
With a `pangocairo` library (part of the `pango`).
## Windows
1. [Install Rust](https://www.rust-lang.org/en-US/install.html) with a
`stable-i686-pc-windows-gnu` target. MSVS is not supported.
1. Install [MSYS2](http://www.msys2.org/).
### Qt backend
Only MinGW 32bit version is supported.
Install Qt MinGW 32bit using an
[official installer](http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe).
In the MSYS2 Shell:
```bash
# We are using 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](http://gtk-rs.org/docs/requirements.html#windows).
We do not need the whole GTK+, so we can install only `pango` (which will install
`cairo` too) and `gdk-pixbuf2`:
```bash
pacman -S mingw-w64-i686-pango mingw-w64-i686-gdk-pixbuf2
```
Then we can build *resvg*:
```bash
cargo.exe build --release --features "cairo-backend"
```
## Linux
[Install Rust](https://www.rust-lang.org/en-US/install.html).
### Qt backend
Install Qt 5 using your distributive package manager.
```bash
cargo build --release --features "qt-backend"
```
If you don't want to use a system Qt you can alter it with the `PKG_CONFIG_PATH` variable.
```bash
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`.
```bash
cargo build --release --features "cairo-backend"
```
## macOS
[Install Rust](https://www.rust-lang.org/en-US/install.html).
### Qt backend
Using [homebrew](https://brew.sh/):
```bash
brew install qt
QT_DIR=/usr/local/opt/qt cargo build --release --features "qt-backend"
```
Or an
[official installer](http://download.qt.io/official_releases/online_installers/qt-unified-mac-x64-online.dmg):
```bash
QT_DIR=/Users/$USER/Qt/5.9.3/clang_64 cargo build --release --features "qt-backend"
```
### cairo backend
Using [homebrew](https://brew.sh/):
```bash
brew install gdk-pixbuf pango cairo
cargo build --release --features "cairo-backend"
```
Move into [../BUILD.adoc](../BUILD.adoc).
See [docs/build.md](../docs/build.md) first.
See [BUILD.adoc](../BUILD.adoc) first.
Note: we are using *qt-backend* just for example.
......
......@@ -11,4 +11,4 @@ make
LD_LIBRARY_PATH=../../target/debug ./example ../qt-demo/hello-resvg.svg
```
See [docs/build.md](../../docs/build.md) for details.
See [BUILD.adoc](../../BUILD.adoc) for details.
......@@ -6,4 +6,4 @@ A simple example that shows how to use *resvg* from `gtk-rs`.
cargo run -- ../qt-demo/hello-resvg.svg
```
See [docs/build.md](../../docs/build.md) for details.
See [BUILD.adoc](../../BUILD.adoc) for details.
......@@ -17,4 +17,4 @@ make
LD_LIBRARY_PATH=../../target/release ./demo
```
See [docs/build.md](../../docs/build.md) for details.
See [BUILD.adoc](../../BUILD.adoc) for details.
e-filter-052.svg
e-filter-053.svg
e-filter-054.svg
e-filter-052.svg
e-filter-053.svg
e-filter-054.svg
......@@ -13,7 +13,7 @@ cargo build --release --features="cairo-backend"
cargo build --release --features="qt-backend cairo-backend"
```
See [docs/build.md](../../docs/build.md) for details.
See [BUILD.adoc](../../BUILD.adoc) for details.
## Usage
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment