From 7a387cb675439f108737ad1ac09baf4976a18fe5 Mon Sep 17 00:00:00 2001 From: gentoo90 Date: Fri, 6 Oct 2017 21:51:41 +0300 Subject: [PATCH] Add info about env variables and building on Windows to README.md --- README.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index af3a694..9862756 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,17 @@ A somewhat safe Rust interface to the [ImageMagick](http://www.imagemagick.org/) ## Dependencies -* Rust (~latest release) +* Rust (~latest release) (on Windows you will require MSVC version) * Cargo (~latest release) * ImageMagick (version 7.0.x) - Does _not_ work with ImageMagick 6.x due to backward incompatible changes. - [FreeBSD](https://www.freebsd.org): `sudo pkg install ImageMagick7` - [Homebrew](http://brew.sh): `brew install imagemagick` - Linux may require building ImageMagick from source, see the `Dockerfile` for an example + - Windows: download `*-dll` [installer](https://www.imagemagick.org/script/binary-releases.php#windows). Only MSVC version available. When installing, check the checkbox "Install development headers and libraries for C and C++". * [Clang](https://clang.llvm.org) (version 3.5 or higher) - Or whatever version is dictated by [rust-bindgen](https://github.com/servo/rust-bindgen) -* `pkg-config`, to facilitate linking with ImageMagick. +* Optionally `pkg-config`, to facilitate linking with ImageMagick. Or you can set linker parameters via environment variables. ## Build and Test @@ -24,6 +25,25 @@ $ cargo build $ cargo test ``` +Optionally you can set some environment variables before building: +* `IMAGE_MAGICK_DIR` - installation directory of ImageMagick +* `IMAGE_MAGICK_LIB_DIRS` - list of lib directories split by `:` +* `IMAGE_MAGICK_INCLUDE_DIRS` - list of include directories split by `:` +* `IMAGE_MAGICK_LIBS` - list of the libs to link to + +### Build on Windows + +On Windows you will need to launch build in Visual Studio Native Tools Command Prompt. +It can be found in *Start menu -> Visual Studio < VERSION > -> Visual Studio Tools -> Windows Desktop Command Prompts*. +Choose the architecture corresponding to architecture of your rust compiler. +This is required for proper work of `rust-bindgen`. + +``` +> set IMAGE_MAGICK_DIR= +> cargo build +> cargo test +``` + ## Example Usage MagickWand has some global state that needs to be initialized prior to using the library, but fortunately Rust makes handling this pretty easy. In the example below, we read in an image from a file and resize it to fit a square of 240 by 240 pixels, then convert the image to JPEG.