-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathCopyNativeLibraries.targets
86 lines (80 loc) · 5 KB
/
CopyNativeLibraries.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)Common.targets" Condition=" '$(ManagedOSVRCommon)' == '' "/>
<!-- Set up default settings for native libraries, can override at any level -->
<PropertyGroup>
<!-- Source locations -->
<NativeRoot Condition=" '$(NativeRoot)' == '' ">$(ManagedOSVRRoot)osvr-core-snapshots</NativeRoot>
<NativeBinSubdir Condition=" '$(NativeBinSubdir)' == '' ">bin</NativeBinSubdir>
<NativeRoot32 Condition=" '$(NativeRoot32)' == '' ">$(NativeRoot)\32</NativeRoot32>
<NativeRoot64 Condition=" '$(NativeRoot64)' == '' ">$(NativeRoot)\64</NativeRoot64>
<NativeBinDir32 Condition=" '$(NativeBinDir32)' == '' ">$(NativeRoot32)\$(NativeBinSubdir)</NativeBinDir32>
<NativeBinDir64 Condition=" '$(NativeBinDir64)' == '' ">$(NativeRoot64)\$(NativeBinSubdir)</NativeBinDir64>
<!-- Output information/locations -->
<NativeOutputSuffix32 Condition=" '$(NativeOutputSuffix32)' == '' "></NativeOutputSuffix32>
<NativeOutputSuffix64 Condition=" '$(NativeOutputSuffix64)' == '' ">x64</NativeOutputSuffix64>
<!-- General Setting -->
<CopyNativeLibraries Condition=" '$(CopyNativeLibraries)' == ''">true</CopyNativeLibraries>
</PropertyGroup>
<!-- Computed output information - cannot override directly, override things above -->
<PropertyGroup>
<OutputPath32>$(OutputPath)</OutputPath32>
<OutputPath32 Condition=" '$(NativeOutputSuffix32)' != '' ">$(OutputPath)\$(NativeOutputSuffix32)</OutputPath32> <!-- Only insert a backslash if we actually have a suffix -->
<OutputPath64>$(OutputPath)</OutputPath64>
<OutputPath64 Condition=" '$(NativeOutputSuffix64)' != '' ">$(OutputPath)\$(NativeOutputSuffix64)</OutputPath64> <!-- Only insert a backslash if we actually have a suffix -->
</PropertyGroup>
<ItemGroup>
<AvailableItemName Include="NativeLibrary"/>
<AvailableItemName Include="NativeMisc"/>
</ItemGroup>
<ItemGroup>
<!-- Native libraries to grab - a transform gets the equivalent for 64-bit -->
<NativeLibrary Include="$(NativeBinDir32)\osvrClient.dll;
$(NativeBinDir32)\osvrClientKit.dll;
$(NativeBinDir32)\osvrCommon.dll;
$(NativeBinDir32)\osvrUtil.dll;
$(NativeBinDir32)\osvrClient.dll;
$(NativeBinDir32)\msvcp120.dll;
$(NativeBinDir32)\msvcr120.dll;
$(NativeBinDir32)\osvrConnection.dll;
$(NativeBinDir32)\osvrJointClientKit.dll;
$(NativeBinDir32)\osvrPluginHost.dll;
$(NativeBinDir32)\osvrPluginKit.dll;
$(NativeBinDir32)\osvrServer.dll;
$(NativeBinDir32)\osvrUSBSerial.dll;
$(NativeBinDir32)\osvrVRPNServer.dll">
<Bits>32</Bits>
<DestDir>$(OutputPath32)</DestDir>
</NativeLibrary>
<!-- Things like version, license, etc. -->
<NativeMisc Include="$(NativeRoot32)\*" >
<Bits>32</Bits>
<DestDir>$(OutputPath32)</DestDir>
</NativeMisc>
</ItemGroup>
<ItemGroup>
<NativeLibrary Include="@(NativeLibrary->'$(NativeBinDir64)\%(filename)%(extension)')">
<Bits>64</Bits>
<DestDir>$(OutputPath64)</DestDir>
</NativeLibrary>
<NativeMisc Include="@(NativeMisc->'$(NativeRoot64)\%(filename)%(extension)')">
<Bits>64</Bits>
<DestDir>$(OutputPath64)</DestDir>
</NativeMisc>
</ItemGroup>
<Target Name="CopyNativeLibraries"
Inputs="@(NativeLibrary);@(NativeMisc)"
Outputs="$(OutputPath32);$(OutputPath64);@(NativeLibrary->'%(DestDir)\%(filename)%(extension)');@(NativeMisc->'%(DestDir)\%(filename)%(extension)')"
Condition=" '$(CopyNativeLibraries)' == 'true' ">
<Error Condition="!Exists('$(NativeRoot32)')" Text="Can't find the 32-bit native library root! NativeRoot32=$(NativeRoot32)" />
<Error Condition="!Exists('$(NativeBinDir32)')" Text="Can't find the 32-bit native library binary dir! NativeBinDir32=$(NativeBinDir32)" />
<Error Condition="!Exists('$(NativeRoot64)')" Text="Can't find the 64-bit native library root! NativeRoot64=$(NativeRoot64)" />
<Error Condition="!Exists('$(NativeBinDir64)')" Text="Can't find the 64-bit native library binary dir! NativeBinDir64=$(NativeBinDir64)" />
<MakeDir Directories="$(OutputPath32)" Condition="!Exists('$(OutputPath32)')" />
<MakeDir Directories="$(OutputPath64)" Condition="!Exists('$(OutputPath64)')" />
<Message Text="Libraries:%0A%0D@(NativeLibrary->'%(Bits): %(FullPath)', '%0A%0D')" Importance="high" />
<Copy SourceFiles="@(NativeLibrary)" DestinationFolder="%(DestDir)" SkipUnchangedFiles="true" />
<Message Text="Misc files:%0A%0D@(NativeMisc->'%(Bits): %(FullPath)', '%0A%0D')" Importance="high" />
<Copy SourceFiles="@(NativeMisc)" DestinationFolder="%(DestDir)" SkipUnchangedFiles="true" />
</Target>
</Project>