|
15 | 15 | </ItemGroup> |
16 | 16 |
|
17 | 17 | <PropertyGroup> |
18 | | - <MLXSharpMacNativeBinary Condition="'$(MLXSharpMacNativeBinary)' == ''">$(MSBuildProjectDirectory)..\..\native\build\libmlxsharp.dylib</MLXSharpMacNativeBinary> |
19 | | - <MLXSharpMacNativeDestination>..\MLXSharp.Native\runtimes\osx-arm64\native\libmlxsharp.dylib</MLXSharpMacNativeDestination> |
| 18 | + <MLXSharpProjectDirectory>$(MSBuildThisFileDirectory)</MLXSharpProjectDirectory> |
| 19 | + <MLXSharpNativeRuntimeRoot>$(MLXSharpProjectDirectory)..\MLXSharp.Native\runtimes</MLXSharpNativeRuntimeRoot> |
| 20 | + <MLXSharpMacNativeBinary Condition="'$(MLXSharpMacNativeBinary)' == ''">$(MLXSharpProjectDirectory)..\..\native\build\libmlxsharp.dylib</MLXSharpMacNativeBinary> |
| 21 | + <MLXSharpMacNativeDestination>$(MLXSharpNativeRuntimeRoot)\osx-arm64\native\libmlxsharp.dylib</MLXSharpMacNativeDestination> |
| 22 | + <MLXSharpMacNativeDestinationDir>$([System.IO.Path]::GetDirectoryName('$(MLXSharpMacNativeDestination)'))</MLXSharpMacNativeDestinationDir> |
20 | 23 | <MLXSharpSkipMacNativeValidation Condition="'$(MLXSharpSkipMacNativeValidation)' == ''">false</MLXSharpSkipMacNativeValidation> |
21 | 24 | </PropertyGroup> |
22 | 25 |
|
|
28 | 31 | Condition="Exists('$(MLXSharpMacNativeBinary)')" /> |
29 | 32 | </ItemGroup> |
30 | 33 |
|
| 34 | + <MakeDir Directories="$(MLXSharpMacNativeDestinationDir)" |
| 35 | + Condition="'$(MLXSharpMacNativeDestinationDir)' != ''" /> |
| 36 | + |
31 | 37 | <Copy SourceFiles="@(_MacNativeSource)" |
32 | 38 | DestinationFiles="$(MLXSharpMacNativeDestination)" |
33 | 39 | SkipUnchangedFiles="true" |
34 | 40 | Condition="'@(_MacNativeSource)' != ''" /> |
35 | 41 |
|
| 42 | + <ItemGroup> |
| 43 | + <None Include="$(MLXSharpMacNativeDestination)" |
| 44 | + Condition="Exists('$(MLXSharpMacNativeDestination)')"> |
| 45 | + <Pack>true</Pack> |
| 46 | + <PackagePath>runtimes/osx-arm64/native/%(Filename)%(Extension)</PackagePath> |
| 47 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
| 48 | + <Link>runtimes\osx-arm64\native\%(Filename)%(Extension)</Link> |
| 49 | + </None> |
| 50 | + </ItemGroup> |
| 51 | + |
36 | 52 | <Error Condition="'$(MLXSharpSkipMacNativeValidation)' != 'true' and !Exists('$(MLXSharpMacNativeDestination)')" |
37 | 53 | Text="libmlxsharp.dylib is missing. Build the native library or supply MLXSharpMacNativeBinary before packing." /> |
38 | 54 | </Target> |
|
0 commit comments