nlfiedler / magick-rust

Rust bindings for ImageMagick
https://crates.io/crates/magick_rust
Apache License 2.0
258 stars 68 forks source link

Add quantum depth, fixes #70 #71

Closed asonix closed 4 years ago

asonix commented 4 years ago

Add a define for setting quantum depth, fixing build errors with recent imagemagick versions

fixes https://github.com/nlfiedler/magick-rust/issues/70

nlfiedler commented 4 years ago

That certainly makes the compiler error go away, but is that appropriate for systems where a different quantum depth would have been the default? It seems that Magick++-config will provide all of the necessary flags, so perhaps build.rs should be modified to invoke this and set the result as the BINDGEN_EXTRA_CLANG_ARGS environment variable. Maybe that will work, if clang accepts these arguments.

$ Magick++-config --cppflags
-Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/Cellar/imagemagick/7.0.10-34/include/ImageMagick-7

This may be difficult, but hard-coding the value to 8 is likely going to cause problems for others.

asonix commented 4 years ago

Thanks for the pointer, I'm working on that change now

asonix commented 4 years ago

I've updated the build.rs to apply the required compile flags, and tested it in my own program (compiling amd64 native, and cross-compiling for arm32v7 and arm64v8).

nlfiedler commented 4 years ago

Thanks for addressing this, it should help a few people, it's come up before.