@@ -74,7 +74,9 @@ impl BuildTargets {
74
74
None
75
75
} ;
76
76
77
- let Some ( file_names) = FileNames :: from_target ( target, name, targetdir) else {
77
+ let Some ( file_names) =
78
+ FileNames :: from_target ( target, name, targetdir, use_meson_naming_convention)
79
+ else {
78
80
return Err ( anyhow:: anyhow!(
79
81
"The target {}-{} is not supported yet" ,
80
82
target. os,
@@ -145,7 +147,12 @@ struct FileNames {
145
147
}
146
148
147
149
impl FileNames {
148
- fn from_target ( target : & Target , lib_name : & str , targetdir : & Path ) -> Option < Self > {
150
+ fn from_target (
151
+ target : & Target ,
152
+ lib_name : & str ,
153
+ targetdir : & Path ,
154
+ use_meson_naming_convention : bool ,
155
+ ) -> Option < Self > {
149
156
let ( shared_lib, static_lib, impl_lib, debug_info, def) = match target. os . as_str ( ) {
150
157
"none" | "linux" | "freebsd" | "dragonfly" | "netbsd" | "android" | "haiku"
151
158
| "illumos" | "openbsd" | "emscripten" | "hurd" => {
@@ -164,13 +171,19 @@ impl FileNames {
164
171
165
172
if target. env == "msvc" {
166
173
let static_lib = targetdir. join ( format ! ( "{lib_name}.lib" ) ) ;
167
- let impl_lib = targetdir. join ( format ! ( "{lib_name}.dll.lib" ) ) ;
174
+ let impl_lib = match use_meson_naming_convention {
175
+ false => targetdir. join ( format ! ( "{lib_name}.dll.lib" ) ) ,
176
+ true => targetdir. join ( format ! ( "{lib_name}.lib" ) ) ,
177
+ } ;
168
178
let pdb = Some ( targetdir. join ( format ! ( "{lib_name}.pdb" ) ) ) ;
169
179
170
180
( shared_lib, static_lib, Some ( impl_lib) , pdb, Some ( def) )
171
181
} else {
172
182
let static_lib = targetdir. join ( format ! ( "lib{lib_name}.a" ) ) ;
173
- let impl_lib = targetdir. join ( format ! ( "{lib_name}.dll.a" ) ) ;
183
+ let impl_lib = match use_meson_naming_convention {
184
+ false => targetdir. join ( format ! ( "{lib_name}.dll.a" ) ) ,
185
+ true => targetdir. join ( format ! ( "lib{lib_name}.dll.a" ) ) ,
186
+ } ;
174
187
let pdb = None ;
175
188
176
189
( shared_lib, static_lib, Some ( impl_lib) , pdb, Some ( def) )
@@ -215,7 +228,8 @@ mod test {
215
228
os : os. to_string ( ) ,
216
229
env : String :: from ( "" ) ,
217
230
} ;
218
- let file_names = FileNames :: from_target ( & target, "ferris" , Path :: new ( "/foo/bar" ) ) ;
231
+ let file_names =
232
+ FileNames :: from_target ( & target, "ferris" , Path :: new ( "/foo/bar" ) , false ) ;
219
233
220
234
let expected = FileNames {
221
235
static_lib : PathBuf :: from ( "/foo/bar/libferris.a" ) ,
@@ -238,7 +252,8 @@ mod test {
238
252
os : os. to_string ( ) ,
239
253
env : String :: from ( "" ) ,
240
254
} ;
241
- let file_names = FileNames :: from_target ( & target, "ferris" , Path :: new ( "/foo/bar" ) ) ;
255
+ let file_names =
256
+ FileNames :: from_target ( & target, "ferris" , Path :: new ( "/foo/bar" ) , false ) ;
242
257
243
258
let expected = FileNames {
244
259
static_lib : PathBuf :: from ( "/foo/bar/libferris.a" ) ,
@@ -260,7 +275,7 @@ mod test {
260
275
os : String :: from ( "windows" ) ,
261
276
env : String :: from ( "msvc" ) ,
262
277
} ;
263
- let file_names = FileNames :: from_target ( & target, "ferris" , Path :: new ( "/foo/bar" ) ) ;
278
+ let file_names = FileNames :: from_target ( & target, "ferris" , Path :: new ( "/foo/bar" ) , false ) ;
264
279
265
280
let expected = FileNames {
266
281
static_lib : PathBuf :: from ( "/foo/bar/ferris.lib" ) ,
@@ -281,7 +296,7 @@ mod test {
281
296
os : String :: from ( "windows" ) ,
282
297
env : String :: from ( "gnu" ) ,
283
298
} ;
284
- let file_names = FileNames :: from_target ( & target, "ferris" , Path :: new ( "/foo/bar" ) ) ;
299
+ let file_names = FileNames :: from_target ( & target, "ferris" , Path :: new ( "/foo/bar" ) , false ) ;
285
300
286
301
let expected = FileNames {
287
302
static_lib : PathBuf :: from ( "/foo/bar/libferris.a" ) ,
0 commit comments