1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

reorganise scripts

This commit is contained in:
IntelOrca
2015-12-10 00:13:20 +00:00
parent 0298ca38a0
commit d8b949ecdc
9 changed files with 95 additions and 65 deletions

View File

@@ -1 +0,0 @@
msbuild .\projects\openrct2.sln /p:Configuration=Release /p:Platform=Win32

View File

@@ -1 +0,0 @@
.\build\release\openrct2.exe sprite build "data\g2.dat" "resources\g2"

View File

@@ -1,34 +0,0 @@
#init
$libversion = 4
$path = Split-Path $Script:MyInvocation.MyCommand.Path
$zip = $path+'\orctlibs.zip'
$libs = $path+'\lib'
$libsVFile = $path+'\libversion'
$liburl = 'https://openrct2.website/files/orctlibs-vs.zip'
$libsTest = Test-Path $libs
#libs version test
$libsVersionTest = Test-Path $libsVFile
$currentVersion = 0
$needsdownload = $true
if ($libsVersionTest) {
$currentVersion = [IO.File]::ReadAllText($libsVFile)
}
if ($currentVersion -ge $libversion) {
$needsdownload = $false
}
#download
if (!$libsTest -or $needsdownload) {
if ($libsTest) {
rm $libs -Recurse -Force
}
mkdir $libs
Invoke-WebRequest $liburl -OutFile $path\orctlibs.zip
[System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $libs)
rm $path\orctlibs.zip -Force -ErrorAction SilentlyContinue
$libversion | Set-Content $libsVFile
} else {
echo 'All libs up to date'
}

View File

@@ -106,9 +106,6 @@
<AdditionalDependencies>libcurl.lib;Ws2_32.lib;SDL2_ttf.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
</Lib>
<PreBuildEvent>
<Command>Powershell -NonInteractive -ExecutionPolicy "ByPass" -File "$(ProjectDir)../../pre-build.ps1"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -131,9 +128,6 @@
<Lib>
<AdditionalDependencies>libcurl.lib;Ws2_32.lib;SDL2_ttf.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<PreBuildEvent>
<Command>Powershell -NonInteractive -ExecutionPolicy "ByPass" -File "$(ProjectDir)../../pre-build.ps1"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release XP|Win32'">
<ClCompile>
@@ -156,9 +150,6 @@
<Lib>
<AdditionalDependencies>libcurl.lib;Ws2_32.lib;SDL2_ttf.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<PreBuildEvent>
<Command>Powershell -NonInteractive -ExecutionPolicy "ByPass" -File "$(ProjectDir)../../pre-build.ps1"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
<ClCompile>
@@ -181,9 +172,6 @@
<Lib>
<AdditionalDependencies>libcurl.lib;Ws2_32.lib;SDL2_ttf.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<PreBuildEvent>
<Command>Powershell -NonInteractive -ExecutionPolicy "ByPass" -File "$(ProjectDir)../../pre-build.ps1"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\lib\argparse\argparse.c">

1
scripts/build.ps1 Normal file
View File

@@ -0,0 +1 @@
msbuild ..\projects\openrct2.sln /p:Configuration=Release /p:Platform=Win32 /v:minimal

1
scripts/build_g2.ps1 Normal file
View File

@@ -0,0 +1 @@
..\build\release\openrct2.exe sprite build "data\g2.dat" "resources\g2"

12
scripts/common.psm1 Normal file
View File

@@ -0,0 +1,12 @@
#########################################################
# Common functions for OpenRCT2 PowerShell scripts
#########################################################
function Prompt-User($message)
{
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Yes"
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "No"
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
$choice = $host.UI.PromptForChoice("", $message, $options, 1)
return ($choice -eq 0)
}

62
scripts/install.ps1 Normal file
View File

