forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MonoGame.Content.Builder.targets
109 lines (88 loc) · 5.83 KB
/
MonoGame.Content.Builder.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!--
MonoGame - Copyright (C) The MonoGame Team
This file is subject to the terms and conditions defined in
file 'LICENSE.txt', which is part of this source code package.
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Add MonoGameContentReference to item type selection in Visual Studio -->
<ItemGroup>
<AvailableItemName Include="MonoGameContentReference" />
</ItemGroup>
<!-- This disables the IDE feature that skips executing msbuild in some build situations. -->
<PropertyGroup>
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup>
<Target Name="Prepare">
<PropertyGroup>
<ContentRootDirectory Condition=" '$(ContentRootDirectory)' == '' " >Content</ContentRootDirectory>
<ParentOutputDir Condition=" '$(ParentOutputDir)' == '' " >$(ProjectDir)$(ContentRootDirectory)\bin\$(MonoGamePlatform)</ParentOutputDir>
<ParentIntermediateDir Condition=" '$(ParentIntermediateDir)' == '' " >$(ProjectDir)$(ContentRootDirectory)\obj\$(MonoGamePlatform)</ParentIntermediateDir>
<!-- El Capitan Support -->
<MonoExe Condition=" '$(OS)' != 'Windows_NT' And Exists ('/Library/Frameworks/Mono.framework/Versions/Current/bin/mono') ">/Library/Frameworks/Mono.framework/Versions/Current/bin/mono</MonoExe>
<MonoExe Condition=" '$(OS)' != 'Windows_NT' And Exists ('/usr/local/bin/mono') ">/usr/local/bin/mono</MonoExe>
<MonoExe Condition=" '$(OS)' != 'Windows_NT' And Exists ('/usr/bin/mono') ">/usr/bin/mono</MonoExe>
<MonoExe Condition=" '$(OS)' != 'Windows_NT' And '$(MonoExe)' == '' ">mono</MonoExe>
<MonoGameContentBuilderExe Condition="'$(MonoGameContentBuilderExe)' == ''">$(MSBuildThisFileDirectory)Tools\MGCB.exe</MonoGameContentBuilderExe>
<MonoGameContentBuilderCmd>"$(MonoGameContentBuilderExe)"</MonoGameContentBuilderCmd>
<MonoGameContentBuilderCmd Condition=" '$(OS)' != 'Windows_NT' ">$(MonoExe) $(MonoGameContentBuilderCmd)</MonoGameContentBuilderCmd>
<PlatformResourcePrefix Condition="'$(MonoGamePlatform)' == 'MacOSX' Or '$(MonoGamePlatform)' == 'iOS'">Resources\</PlatformResourcePrefix>
<PlatformResourcePrefix Condition="'$(MonoGamePlatform)' == 'Android'">Assets\</PlatformResourcePrefix>
<PlatformResourcePrefix Condition="'$(PlatformResourcePrefix)' == ''"></PlatformResourcePrefix>
<Header>/platform:$(MonoGamePlatform) /outputDir:"$(ParentOutputDir)" /intermediateDir:"$(ParentIntermediateDir)" /quiet</Header>
</PropertyGroup>
<!-- Get all Mono Game Content References and store them in a list -->
<!-- We do this here so we are compatible with xbuild -->
<ItemGroup>
<ContentReferences Include="@(MonoGameContentReference)"/>
</ItemGroup>
<Error Text="The MonoGamePlatform property was not defined in the project! It must be set to Windows, WindowsGL, WindowsStoreApp, WindowsPhone8, MacOSX, iOS, Linux, DesktopGL, RaspberryPi, Android, NativeClient, PlayStation4, or PlayStationMobile."
Condition=" '$(MonoGamePlatform)' != 'Windows' And
'$(MonoGamePlatform)' != 'iOS' And
'$(MonoGamePlatform)' != 'Android' And
'$(MonoGamePlatform)' != 'Linux' And
'$(MonoGamePlatform)' != 'DesktopGL' And
'$(MonoGamePlatform)' != 'MacOSX' And
'$(MonoGamePlatform)' != 'WindowsStoreApp' And
'$(MonoGamePlatform)' != 'NativeClient' And
'$(MonoGamePlatform)' != 'PlayStationMobile' And
'$(MonoGamePlatform)' != 'WindowsPhone8' And
'$(MonoGamePlatform)' != 'RaspberryPi' And
'$(MonoGamePlatform)' != 'PlayStation4' And
'$(MonoGamePlatform)' != 'PSVita' And
'$(MonoGamePlatform)' != 'XboxOne' And
'$(MonoGamePlatform)' != 'WindowsGL'" />
<Error
Text="The MonoGame content builder executable could not be located at '$(MonoGameContentBuilderExe)'!"
Condition="!Exists('$(MonoGameContentBuilderExe)')"
/>
<Warning
Text="No Content References Found. Please make sure your .mgcb file has a build action of MonoGameContentReference"
Condition=" '%(ContentReferences.FullPath)' == '' "
/>
<MakeDir Directories="$(ParentIntermediateDir)"/>
<MakeDir Directories="$(ParentOutputDir)"/>
</Target>
<PropertyGroup>
<BuildDependsOn>
BuildContent;
$(BuildDependsOn);
</BuildDependsOn>
</PropertyGroup>
<Target Name="RunContentBuilder">
<Exec Condition=" '%(ContentReferences.FullPath)' != '' " Command="$(MonoGameContentBuilderCmd) /@:"%(ContentReferences.FullPath)" $(Header)"
WorkingDirectory="%(ContentReferences.RootDir)%(ContentReferences.Directory)" />
<CreateItem Include="$(ParentOutputDir)\**\*.*">
<Output TaskParameter="Include" ItemName="ExtraContent" />
</CreateItem>
</Target>
<Target Name="BuildContent" DependsOnTargets="Prepare;RunContentBuilder"
Outputs="%(ExtraContent.RecursiveDir)%(ExtraContent.Filename)%(ExtraContent.Extension)">
<CreateItem Include="$(ParentOutputDir)\%(ExtraContent.RecursiveDir)%(ExtraContent.Filename)%(ExtraContent.Extension)"
AdditionalMetadata="Link=$(PlatformResourcePrefix)$(ContentRootDirectory)\%(ExtraContent.RecursiveDir)%(ExtraContent.Filename)%(ExtraContent.Extension);CopyToOutputDirectory=PreserveNewest"
Condition="'%(ExtraContent.Filename)' != ''">
<Output TaskParameter="Include" ItemName="Content" Condition="'$(MonoGamePlatform)' != 'Android' And '$(MonoGamePlatform)' != 'iOS' And '$(MonoGamePlatform)' != 'MacOSX'" />
<Output TaskParameter="Include" ItemName="BundleResource" Condition="'$(MonoGamePlatform)' == 'MacOSX' Or '$(MonoGamePlatform)' == 'iOS'" />
<Output TaskParameter="Include" ItemName="AndroidAsset" Condition="'$(MonoGamePlatform)' == 'Android'" />
</CreateItem>
</Target>
</Project>