@@ -26,6 +26,19 @@ use std::process::Command;
26
26
const MIN_VERSION : & str = "7.0" ;
27
27
const MAX_VERSION : & str = "7.2" ;
28
28
29
+ #[ cfg( windows) ]
30
+ static HEADER : & str = r#"
31
+ #if !defined(ssize_t) && !defined(__MINGW32__)
32
+ #if defined(_WIN64)
33
+ typedef __int64 ssize_t;
34
+ #else
35
+ typedef long ssize_t;
36
+ #endif
37
+ #endif
38
+
39
+ #include <MagickWand/MagickWand.h>
40
+ "# ;
41
+ #[ cfg( not( windows) ) ]
29
42
static HEADER : & str = "#include <MagickWand/MagickWand.h>\n " ;
30
43
31
44
//on windows path env always contain : like c:
@@ -35,7 +48,18 @@ pub const PATH_SEPARATOR: &str = match cfg!(target_os = "windows") {
35
48
} ;
36
49
37
50
fn main ( ) {
38
- let check_cppflags = Command :: new ( "MagickCore-config" ) . arg ( "--cppflags" ) . output ( ) ;
51
+ let check_cppflags = if cfg ! ( target_os = "windows" ) {
52
+ // Resolve bash from directories listed in the PATH environment variable in the
53
+ // order they appear.
54
+ Command :: new ( "cmd" )
55
+ . arg ( "/C" )
56
+ . arg ( "bash" )
57
+ . arg ( "MagickCore-config" )
58
+ . arg ( "--cppflags" )
59
+ . output ( )
60
+ } else {
61
+ Command :: new ( "MagickCore-config" ) . arg ( "--cppflags" ) . output ( )
62
+ } ;
39
63
if let Ok ( ok_cppflags) = check_cppflags {
40
64
let cppflags = ok_cppflags. stdout ;
41
65
let cppflags = String :: from_utf8 ( cppflags) . unwrap ( ) ;
@@ -236,6 +260,11 @@ fn determine_mode<T: AsRef<str>>(libdirs: &Vec<PathBuf>, libs: &[T]) -> &'static
236
260
( true , false ) => return "static" ,
237
261
( false , true ) => return "dylib" ,
238
262
( false , false ) => {
263
+ let can_static_verbatim = libs. iter ( ) . all ( |l| files. contains ( l. as_ref ( ) ) ) ;
264
+ if can_static_verbatim {
265
+ return "static:+verbatim" ;
266
+ }
267
+
239
268
panic ! (
240
269
"ImageMagick libdirs at `{:?}` do not contain the required files \
241
270
to either statically or dynamically link ImageMagick",
0 commit comments