107 lines
6.3 KiB
XML
107 lines
6.3 KiB
XML
<!--
|
|
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">
|
|
<UsingTask TaskName="MonoGame.Build.Tasks.CollectContentReferences" AssemblyFile="MonoGame.Build.Tasks.dll" />
|
|
<!-- 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>
|
|
<!-- 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'">$(MonoMacResourcePrefix)</PlatformResourcePrefix>
|
|
<PlatformResourcePrefix Condition="'$(MonoGamePlatform)' == 'iOS'">$(IPhoneResourcePrefix)</PlatformResourcePrefix>
|
|
<PlatformResourcePrefix Condition="'$(MonoGamePlatform)' == 'Android'">$(MonoAndroidAssetsPrefix)</PlatformResourcePrefix>
|
|
<PlatformResourcePrefix Condition="'$(PlatformResourcePrefix)' != '' And !HasTrailingSlash('$(PlatformResourcePrefix)')">$(PlatformResourcePrefix)\</PlatformResourcePrefix>
|
|
<PlatformResourcePrefix Condition="'$(PlatformResourcePrefix)' == ''"></PlatformResourcePrefix>
|
|
<MonoGameMGCBAdditionalArguments Condition="'$(MonoGameMGCBAdditionalArguments)' ==''">/quiet</MonoGameMGCBAdditionalArguments>
|
|
<Header>/platform:$(MonoGamePlatform)</Header>
|
|
</PropertyGroup>
|
|
|
|
<!-- Get all Mono Game Content References and store them in a list -->
|
|
<!-- We do this here so we are compatible with xbuild -->
|
|
<CollectContentReferences ContentReferences="@(MonoGameContentReference)" MonoGamePlatform="$(MonoGamePlatform)">
|
|
<Output TaskParameter="Output" ItemName="ContentReferences"/>
|
|
</CollectContentReferences>
|
|
|
|
<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, Ouya, NativeClient, PlayStation4, PSVita, XboxOne 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="%(ContentReferences.ContentOutputDir)"/>
|
|
<MakeDir Directories="%(ContentReferences.ContentIntermediateOutputDir)"/>
|
|
|
|
</Target>
|
|
|
|
<PropertyGroup>
|
|
<BuildDependsOn>
|
|
BuildContent;
|
|
$(BuildDependsOn);
|
|
</BuildDependsOn>
|
|
</PropertyGroup>
|
|
|
|
<Target Name="RunContentBuilder">
|
|
<Exec Condition=" '%(ContentReferences.FullPath)' != '' "
|
|
Command="$(MonoGameContentBuilderCmd) $(MonoGameMGCBAdditionalArguments) $(Header) /@:"%(ContentReferences.FullPath)" /outputDir:"%(ContentReferences.ContentOutputDir)" /intermediateDir:"%(ContentReferences.ContentIntermediateOutputDir)""
|
|
WorkingDirectory="%(ContentReferences.RootDir)%(ContentReferences.Directory)" />
|
|
<CreateItem Include="%(ContentReferences.RelativeFullPath)%(ContentReferences.ContentOutputDir)\**\*.*"
|
|
AdditionalMetadata="ContentOutputDir=%(ContentReferences.ContentDirectory)">
|
|
<Output TaskParameter="Include" ItemName="ExtraContent" />
|
|
</CreateItem>
|
|
</Target>
|
|
|
|
<Target Name="BuildContent" DependsOnTargets="Prepare;RunContentBuilder"
|
|
Condition=" '@(MonoGameContentReference)' != '' "
|
|
Outputs="%(ExtraContent.RecursiveDir)%(ExtraContent.Filename)%(ExtraContent.Extension)">
|
|
|
|
<CreateItem Include="%(ExtraContent.FullPath)"
|
|
AdditionalMetadata="Link=$(PlatformResourcePrefix)%(ExtraContent.ContentOutputDir)%(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>
|