mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-02-01 19:25:12 +01:00
reorganise build location and write new build script for Windows
This commit is contained in:
@@ -1 +1,66 @@
|
||||
msbuild ..\projects\openrct2.sln /p:Configuration=Release /p:Platform=Win32 /v:minimal
|
||||
#########################################################
|
||||
# Script to build different parts of OpenRCT2
|
||||
#########################################################
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(Mandatory = $false, Position = 1)]
|
||||
[string]$Task = "openrct2",
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
[string]$Configuration = "Release"
|
||||
)
|
||||
|
||||
# Get paths
|
||||
$scriptPath = $Script:MyInvocation.MyCommand.Path
|
||||
$scriptsPath = Split-Path $scriptPath
|
||||
$rootPath = Split-Path $scriptsPath
|
||||
$binPath = Join-Path $rootPath "bin"
|
||||
$openrct2Path = Join-Path $binPath "openrct2.exe"
|
||||
|
||||
function Build-Data()
|
||||
{
|
||||
Write-Host "Copying data to bin..." -ForegroundColor Cyan
|
||||
New-Item -Force -ItemType Directory $binPath > $null
|
||||
Copy-Item -Force -Recurse "$rootPath\data" $binPath
|
||||
return 0
|
||||
}
|
||||
|
||||
function Build-OpenRCT2()
|
||||
{
|
||||
Write-Host "Building OpenRCT2 ($Configuration)..." -ForegroundColor Cyan
|
||||
msbuild ..\projects\openrct2.sln /p:Configuration=$Configuration /p:Platform=Win32 /v:minimal | Write-Host
|
||||
return $LASTEXITCODE
|
||||
}
|
||||
|
||||
function Build-G2()
|
||||
{
|
||||
# Check if OpenRCT2 binary exists
|
||||
if (-not (Test-Path $openrct2Path))
|
||||
{
|
||||
Write-Host "You must build OpenRCT2 first before g2.dat can be built." -ForegroundColor Red
|
||||
return 1
|
||||
}
|
||||
|
||||
Write-Host "Building g2.dat..." -ForegroundColor Cyan
|
||||
& $openrct2Path sprite build "$binPath\data\g2.dat" "$rootPath\resources\g2"
|
||||
return $LASTEXITCODE
|
||||
}
|
||||
|
||||
function Build-All()
|
||||
{
|
||||
if (($result = (Build-Data )) -ne 0) { return $result }
|
||||
if (($result = (Build-OpenRCT2)) -ne 0) { return $result }
|
||||
if (($result = (Build-G2 )) -ne 0) { return $result }
|
||||
}
|
||||
|
||||
# Script entry point
|
||||
switch ($Task)
|
||||
{
|
||||
"data" { $result = Build-Data }
|
||||
"openrct2" { $result = Build-OpenRCT2 }
|
||||
"g2" { $result = Build-G2 }
|
||||
"all" { $result = Build-All }
|
||||
default { Write-Host "Unknown build task." -ForegroundColor Red
|
||||
$result = 1 }
|
||||
}
|
||||
exit $result
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
..\build\release\openrct2.exe sprite build "data\g2.dat" "resources\g2"
|
||||
@@ -4,7 +4,7 @@
|
||||
param (
|
||||
[switch]$Force
|
||||
)
|
||||
Write-Output "Installing OpenRCT2 development environment for Windows"
|
||||
Write-Host "Installing OpenRCT2 development environment for Windows" -ForegroundColor Cyan
|
||||
Import-Module ".\common.psm1" -DisableNameChecking
|
||||
|
||||
# Settings
|
||||
@@ -49,7 +49,7 @@ else
|
||||
|
||||
# Download latest version of the dependencies
|
||||
if ($updateLibs) {
|
||||
Write-Output "Updating dependencies..."
|
||||
Write-Host "Updating dependencies..." -ForegroundColor Cyan
|
||||
|
||||
Remove-Item -Force -Recurse $libsPath -ErrorAction SilentlyContinue
|
||||
New-Item -Force -ItemType Directory $libsPath > $null
|
||||
|
||||
@@ -9,10 +9,15 @@ param (
|
||||
[string]$buildNo = ""
|
||||
)
|
||||
|
||||
# Get paths
|
||||
$scriptPath = $Script:MyInvocation.MyCommand.Path
|
||||
$scriptsPath = Split-Path $scriptPath
|
||||
$rootPath = Split-Path $scriptsPath
|
||||
|
||||
# Set build attributes
|
||||
function do-prepareSource($build_server = "", $build_number = "")
|
||||
{
|
||||
Write-Output "Setting build #defines..."
|
||||
Write-Host "Setting build #defines..." -ForegroundColor Cyan
|
||||
# $build_number = "";
|
||||
# $build_server = "";
|
||||
$build_branch = (git rev-parse --abbrev-ref HEAD)
|
||||
@@ -42,18 +47,18 @@ function do-prepareSource($build_server = "", $build_number = "")
|
||||
# Building OpenRCT2
|
||||
function do-build()
|
||||
{
|
||||
Write-Output "Building OpenRCT2..."
|
||||
msbuild ..\projects\openrct2.sln /p:Configuration=Release /p:Platform=Win32 /t:rebuild /v:minimal
|
||||
Write-Host "Building OpenRCT2..." -ForegroundColor Cyan
|
||||
msbuild $rootPath\projects\openrct2.sln /p:Configuration=Release /p:Platform=Win32 /t:rebuild /v:minimal
|
||||
}
|
||||
|
||||
# Package
|
||||
function do-package()
|
||||
{
|
||||
Write-Output "Publishing OpenRCT2..."
|
||||
$releaseDir = "..\build\Release"
|
||||
$distDir = "..\distribution"
|
||||
$tempDir = "..\artifacts\temp"
|
||||
$outZip = "..\artifacts\openrct2.zip"
|
||||
Write-Host "Publishing OpenRCT2..." -ForegroundColor Cyan
|
||||
$releaseDir = "$rootPath\bin"
|
||||
$distDir = "$rootPath\distribution"
|
||||
$tempDir = "$rootPath\artifacts\temp"
|
||||
$outZip = "$rootPath\artifacts\openrct2.zip"
|
||||
|
||||
# Create new temp directory
|
||||
Remove-Item -Force -Recurse $tempDir -ErrorAction SilentlyContinue
|
||||
@@ -76,6 +81,6 @@ function do-package()
|
||||
Remove-Item -Force -Recurse $tempDir -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# do-prepareSource $server $buildNo
|
||||
# do-build
|
||||
do-prepareSource $server $buildNo
|
||||
do-build
|
||||
do-package
|
||||
|
||||
Reference in New Issue
Block a user