File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -307,7 +307,21 @@ impl Config {
307
307
// studio build system but instead use makefiles that MinGW can
308
308
// use to build.
309
309
if self . generator . is_none ( ) {
310
- cmd. arg ( "-G" ) . arg ( "MSYS Makefiles" ) ;
310
+ // If make.exe isn't found, that means we may be using a MinGW
311
+ // toolchain instead of a MSYS2 toolchain. If neither is found,
312
+ // the build cannot continue.
313
+ let has_msys2 = Command :: new ( "make" ) . spawn ( ) . err ( )
314
+ . map ( |e| e. kind ( ) != ErrorKind :: NotFound ) . unwrap_or ( true ) ;
315
+ let has_mingw32 = Command :: new ( "mingw32-make" ) . spawn ( ) . err ( )
316
+ . map ( |e| e. kind ( ) != ErrorKind :: NotFound ) . unwrap_or ( true ) ;
317
+
318
+ let generator = match ( has_msys2, has_mingw32) {
319
+ ( true , _) => "MSYS Makefiles" ,
320
+ ( false , true ) => "MinGW Makefiles" ,
321
+ ( false , false ) => fail ( "no valid generator found for GNU toolchain; MSYS or MinGW must be installed" )
322
+ } ;
323
+
324
+ cmd. arg ( "-G" ) . arg ( generator) ;
311
325
}
312
326
} else {
313
327
// If we're cross compiling onto windows, then set some
You can’t perform that action at this time.
0 commit comments