forked from OpenRCT2/OpenRCT2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openrct2.proj
324 lines (287 loc) · 16.6 KB
/
openrct2.proj
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<?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
- GIT_DESCRIBE
- 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.2.0</Version>
<VersionExtra Condition="'$(GIT_BRANCH)'!=''">-$(GIT_BRANCH)-$(GIT_COMMIT_SHA1_SHORT)</VersionExtra>
<VersionExtra Condition="'$(GIT_TAG)'!=''"></VersionExtra>
<TargetLibsVersion>16</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>
<OPENRCT2_CL_ADDITIONALOPTIONS Condition="'$(GIT_DESCRIBE)'!=''">/D "OPENRCT2_VERSION_TAG=\"$(GIT_DESCRIBE)\"" $(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 Condition="'$(Platform)'=='Win32'">https://github.com/OpenRCT2/Dependencies/releases/download/v17/openrct2-libs-v17-x86-windows-static-winssl.zip</LibsUrl>
<LibsSha1 Condition="'$(Platform)'=='Win32'">4f9fb5feebe4a4ed461b2a545b2fd1c91ef6527b</LibsSha1>
<LibsUrl Condition="'$(Platform)'=='x64'">https://github.com/OpenRCT2/Dependencies/releases/download/v17/openrct2-libs-v17-x64-windows-static-winssl.zip</LibsUrl>
<LibsSha1 Condition="'$(Platform)'=='x64'">5aab386f9eeaad102b330fcddea2b4cc9e3c7067</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.2/title-sequence-v0.1.2.zip</TitleSequencesUrl>
<TitleSequencesSha1>1136ef92bfb05cd1cba9831ba6dc4a653d87a246</TitleSequencesSha1>
<ObjectsUrl>https://github.com/OpenRCT2/objects/releases/download/v1.0.2/objects.zip</ObjectsUrl>
<ObjectsSha1>acf853ff6fa4285cea94cc9d8f74730e57202d06</ObjectsSha1>
</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\$(Platform)" />
<!-- 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>
<BuildString Condition="'$(GIT_DESCRIBE)'!=''">$(BuildString) ($(GIT_DESCRIBE))</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">
<!-- Scan repositories prior to running tests as it can take a while -->
<Message Text="Building OpenRCT2 repository indexes..." Importance="high" />
<Exec Command="$(TargetDir)openrct2.exe scan-objects"
WorkingDirectory="$(TargetDir)"
StandardOutputImportance="normal" />
<Message Text="Running tests..." Importance="high" />
<Exec Command="$(TargetDir)tests.exe "--gtest_output=xml:$(ArtifactsDir)test-results.xml""
WorkingDirectory="$(TargetDir)" />
</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..." Importance="high" />
<Exec Command=""$(OutputExe)" sprite build "$(g2Output)" "$(RootDir)resources\g2\sprites.json""
StandardOutputImportance="normal" />
</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 download the objects -->
<Target Name="DownloadObjects" AfterTargets="Build">
<DownloadDependency Name="Objects"
Url="$(ObjectsUrl)"
Sha1="$(ObjectsSha1)"
CheckFile="$(DependenciesCheckFile)"
OutputDirectory="$(TargetDir)data\object" />
</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>