@@ -131,7 +131,9 @@ impl BuildTargets {
131131 pub fn shared_output_file_name ( & self ) -> Option < OsString > {
132132 match self . lib_type ( ) {
133133 LibType :: Windows => {
134- if self . shared_lib . is_some ( )
134+ if self . target . os == "cygwin" {
135+ Some ( format ! ( "cyg{}.dll" , self . name) . into ( ) )
136+ } else if self . shared_lib . is_some ( )
135137 && self . use_meson_naming_convention
136138 && self . target . env == "gnu"
137139 {
@@ -174,7 +176,7 @@ impl FileNames {
174176 let pdb = Some ( targetdir. join ( format ! ( "lib{lib_name}.dSYM" ) ) ) ;
175177 ( shared_lib, static_lib, None , pdb, None )
176178 }
177- "windows" => {
179+ "windows" | "cygwin" => {
178180 let shared_lib = targetdir. join ( format ! ( "{lib_name}.dll" ) ) ;
179181 let def = targetdir. join ( format ! ( "{lib_name}.def" ) ) ;
180182
@@ -190,7 +192,7 @@ impl FileNames {
190192 ( shared_lib, static_lib, Some ( impl_lib) , pdb, Some ( def) )
191193 } else {
192194 let static_lib = targetdir. join ( format ! ( "lib{lib_name}.a" ) ) ;
193- let impl_lib = if use_meson_naming_convention {
195+ let impl_lib = if use_meson_naming_convention || target . os == "cygwin" {
194196 targetdir. join ( format ! ( "lib{lib_name}.dll.a" ) )
195197 } else {
196198 targetdir. join ( format ! ( "{lib_name}.dll.a" ) )
@@ -326,4 +328,27 @@ mod test {
326328
327329 assert_eq ! ( file_names. unwrap( ) , expected) ;
328330 }
331+
332+ #[ test]
333+ fn cygwin ( ) {
334+ let target = Target {
335+ is_target_overridden : false ,
336+ arch : String :: from ( "" ) ,
337+ os : String :: from ( "cygwin" ) ,
338+ env : String :: from ( "" ) ,
339+ cfg : Vec :: new ( ) ,
340+ target : None ,
341+ } ;
342+ let file_names = FileNames :: from_target ( & target, "ferris" , Path :: new ( "/foo/bar" ) , false ) ;
343+
344+ let expected = FileNames {
345+ static_lib : PathBuf :: from ( "/foo/bar/libferris.a" ) ,
346+ shared_lib : PathBuf :: from ( "/foo/bar/ferris.dll" ) ,
347+ impl_lib : Some ( PathBuf :: from ( "/foo/bar/libferris.dll.a" ) ) ,
348+ debug_info : None ,
349+ def : Some ( PathBuf :: from ( "/foo/bar/ferris.def" ) ) ,
350+ } ;
351+
352+ assert_eq ! ( file_names. unwrap( ) , expected) ;
353+ }
329354}
0 commit comments