nlfiedler / magick-rust

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

Support building with ImageMagick from MSYS2 #114

Closed gyk closed 7 months ago

gyk commented 7 months ago

Linking against libraries from MSYS2 is useful as it provides unified configuration on Windows as Unix-like systems. By defining proper IMAGE_MAGICK_* env vars it's almost possible with magick-rust, and we just need to address the following issues:

  1. Unlike in VisualMagick, magick-baseconfig.h generated on MSYS2 doesn't have MAGICKCORE_HDRI_ENABLE and MAGICKCORE_QUANTUM_DEPTH defined. So we should make sure MagickCore-config can be called using MSYS2's shell during compilation. One easy way is launch cmd /C bash MagickCore-config --cppflags to work around Rust's default behavior.
  2. ssize_t is not defined in Visual C++.
  3. MSYS2 uses unconventional extension .dll.a for import libs. Without them it will produce errors like this.

This PR also adds a workflow that runs successfully with the preinstalled MSYS2 from the Windows runner image.

nlfiedler commented 7 months ago

Sorry for the delay, thanks for your help.