forked from dotnet/TorchSharp
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDirectory.Build.targets
37 lines (30 loc) · 1.78 KB
/
Directory.Build.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<Project InitialTargets="CheckForBuildTools">
<Target Name="CheckForBuildTools">
<Error Condition="!Exists('$(ToolsDir)')"
Text="The tools directory [$(ToolsDir)] does not exist. Please run build in the root of the repo to ensure the tools are installed before attempting to build an individual project." />
</Target>
<Target Name="CopyNativeAssemblies"
BeforeTargets="PrepareForRun">
<PropertyGroup>
<LibPrefix Condition="'$(OS)' != 'Windows_NT' OR '$(AssumeOS)' != 'windows'">lib</LibPrefix>
<LibExtension Condition="'$(OS)' == 'Windows_NT' OR '$(AssumeOS)' == 'windows'">.dll</LibExtension>
<LibExtension Condition="'$(OS)' != 'Windows_NT' OR '$(AssumeOS)' == 'linux'">.so</LibExtension>
<LibExtension Condition="$([MSBuild]::IsOSPlatform('osx')) OR '$(AssumeOS)' == 'mac'">.dylib</LibExtension>
</PropertyGroup>
<ItemGroup>
<NativeAssemblyReference>
<FullAssemblyPath>$(NativeOutputPath)$(LibPrefix)%(NativeAssemblyReference.Identity)$(LibExtension)%(NativeAssemblyReference.ExtraExtension)</FullAssemblyPath>
</NativeAssemblyReference>
</ItemGroup>
<Copy SourceFiles = "@(NativeAssemblyReference->'%(FullAssemblyPath)')"
DestinationFolder="$(OutputPath)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
</Target>
<Import Project="$(ToolsDir)/versioning.targets" Condition="Exists('$(ToolsDir)/versioning.targets')" />
</Project>