Skip to content

Commit

Permalink
Fix build script
Browse files Browse the repository at this point in the history
  • Loading branch information
CrendKing committed Aug 17, 2023
1 parent baa8f79 commit be2b0b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ else:

## Build

A script `build.ps1` is included to automate the build process. It obtains dependencies and starts compilation. Before running `build.ps1`, make sure you have the latest [Visual Studio](https://visualstudio.microsoft.com/) and [git](https://git-scm.com/download/win) installed. When running the script, pass the target configuration and platform as arguments, e.g. `build.ps1 Debug x64` or `build.ps1 Release x86`.
A script `build.ps1` is included to automate the build process. It obtains dependencies and starts compilation. Before running `build.ps1`, make sure you have the latest [Visual Studio](https://visualstudio.microsoft.com/) and [git](https://git-scm.com/download/win) installed. When running the script, pass the target configuration and platform as arguments, e.g. `build.ps1 -configuration Debug -platform x64` or `build.ps1 -configuration Release -platform x86`.

## Credit

Expand Down
26 changes: 11 additions & 15 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
Param(
[Parameter(Mandatory)]
$configuration,
[Parameter(Mandatory)]
$platform
$configuration = 'release',
$platform = 'x64'
)


$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -utf8 -property installationPath -version '[17,99]'
$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -utf8 -property installationPath -latest
if (!$vsPath) {
exit 1
}

Import-Module "${vsPath}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $vsPath -DevCmdArguments "-arch=amd64 -host_arch=amd64 -no_logo" -SkipAutomaticLocation
& "${vsPath}\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -SkipAutomaticLocation | Out-Null

$workingDir = "${PSScriptRoot}\dep_avisynth_plus"
if (-Not (Test-Path $workingDir)) {
mkdir $workingDir
if (!(Test-Path $workingDir)) {
New-Item -ItemType Directory $workingDir -ErrorAction SilentlyContinue
Set-Location $workingDir

git clone 'https://github.com/AviSynth/AviSynthPlus.git' --sparse --depth=1 --filter=blob:none
Expand All @@ -31,8 +27,8 @@ if (-Not (Test-Path $workingDir)) {
foreach ($asset in $rel.assets) {
if ($asset.name -like 'AviSynthPlus_*-filesonly.7z') {
Invoke-WebRequest $asset.browser_download_url -OutFile $asset.name
7z e $asset.name -olibs\32 '*\x86\c_api\*.lib'
7z e $asset.name -olibs\64 '*\x64\c_api\*.lib'
7z e $asset.name -olibs\32 '*\x86\Output\c_api\*.lib'
7z e $asset.name -olibs\64 '*\x64\Output\c_api\*.lib'
$foundAsset = $true
break
}
Expand All @@ -47,8 +43,8 @@ if (-Not (Test-Path $workingDir)) {
}

$workingDir = "${PSScriptRoot}\dep_vapoursynth"
if (-Not (Test-Path $workingDir)) {
mkdir $workingDir
if (!(Test-Path $workingDir)) {
New-Item -ItemType Directory $workingDir -ErrorAction SilentlyContinue
Set-Location $workingDir

$latestRelease = Invoke-RestMethod -Headers @{ 'Accept' = 'application/vnd.github.v3+json' } 'https://api.github.com/repos/vapoursynth/vapoursynth/releases'
Expand Down Expand Up @@ -76,7 +72,7 @@ if (-Not (Test-Path $workingDir)) {
Set-Location $PSScriptRoot

$workingDir = "${PSScriptRoot}\dep_simpleini"
if (-Not (Test-Path $workingDir)) {
if (!(Test-Path $workingDir)) {
git clone https://github.com/brofield/simpleini.git --depth=1 dep_simpleini
}

Expand Down

0 comments on commit be2b0b0

Please sign in to comment.