@@ -0,0 +1,62 @@
#########################################################
# Script to install the latest dependencies for OpenRCT2
#########################################################
param (
[switch]$Force
)
Write-Output "Installing OpenRCT2 development environment for Windows"
Import-Module ".\common.psm1" -DisableNameChecking
# Settings
$libsUrl = "https://openrct2.website/files/orctlibs-vs.zip"
# Dependencies version (increment this when the dependencies is updated)
$libsVersion = 4
# Get paths
$scriptPath = $Script:MyInvocation.MyCommand.Path
$scriptsPath = Split-Path $scriptPath
$rootPath = Split-Path $scriptsPath
$libsPath = Join-Path $rootPath "lib"
$zipPath = Join-Path $libsPath "orctlibs.zip"
$libsVersionPath = Join-Path $libsPath "libversion"
# Check if we need to update the dependencies
$currentLibsVersion = 0
$updateLibs = $true
if (Test-Path $libsVersionPath)
{
$currentLibsVersion = [IO.File]::ReadAllText($libsVersionPath)
}
if ($currentLibsVersion -ge $libsVersion)
{
$updateLibs = $false
}
# Check if user needs to download dependencies
$libsPathExists = Test-Path $libsPath
if ($libsPathExists -and -not $updateLibs -and -not $Force)
{
if (Prompt-User "Dependencies already exists, reinstall?")
{
$updateLibs = $true
}
}
else
{
$updateLibs = $true
}
# Download latest version of the dependencies
if ($updateLibs) {
Write-Output "Updating dependencies..."
Remove-Item -Force -Recurse $libsPath -ErrorAction SilentlyContinue
New-Item -Force -ItemType Directory $libsPath > $null
Invoke-WebRequest $libsUrl -OutFile $zipPath
[System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') > $null
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipPath, $libsPath)
Remove-Item $zipPath -Force -ErrorAction SilentlyContinue
$libsVersion | Set-Content $libsVersionPath
}

View File

@@ -1,10 +1,11 @@
# Publish script for OpenRCT2
#########################################################
# Script to build and package OpenRCT2
# - Sets the source code preprocessor defines
# - Builds a clean release of OpenRCT2
# - Creates a ZIP for distribution
#########################################################
param (
[string]$server = "",
[string]$server = "",
[string]$buildNo = ""
)
@@ -42,30 +43,31 @@ function do-prepareSource($build_server = "", $build_number = "")
function do-build()
{
Write-Output "Building OpenRCT2..."
msbuild .\projects\openrct2.sln /p:Configuration=Release /p:Platform=Win32 /t:rebuild /v:minimal
msbuild ..\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"
$releaseDir = "..\build\Release"
$distDir = "..\distribution"
$tempDir = "..\artifacts\temp"
$outZip = "..\artifacts\openrct2.zip"
# Create new temp directory
Remove-Item -Force -Recurse $tempDir -ErrorAction SilentlyContinue
New-Item -Force -ItemType Directory $tempDir > $null
# Copy files to be archived
Copy-Item -Force "$releaseDir\openrct2.exe" $tempDir -ErrorAction Stop
Copy-Item -Force "$releaseDir\openrct2.dll" $tempDir -ErrorAction Stop
Copy-Item -Force "$releaseDir\curl-ca-bundle.crt" $tempDir -ErrorAction Stop
Copy-Item -Force "$releaseDir\SDL2.dll" $tempDir -ErrorAction Stop
Copy-Item -Force "$distDir\changelog.txt" $tempDir -ErrorAction Stop
Copy-Item -Force "$distDir\known_issues.txt" $tempDir -ErrorAction Stop
Copy-Item -Force "$distDir\readme.txt" $tempDir -ErrorAction Stop
Copy-Item -Force -Recurse "$releaseDir\data" $tempDir -ErrorAction Stop
Copy-Item -Force "$releaseDir\openrct2.exe" $tempDir -ErrorAction Stop
Copy-Item -Force "$releaseDir\openrct2.dll" $tempDir -ErrorAction Stop
Copy-Item -Force "$releaseDir\curl-ca-bundle.crt" $tempDir -ErrorAction Stop
Copy-Item -Force "$releaseDir\SDL2.dll" $tempDir -ErrorAction Stop
Copy-Item -Force "$distDir\changelog.txt" $tempDir -ErrorAction Stop
Copy-Item -Force "$distDir\known_issues.txt" $tempDir -ErrorAction Stop
Copy-Item -Force "$distDir\readme.txt" $tempDir -ErrorAction Stop
# Create archive
7za a -tzip -mx9 $outZip "$tempDir\*"
@@ -74,6 +76,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