mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 18:31:59 -05:00
f894c71dbf
Breakpad is no longer in dependencies. This is because it is difficult to build and is soon to be removed anyway.
303 lines
15 KiB
XML
303 lines
15 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- Main msbuild project for OpenRCT2 -->
|
|
<!-- Inputs (/p: or environment variables)
|
|
- OPENRCT2_BUILD_SERVER
|
|
- GIT_TAG
|
|
- GIT_BRANCH
|
|
- GIT_COMMIT_SHA1
|
|
- SIGN_PASSWORD
|
|
- OPENRCT2_ORG_TOKEN
|
|
- NO_NSIS: set to true to prevent the NSIS installer building
|
|
-->
|
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="PublishAll">
|
|
<!-- Import custom build tasks -->
|
|
<Import Project="openrct2.targets" />
|
|
|
|
<PropertyGroup>
|
|
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
|
|
<Platform Condition="'$(PLATFORM)'==''">x64</Platform>
|
|
<GIT_COMMIT_SHA1_SHORT Condition="'$(GIT_COMMIT_SHA1)'!=''">$(GIT_COMMIT_SHA1.Substring(0, 7))</GIT_COMMIT_SHA1_SHORT>
|
|
|
|
<Version>0.1.2</Version>
|
|
<VersionExtra Condition="'$(GIT_BRANCH)'!=''">-$(GIT_BRANCH)-$(GIT_COMMIT_SHA1_SHORT)</VersionExtra>
|
|
<VersionExtra Condition="'$(GIT_TAG)'!=''"></VersionExtra>
|
|
<TargetLibsVersion>13</TargetLibsVersion>
|
|
|
|
<!-- Set dynamic OpenRCT2 #defines -->
|
|
<OPENRCT2_CL_ADDITIONALOPTIONS Condition="'$(BUILD_SERVER)'!=''">/D "OPENRCT2_BUILD_SERVER=\"$(BUILD_SERVER)\"" $(OPENRCT2_CL_ADDITIONALOPTIONS)</OPENRCT2_CL_ADDITIONALOPTIONS>
|
|
<OPENRCT2_CL_ADDITIONALOPTIONS Condition="'$(GIT_BRANCH)'!=''">/D "OPENRCT2_BRANCH=\"$(GIT_BRANCH)\"" $(OPENRCT2_CL_ADDITIONALOPTIONS)</OPENRCT2_CL_ADDITIONALOPTIONS>
|
|
<OPENRCT2_CL_ADDITIONALOPTIONS Condition="'$(GIT_COMMIT_SHA1)'!=''">/D "OPENRCT2_COMMIT_SHA1=\"$(GIT_COMMIT_SHA1)\"" $(OPENRCT2_CL_ADDITIONALOPTIONS)</OPENRCT2_CL_ADDITIONALOPTIONS>
|
|
<OPENRCT2_CL_ADDITIONALOPTIONS Condition="'$(GIT_COMMIT_SHA1_SHORT)'!=''">/D "OPENRCT2_COMMIT_SHA1_SHORT=\"$(GIT_COMMIT_SHA1_SHORT)\"" $(OPENRCT2_CL_ADDITIONALOPTIONS)</OPENRCT2_CL_ADDITIONALOPTIONS>
|
|
|
|
<RootDir>$(MsBuildThisFileDirectory)</RootDir>
|
|
<DistDir>$(RootDir)distribution\</DistDir>
|
|
<ArtifactsDir>$(RootDir)artifacts\</ArtifactsDir>
|
|
<TargetDir>$(RootDir)bin\</TargetDir>
|
|
|
|
<NsisScript>$(DistDir)windows\install.nsi</NsisScript>
|
|
|
|
<OutputExe>$(TargetDir)openrct2.exe</OutputExe>
|
|
<OutputCom>$(TargetDir)openrct2.com</OutputCom>
|
|
<OutputDll>$(TargetDir)openrct2.dll</OutputDll>
|
|
<g2Output>$(TargetDir)data\g2.dat</g2Output>
|
|
|
|
<SignCertificate Condition="'$(SignCertificate)'==''">$(DistDir)windows\code-sign-key-openrct2.org.pfx</SignCertificate>
|
|
<SignTimestampUrl>http://timestamp.comodoca.com/authenticode</SignTimestampUrl>
|
|
|
|
<PublishPostfix>-$(Configuration)-$(Platform)</PublishPostfix>
|
|
<PublishPostfix Condition="'$(GIT_COMMIT_SHA1_SHORT)'!=''">$(PublishPostfix)-$(GIT_COMMIT_SHA1_SHORT)</PublishPostfix>
|
|
<PublishPostfix>$(PublishPostfix.ToLower())</PublishPostfix>
|
|
<PublishZip>$(ArtifactsDir)openrct2-portable$(PublishPostfix).zip</PublishZip>
|
|
<PublishSymbolsZip Condition="'$(GIT_COMMIT_SHA1_SHORT)'==''">$(ArtifactsDir)openrct2-symbols$(PublishPostfix).zip</PublishSymbolsZip>
|
|
<PublishSymbolsZip Condition="'$(GIT_COMMIT_SHA1_SHORT)'!=''">$(ArtifactsDir)openrct2-symbols$(PublishPostfix).zip</PublishSymbolsZip>
|
|
<PublishInstallerExe>$(ArtifactsDir)openrct2-installer$(PublishPostfix).exe</PublishInstallerExe>
|
|
|
|
<UploadFilename>OpenRCT2-$(Version)$(VersionExtra)-windows-$(Platform.ToLower())</UploadFilename>
|
|
|
|
<!-- Set openrct2.sln properties -->
|
|
<SlnProperties>$(SlnProperties);Platform=$(Platform)</SlnProperties>
|
|
<SlnProperties Condition="'$(BUILD_SERVER)'!=''">$(SlnProperties);OPENRCT2_CL_ADDITIONALOPTIONS=$(OPENRCT2_CL_ADDITIONALOPTIONS)</SlnProperties>
|
|
</PropertyGroup>
|
|
|
|
<!-- 3rd party libraries / dependencies -->
|
|
<PropertyGroup>
|
|
<DependenciesCheckFile>$(RootDir).dependencies</DependenciesCheckFile>
|
|
<LibsUrl>https://github.com/OpenRCT2/Dependencies/releases/download/v$(TargetLibsVersion)/openrct2-libs-vs2017.zip</LibsUrl>
|
|
<LibsSha1>00d4eaf3ed7653a1abf82df0c255338fa0d6f9b0</LibsSha1>
|
|
<GtestVersion>1.8.0</GtestVersion>
|
|
<GtestUrl>https://github.com/google/googletest/archive/release-1.8.0.zip</GtestUrl>
|
|
<GtestSha1>667f873ab7a4d246062565fad32fb6d8e203ee73</GtestSha1>
|
|
<TitleSequencesUrl>https://github.com/OpenRCT2/title-sequences/releases/download/v0.1.0/title-sequence-v0.1.0.zip</TitleSequencesUrl>
|
|
<TitleSequencesSha1>b587d83de508d0b104d14c599b76f8565900fce0</TitleSequencesSha1>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<g2Inputs Include="$(RootDir)resources\g2\*" />
|
|
<SignItems Include="$(OutputExe)" />
|
|
<SignItems Include="$(OutputCom)" />
|
|
<SignItems Include="$(OutputDll)" />
|
|
</ItemGroup>
|
|
|
|
<ItemGroup Label="Symbol Items">
|
|
<SymbolItems Include="$(OutputExe)" />
|
|
<SymbolItems Include="$(OutputCom)" />
|
|
<SymbolItems Include="$(OutputDll)" />
|
|
<SymbolItems Include="$(TargetDir)openrct2-dll.pdb" />
|
|
<SymbolItems Include="$(TargetDir)openrct2-win.pdb" />
|
|
</ItemGroup>
|
|
|
|
<ItemGroup Label="Publish Items">
|
|
<PublishItems Include="$(OutputExe)" />
|
|
<PublishItems Include="$(OutputCom)" />
|
|
<PublishItems Include="$(OutputDll)" />
|
|
<PublishItems Include="$(TargetDir)data" />
|
|
<PublishItems Include="$(DistDir)changelog.txt" />
|
|
<PublishItems Include="$(DistDir)readme.txt" />
|
|
<PublishItems Include="$(RootDir)contributors.md" />
|
|
<PublishItems Include="$(RootDir)licence.txt" />
|
|
</ItemGroup>
|
|
|
|
<ItemGroup Label="Upload Artifacts">
|
|
<UploadArtifacts Include="$(PublishZip)">
|
|
<Name>$(UploadFilename).zip</Name>
|
|
<FlavourId Condition="'$(Platform)'=='Win32'">1</FlavourId>
|
|
<FlavourId Condition="'$(Platform)'=='x64'">6</FlavourId>
|
|
</UploadArtifacts>
|
|
<UploadArtifacts Include="$(PublishInstallerExe)">
|
|
<Name>$(UploadFilename).exe</Name>
|
|
<FlavourId Condition="'$(Platform)'=='Win32'">2</FlavourId>
|
|
<FlavourId Condition="'$(Platform)'=='x64'">7</FlavourId>
|
|
</UploadArtifacts>
|
|
<UploadArtifacts Include="$(PublishSymbolsZip)">
|
|
<Name>$(UploadFilename)-symbols.zip</Name>
|
|
<FlavourId Condition="'$(Platform)'=='Win32'">5</FlavourId>
|
|
<FlavourId Condition="'$(Platform)'=='x64'">10</FlavourId>
|
|
</UploadArtifacts>
|
|
</ItemGroup>
|
|
|
|
<Target Name="DownloadLibs">
|
|
<!-- libs -->
|
|
<DownloadDependency Name="Libs"
|
|
Url="$(LibsUrl)"
|
|
Sha1="$(LibsSha1)"
|
|
CheckFile="$(DependenciesCheckFile)"
|
|
OutputDirectory="$(RootDir)lib" />
|
|
|
|
<!-- googletest -->
|
|
<DownloadDependency Name="googletest"
|
|
Url="$(GtestUrl)"
|
|
Sha1="$(GtestSha1)"
|
|
CheckFile="$(DependenciesCheckFile)"
|
|
OutputDirectory="$(RootDir)lib" />
|
|
<PropertyGroup>
|
|
<GtestSrc>$(RootDir)lib\googletest-release-$(GtestVersion)</GtestSrc>
|
|
<GtestDst>$(RootDir)lib\googletest</GtestDst>
|
|
</PropertyGroup>
|
|
<Exec Command="cmd /c "if exist "$(GtestSrc)" ( rmdir /S /Q "$(GtestDst)" 2> nul & move "$(GtestSrc)" "$(GtestDst)" )"" />
|
|
</Target>
|
|
|
|
<Target Name="Clean">
|
|
<PropertyGroup>
|
|
<SlnProperties>$(SlnProperties);Configuration=$(Configuration)</SlnProperties>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<CleanItems Include="$(OutputCom)" />
|
|
<CleanItems Include="$(g2Output)" />
|
|
<CleanItems Include="$(ArtifactsDir)openrct2-installer-$(Configuration)-$(Platform)*.exe" />
|
|
<CleanItems Include="$(ArtifactsDir)openrct2-portable-$(Configuration)-$(Platform)*.zip" />
|
|
<CleanItems Include="$(ArtifactsDir)openrct2-symbols-$(Configuration)-$(Platform)*.zip" />
|
|
</ItemGroup>
|
|
<Delete Files="@(CleanItems)" />
|
|
<Delete Files="%(SignItems.Identity).signed" />
|
|
<RemoveDir Directories="$(TargetDir)data" />
|
|
<MSBuild Projects="openrct2.sln" Targets="Clean" Properties="$(SlnProperties)" />
|
|
</Target>
|
|
|
|
<Target Name="BeforeBuild" BeforeTargets="Build;Rebuild" DependsOnTargets="DownloadLibs">
|
|
<PropertyGroup>
|
|
<BuildString Condition="'$(GIT_COMMIT_SHA1_SHORT)'!=''">$(GIT_COMMIT_SHA1_SHORT)</BuildString>
|
|
<BuildString Condition="'$(GIT_BRANCH)'!=''">$(BuildString) ($(GIT_BRANCH))</BuildString>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<DataItems Include="$(RootDir)data\**\*" />
|
|
</ItemGroup>
|
|
<Message Condition="'$(BuildString)'!=''" Text="Building $(BuildString)" Importance="high" />
|
|
<Copy SourceFiles="@(CopyItems)" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" />
|
|
<Copy SourceFiles="@(DataItems)" DestinationFolder="$(TargetDir)data\%(RecursiveDir)" SkipUnchangedFiles="true" />
|
|
</Target>
|
|
|
|
<Target Name="Build">
|
|
<PropertyGroup>
|
|
<SlnProperties>$(SlnProperties);Configuration=$(Configuration)</SlnProperties>
|
|
</PropertyGroup>
|
|
<Message Text="SlnProperties: $(SlnProperties)" />
|
|
<MSBuild Projects="openrct2.sln" Targets="Build" Properties="$(SlnProperties)" />
|
|
</Target>
|
|
<Target Name="Rebuild">
|
|
<PropertyGroup>
|
|
<SlnProperties>$(SlnProperties);Configuration=$(Configuration)</SlnProperties>
|
|
</PropertyGroup>
|
|
<Message Text="SlnProperties: $(SlnProperties)" />
|
|
<MSBuild Projects="openrct2.sln" Targets="Rebuild" Properties="$(SlnProperties)" />
|
|
</Target>
|
|
|
|
<Target Name="Test" DependsOnTargets="Build">
|
|
<Exec Command="$(TargetDir)tests\tests.exe "--gtest_output=xml:$(ArtifactsDir)test-results.xml"" />
|
|
</Target>
|
|
<Target Name="TestNoRCT2" DependsOnTargets="Build">
|
|
<Exec Command="$(TargetDir)tests\tests.exe "--gtest_filter=-RideRatings*:MultiLaunch*" "--gtest_output=xml:$(ArtifactsDir)test-results.xml"" />
|
|
</Target>
|
|
|
|
<!-- Target to build g2.dat containing OpenRCT2 sprites -->
|
|
<Target Name="g2" DependsOnTargets="Build" AfterTargets="Build" Inputs="@(g2Inputs)" Outputs="$(g2Output)"
|
|
Condition="'$(TestConfig)'!='true'">
|
|
<Message Text="Building g2.dat..." />
|
|
<Exec Command=""$(OutputExe)" sprite build "$(g2Output)" "$(RootDir)resources\g2\sprites.json""
|
|
StandardOutputImportance="low" />
|
|
</Target>
|
|
|
|
<!-- Target to create openrct2.exe (windows) and openrct2.com (console) -->
|
|
<Target Name="CreateGUI" DependsOnTargets="Build" AfterTargets="Build" Inputs="$(OutputExe)" Outputs="$(OutputCom)">
|
|
<Copy SourceFiles="$(OutputExe)" DestinationFiles="$(OutputCom)" />
|
|
<Exec Command="editbin /subsystem:console "$(OutputCom)"" />
|
|
<Exec Command="editbin /subsystem:windows "$(OutputExe)"" />
|
|
</Target>
|
|
|
|
<!-- Target to download the title sequences -->
|
|
<Target Name="DownloadTitleSequences" AfterTargets="Build">
|
|
<DownloadDependency Name="TitleSequences"
|
|
Url="$(TitleSequencesUrl)"
|
|
Sha1="$(TitleSequencesSha1)"
|
|
CheckFile="$(DependenciesCheckFile)"
|
|
OutputDirectory="$(TargetDir)data\title" />
|
|
</Target>
|
|
|
|
<!-- Target to sign OpenRCT2
|
|
This requires the project parameter SIGN_PASSWORD to be set -->
|
|
<Target Name="Sign" AfterTargets="Build" Inputs="@(SignItems)" Outputs="%(SignItems.Identity).signed"
|
|
Condition="'$(TestConfig)'!='true'">
|
|
<Warning Condition="'$(SIGN_PASSWORD)'==''" Text="SIGN_PASSWORD was not set, skipping signing of %(SignItems.Filename)%(SignItems.Extension)." />
|
|
<Message Condition="'$(SIGN_PASSWORD)'!=''" Text="Signing %(SignItems.Filename)%(SignItems.Extension)"
|
|
Importance="high" />
|
|
<Exec EchoOff="true" Condition="'$(SIGN_PASSWORD)'!=''"
|
|
Command="signtool.exe sign /f $(SignCertificate) /p $(SIGN_PASSWORD) /t $(SignTimestampUrl) %(SignItems.Identity)"
|
|
StandardOutputImportance="low" />
|
|
|
|
<!-- Create a dummy file so that msbuild can use it to determine if the binary is newer than the last sign time -->
|
|
<Touch AlwaysCreate="true" Files="%(SignItems.Identity).signed" />
|
|
</Target>
|
|
|
|
<!-- Target to publish OpenRCT2 as a portable zip -->
|
|
<Target Name="PublishPortable" DependsOnTargets="Build;g2" Inputs="@(PublishItems)" Outputs="$(PublishZip)"
|
|
Condition="'$(TestConfig)'!='true'">
|
|
<MakeDir Directories="$(ArtifactsDir)" />
|
|
<Message Importance="high" Text="Creating $([System.IO.Path]::GetFileName($(PublishZip)))..." />
|
|
<_7z Output="$(PublishZip)" Inputs="@(PublishItems)" />
|
|
</Target>
|
|
|
|
<!-- Target to publish the OpenRCT2 debug symbols -->
|
|
<Target Name="PublishSymbols" DependsOnTargets="Build" Inputs="@(SymbolItems)" Outputs="$(PublishSymbolsZip)"
|
|
Condition="'$(TestConfig)'!='true'">
|
|
<MakeDir Directories="$(ArtifactsDir)" />
|
|
<Message Importance="high" Text="Creating $([System.IO.Path]::GetFileName($(PublishSymbolsZip)))..." />
|
|
<_7z Output="$(PublishSymbolsZip)" Inputs="@(SymbolItems)" />
|
|
</Target>
|
|
|
|
<!-- Target to publish the OpenRCT2 as an NSIS installer -->
|
|
<Target Name="PublishInstaller"
|
|
DependsOnTargets="Build;g2"
|
|
Inputs="@(PublishItems);$(NsisScript)"
|
|
Outputs="$(PublishInstallerExe)"
|
|
Condition="'$(NO_NSIS)'!='true' AND '$(TestConfig)'!='true'">
|
|
<PropertyGroup>
|
|
<PublishInstallerExeName>$([System.IO.Path]::GetFilename($(PublishInstallerExe)))</PublishInstallerExeName>
|
|
</PropertyGroup>
|
|
|
|
<MakeDir Directories="$(ArtifactsDir)" />
|
|
|
|
<!-- Create the installer -->
|
|
<Message Text="Building Windows Installer (NSIS script)" Importance="high" />
|
|
<Exec Command="makensis /DOUTFILE=$(PublishInstallerExe) ^
|
|
/DAPPV_MAIN=$(Version) ^
|
|
/DAPPV_EXTRA=$(VersionExtra) ^
|
|
/DPLATFORM=$(Platform) ^
|
|
$(NsisScript)"
|
|
StandardOutputImportance="normal" />
|
|
|
|
<!-- Sign the installer -->
|
|
<Warning Condition="'$(SIGN_PASSWORD)'==''" Text="SIGN_PASSWORD was not set, skipping signing of $(PublishInstallerExeName)." />
|
|
<Message Condition="'$(SIGN_PASSWORD)'!=''" Text="Signing $(PublishInstallerExeName)"
|
|
Importance="high" />
|
|
<Exec EchoOff="true" Condition="'$(SIGN_PASSWORD)'!=''"
|
|
Command="signtool.exe sign /f $(SignCertificate) /p $(SIGN_PASSWORD) /t $(SignTimestampUrl) $(PublishInstallerExe)"
|
|
StandardOutputImportance="low" />
|
|
</Target>
|
|
|
|
<Target Name="PublishAll"
|
|
DependsOnTargets="PublishSymbols;PublishPortable;PublishInstaller" />
|
|
|
|
<!-- Target to upload the artifacts to OpenRCT2.org -->
|
|
<Target Name="UploadArtifacts" DependsOnTargets="PublishAll"
|
|
Condition="'$(TestConfig)'!='true'">
|
|
<PropertyGroup>
|
|
<UploadLink>https://openrct2.org/altapi/?command=push-build</UploadLink>
|
|
<UploadFileNameShort>%(UploadArtifacts.Filename)%(UploadArtifacts.Extension)</UploadFileNameShort>
|
|
<UploadGitBranch>master</UploadGitBranch>
|
|
<UploadGitBranch Condition="'$(GIT_BRANCH)'!=''">$(GIT_BRANCH)</UploadGitBranch>
|
|
</PropertyGroup>
|
|
<Message Text="Uploading $(UploadFileNameShort)" Importance="high" />
|
|
<Error Condition="'$(OPENRCT2_ORG_TOKEN)'==''" Text="OPENRCT2_ORG_TOKEN not set." />
|
|
<Error Condition="'$(GIT_COMMIT_SHA1)'==''" Text="GIT_COMMIT_SHA1 not set." />
|
|
<Exec EchoOff="true" Command="curl.exe -s -o - ^
|
|
--form "key=$(OPENRCT2_ORG_TOKEN)" ^
|
|
--form "fileName=%(UploadArtifacts.Name)" ^
|
|
--form "version=$(Version)" ^
|
|
--form "gitHash=$(GIT_COMMIT_SHA1)" ^
|
|
--form "gitBranch=$(UploadGitBranch)" ^
|
|
--form "flavourId=%(UploadArtifacts.FlavourId)" ^
|
|
--form "file=@%(UploadArtifacts.Identity)" ^
|
|
"$(UploadLink)""
|
|
CustomErrorRegularExpression=""error":1" />
|
|
</Target>
|
|
|
|
</Project>
|