@@ -100,12 +100,24 @@ public partial class MainForm : Form
100
100
@"OpenCvSharp.WpfExtensions\OpenCvSharp.WpfExtensions.xml" ,
101
101
} ;
102
102
103
- private static readonly Dictionary < string , string [ ] > platforms = new Dictionary < string , string [ ] >
103
+ private static readonly IReadOnlyDictionary < string , string [ ] > architectures = new Dictionary < string , string [ ] >
104
104
{
105
105
[ "win" ] = new [ ] { "x86" , "x64" } ,
106
106
[ "uwp" ] = new [ ] { "x86" , "x64" , "ARM" } ,
107
107
} ;
108
108
109
+ private static readonly IReadOnlyDictionary < string , string > uwpNativeDllDirectories = new Dictionary < string , string >
110
+ {
111
+ [ "x86" ] = @"opencv_files\opencv451_uwp_x86\x86\vc16\bin" ,
112
+ [ "x64" ] = @"opencv_files\opencv451_uwp_x64\x64\vc16\bin" ,
113
+ [ "ARM" ] = @"opencv_files\opencv451_uwp_ARM\x86\vc16\bin" ,
114
+ } ;
115
+ private static readonly IReadOnlyList < string > uwpNativeDlls = new [ ]
116
+ {
117
+ "opencv_world451.dll" ,
118
+ "opencv_img_hash451.dll"
119
+ } ;
120
+
109
121
private static readonly string [ ] languages = {
110
122
"Release" ,
111
123
"Release-JP"
@@ -244,23 +256,38 @@ private void MakeBinaryPackage(string dir, string dirDst, string opencvVersion)
244
256
}
245
257
246
258
// OpenCvSharpExtern.dllを、Windows用とUWP用それぞれで、x86/x64それぞれを入れる
247
- foreach ( var p in platforms )
259
+ foreach ( var p in architectures )
248
260
{
249
- foreach ( var pf in p . Value )
261
+ foreach ( var arch in p . Value )
250
262
{
251
263
var externDir = Path . Combine ( dirSrc , "Release" ) ;
252
264
if ( p . Key == "uwp" )
253
265
externDir = Path . Combine ( externDir , "uwpOpenCvSharpExtern" ) ;
254
- var pfExtern = ( pf == "x86" ) ? "Win32" : "x64" ;
266
+ var pfExtern = ( arch == "x86" ) ? "Win32" : "x64" ;
255
267
externDir = Path . Combine ( externDir , pfExtern ) ;
256
268
257
269
foreach ( var ext in new [ ] { "dll" , "pdb" } )
258
270
{
259
271
var e = zf . AddFile ( Path . Combine ( externDir , $ "OpenCvSharpExtern.{ ext } ") ) ;
260
272
261
- var dstDirectory = Path . Combine ( "NativeLib" , p . Key , pf ) ;
273
+ var dstDirectory = Path . Combine ( "NativeLib" , p . Key , arch ) ;
262
274
e . FileName = Path . Combine ( dstDirectory , $ "OpenCvSharpExtern.{ ext } ") ;
263
275
}
276
+
277
+ // UWPはopencv_world.dll等も入れる
278
+ if ( p . Key == "uwp" )
279
+ {
280
+ var uwpNativeDllDir = uwpNativeDllDirectories [ arch ] ;
281
+ uwpNativeDllDir = Path . Combine ( dir , uwpNativeDllDir ) ;
282
+ foreach ( var dllName in uwpNativeDlls )
283
+ {
284
+ var uwpNativeDll = Path . Combine ( uwpNativeDllDir , dllName ) ;
285
+ var e = zf . AddFile ( uwpNativeDll ) ;
286
+
287
+ var dstDirectory = Path . Combine ( "NativeLib" , "uwp" , arch ) ;
288
+ e . FileName = Path . Combine ( dstDirectory , dllName ) ;
289
+ }
290
+ }
264
291
}
265
292
}
266
293
0 commit comments