-
Notifications
You must be signed in to change notification settings - Fork 0
/
Crosscompile.targets
51 lines (43 loc) · 2 KB
/
Crosscompile.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
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IlcUseEnvironmentalTools>true</IlcUseEnvironmentalTools>
<DisableUnsupportedError>true</DisableUnsupportedError>
<MSVCWineBinPath Condition="'$(MSVCWineBinPath)' == ''">/opt/msvc/bin</MSVCWineBinPath>
</PropertyGroup>
<UsingTask TaskName="PrependPath"
TaskFactory="RoslynCodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<Value ParameterType="System.String" Required="true"/>
</ParameterGroup>
<Task>
<Using Namespace="System"/>
<Using Namespace="System.IO"/>
<Code Type="Fragment" Language="cs">
<![CDATA[
Environment.SetEnvironmentVariable("PATH", Value + Path.PathSeparator + Environment.GetEnvironmentVariable("PATH"));
]]>
</Code>
</Task>
</UsingTask>
<Target Name="SetPathToClang"
BeforeTargets="SetupOSSpecificProps">
<PrependPath Value="$(MSVCWineBinPath)/$(_targetArchitecture)"/>
</Target>
<Target Name="OverwriteTargetTriple"
AfterTargets="SetupOSSpecificProps"
BeforeTargets="LinkNative">
<ItemGroup>
<LinkerArg Include="@(LinkerArg->'%(Identity)')">
<UpdatePath Condition="$([System.String]::Copy(%(Identity)).StartsWith('/home/'))">"Z:%(Identity)"</UpdatePath>
<UpdatePath Condition="$([System.String]::Copy(%(Identity)).StartsWith('/home/')) == false">%(Identity)</UpdatePath>
</LinkerArg>
<NewLinkerArg Include="@(LinkerArg->'%(UpdatePath)')"/>
<LinkerArg Remove="@(LinkerArg)"/>
<LinkerArg Include="@(NewLinkerArg)"/>
</ItemGroup>
<PropertyGroup>
<NativeObject Condition="$(NativeObject.StartsWith('/home/'))">Z:$(NativeObject)</NativeObject>
</PropertyGroup>
</Target>
</Project>