2018-01-20 03:55:39 +01:00
|
|
|
[CmdletBinding()]
|
|
|
|
Param(
|
|
|
|
[Parameter(Position=0, mandatory=$true)]
|
|
|
|
[ValidateSet("Init", "Build", "Package")]
|
|
|
|
[string]$Task
|
|
|
|
)
|
|
|
|
|
2018-06-22 03:59:27 +02:00
|
|
|
# https://stackoverflow.com/a/41618979/9919772
|
|
|
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
|
|
|
2018-01-20 03:55:39 +01:00
|
|
|
$solution = "vgmstream_full.sln"
|
|
|
|
$vswhere = "dependencies/vswhere.exe"
|
|
|
|
$config = "/p:Configuration=Release"
|
|
|
|
$onAppveyor = ($env:APPVEYOR -eq "true")
|
|
|
|
$appveyorLoggerPath = "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
|
|
|
|
|
|
|
$fb2kFiles = @(
|
|
|
|
"ext_libs/*.dll",
|
|
|
|
"ext_libs/*.dll.asc",
|
|
|
|
"Release/foo_input_vgmstream.dll",
|
|
|
|
"README.md"
|
|
|
|
)
|
|
|
|
|
|
|
|
$cliFiles = @(
|
|
|
|
"ext_libs/*.dll",
|
|
|
|
"Release/in_vgmstream.dll",
|
|
|
|
"Release/test.exe",
|
|
|
|
"Release/xmp-vgmstream.dll",
|
2020-10-05 08:57:36 +02:00
|
|
|
"dependencies/jansson/build/bin/Release/jansson.dll",
|
2018-01-20 03:55:39 +01:00
|
|
|
"COPYING",
|
|
|
|
"README.md"
|
|
|
|
)
|
|
|
|
|
2018-12-30 02:41:03 +01:00
|
|
|
$fb2kPdbFiles = @(
|
|
|
|
"Release/foo_input_vgmstream.pdb"
|
|
|
|
)
|
|
|
|
|
|
|
|
$cliPdbFiles = @(
|
|
|
|
"Release/in_vgmstream.pdb",
|
|
|
|
"Release/test.pdb",
|
|
|
|
"Release/xmp-vgmstream.pdb"
|
|
|
|
)
|
|
|
|
|
2018-01-20 03:55:39 +01:00
|
|
|
function Unzip
|
|
|
|
{
|
|
|
|
param([string]$zipfile, [string]$outpath)
|
|
|
|
Write-Output "Extracting $zipfile"
|
|
|
|
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
|
|
|
|
}
|
|
|
|
|
|
|
|
function Download
|
|
|
|
{
|
|
|
|
param([string]$uri, [string]$outfile)
|
|
|
|
Write-Output "Downloading $uri"
|
|
|
|
$wc = New-Object net.webclient
|
|
|
|
$wc.Downloadfile($uri, $outfile)
|
|
|
|
}
|
|
|
|
|
|
|
|
function Init
|
|
|
|
{
|
|
|
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
|
|
|
|
|
|
|
Remove-Item -Path "dependencies" -Recurse -ErrorAction Ignore
|
|
|
|
New-Item dependencies -Type directory -Force | out-null
|
|
|
|
|
|
|
|
Download "https://github.com/kode54/fdk-aac/archive/master.zip" "dependencies\fdk-aac.zip"
|
|
|
|
Download "https://github.com/kode54/qaac/archive/master.zip" "dependencies\qaac.zip"
|
|
|
|
Download "https://www.nuget.org/api/v2/package/wtl/9.1.1" "dependencies\wtl.zip"
|
2020-10-05 08:57:36 +02:00
|
|
|
Download "https://github.com/akheron/jansson/archive/v2.13.1.zip" "dependencies\jansson.zip"
|
2019-05-11 08:12:07 +02:00
|
|
|
Download "https://github.com/Microsoft/vswhere/releases/download/2.6.7/vswhere.exe" "dependencies\vswhere.exe"
|
2018-01-20 03:55:39 +01:00
|
|
|
|
|
|
|
Download "https://www.foobar2000.org/SDK" "dependencies\SDK"
|
|
|
|
$key = (Select-String -Path dependencies\SDK -Pattern "\/([a-f0-9]+)\/SDK-2018-01-11\.zip").matches.groups[1]
|
|
|
|
Remove-Item -Path "dependencies\SDK"
|
|
|
|
Download "https://www.foobar2000.org/files/$key/SDK-2018-01-11.zip" "dependencies\foobar.zip"
|
|
|
|
|
|
|
|
Unzip "dependencies\fdk-aac.zip" "dependencies\fdk-aac_tmp"
|
|
|
|
Unzip "dependencies\qaac.zip" "dependencies\qaac_tmp"
|
|
|
|
Unzip "dependencies\wtl.zip" "dependencies\wtl_tmp"
|
2020-10-05 08:57:36 +02:00
|
|
|
Unzip "dependencies\jansson.zip" "dependencies\jansson_tmp"
|
2018-01-20 03:55:39 +01:00
|
|
|
Unzip "dependencies\foobar.zip" "dependencies\foobar"
|
|
|
|
|
|
|
|
Move-Item "dependencies\fdk-aac_tmp\fdk-aac-master" "dependencies\fdk-aac"
|
|
|
|
Move-Item "dependencies\qaac_tmp\qaac-master" "dependencies\qaac"
|
|
|
|
Move-Item "dependencies\wtl_tmp\lib\native" "dependencies\wtl"
|
2020-10-05 08:57:36 +02:00
|
|
|
Move-Item "dependencies\jansson_tmp\jansson-2.13.1" "dependencies\jansson"
|
2018-01-20 03:55:39 +01:00
|
|
|
|
|
|
|
Remove-Item -Path "dependencies\fdk-aac_tmp" -Recurse
|
|
|
|
Remove-Item -Path "dependencies\qaac_tmp" -Recurse
|
|
|
|
Remove-Item -Path "dependencies\wtl_tmp" -Recurse
|
2020-10-05 08:57:36 +02:00
|
|
|
Remove-Item -Path "dependencies\jansson_tmp" -Recurse
|
2018-01-20 03:55:39 +01:00
|
|
|
|
|
|
|
[xml]$proj = Get-Content dependencies\foobar\foobar2000\ATLHelpers\foobar2000_ATL_helpers.vcxproj
|
|
|
|
$proj.project.ItemDefinitionGroup | ForEach-Object {
|
|
|
|
$includes = $proj.CreateElement("AdditionalIncludeDirectories", $proj.project.NamespaceURI)
|
|
|
|
$includes.InnerText = "../../../wtl/include"
|
|
|
|
$_.ClCompile.AppendChild($includes)
|
|
|
|
}
|
|
|
|
$proj.Save("dependencies\foobar\foobar2000\ATLHelpers\foobar2000_ATL_helpers.vcxproj")
|
2020-10-28 20:23:23 +01:00
|
|
|
|
|
|
|
cd dependencies\jansson\
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake .. -DJANSSON_BUILD_SHARED_LIBS=ON -DJANSSON_EXAMPLES=OFF -DJANSSON_BUILD_DOCS=OFF -G "Visual Studio 15 2017" -T "v141_xp"
|
|
|
|
cd ..\..\..
|
2018-01-20 03:55:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function Package
|
|
|
|
{
|
|
|
|
Compress-Archive $cliFiles Release/test.zip -Force
|
|
|
|
Compress-Archive $fb2kFiles Release/foo_input_vgmstream.zip -Force
|
|
|
|
Move-Item Release/foo_input_vgmstream.zip Release/foo_input_vgmstream.fb2k-component -Force
|
2018-12-30 02:41:03 +01:00
|
|
|
Compress-Archive $cliPdbFiles Release/test.pdb.zip -Force
|
|
|
|
Compress-Archive $fb2kPdbFiles Release/foo_input_vgmstream.pdb.zip -Force
|
2018-01-20 03:55:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function Build
|
|
|
|
{
|
2019-01-21 03:21:36 +01:00
|
|
|
$commit = & git describe --always
|
2018-01-20 03:55:39 +01:00
|
|
|
if($onAppveyor) {
|
|
|
|
if($env:APPVEYOR_PULL_REQUEST_NUMBER) {
|
|
|
|
$prCommits = & git rev-list "$env:APPVEYOR_REPO_BRANCH.." --count
|
|
|
|
$prNum = ".PR$env:APPVEYOR_PULL_REQUEST_NUMBER.$prCommits"
|
|
|
|
}
|
|
|
|
if($env:APPVEYOR_REPO_BRANCH -ne "master") { $branch = ".$env:APPVEYOR_REPO_BRANCH" }
|
|
|
|
$version = "$commit$prNum$branch"
|
2018-07-24 22:53:14 +02:00
|
|
|
Update-AppveyorBuild -Version $version -errorAction SilentlyContinue
|
2018-01-20 03:55:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!(Test-Path $vswhere)) { Init }
|
|
|
|
|
2019-05-11 08:12:07 +02:00
|
|
|
$msbuild = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe
|
2018-01-20 03:55:39 +01:00
|
|
|
|
|
|
|
if(!($msbuild -and $(Test-Path $msbuild))) {
|
|
|
|
Write-Error "Unable to find MSBuild. Is Visual Studio installed?"
|
|
|
|
}
|
|
|
|
|
|
|
|
$logger = ""
|
|
|
|
if(Test-Path $appveyorLoggerPath) {
|
|
|
|
$logger = "/logger:$appveyorLoggerPath"
|
|
|
|
}
|
|
|
|
|
|
|
|
& $msbuild $solution $config $logger /m
|
|
|
|
|
|
|
|
Package
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($Task)
|
|
|
|
{
|
|
|
|
"Init" { Init }
|
|
|
|
"Build" { Build }
|
|
|
|
"Package" { Package }
|
|
|
|
}
|