mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 09:39:15 +00:00
CI: Remove legacy Windows build scripts
This commit is contained in:
parent
4051cae1be
commit
af7dbba451
|
@ -1,137 +0,0 @@
|
|||
Param(
|
||||
[Switch]$Help,
|
||||
[Switch]$Quiet,
|
||||
[Switch]$Verbose,
|
||||
[Switch]$Package,
|
||||
[Switch]$SkipDependencyChecks,
|
||||
[Switch]$BuildInstaller,
|
||||
[Switch]$CombinedArchs,
|
||||
[String]$BuildDirectory = "build",
|
||||
[ValidateSet('x86', 'x64')]
|
||||
[String]$BuildArch = ('x86', 'x64')[[System.Environment]::Is64BitOperatingSystem],
|
||||
[ValidateSet("Release", "RelWithDebInfo", "MinSizeRel", "Debug")]
|
||||
[String]$BuildConfiguration = "RelWithDebInfo"
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# Windows OBS build script
|
||||
##############################################################################
|
||||
#
|
||||
# This script contains all steps necessary to:
|
||||
#
|
||||
# * Build OBS with all required dependencies
|
||||
# * Create 64-bit and 32-bit variants
|
||||
#
|
||||
# Parameters:
|
||||
# -Help : Print usage help
|
||||
# -Quiet : Suppress most build process output
|
||||
# -Verbose : Enable more verbose build process output
|
||||
# -SkipDependencyChecks : Skip dependency checks
|
||||
# -BuildDirectory : Directory to use for builds
|
||||
# Default: build64 on 64-bit systems
|
||||
# build32 on 32-bit systems
|
||||
# -BuildArch : Build architecture to use (x86 or x64)
|
||||
# -BuildConfiguration : Build configuration to use
|
||||
# Default: RelWithDebInfo
|
||||
# -CombinedArchs : Create combined packages and installer
|
||||
# (x86 and x64) - Default: off
|
||||
# -Package : Prepare folder structure for installer creation
|
||||
#
|
||||
# Environment Variables (optional):
|
||||
# WindowsDepsVersion : Pre-compiled Windows dependencies version
|
||||
# WindowsQtVersion : Pre-compiled Qt version
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$_RunObsBuildScript = $true
|
||||
$ProductName = "OBS-Studio"
|
||||
|
||||
$CheckoutDir = Resolve-Path -Path "$PSScriptRoot\.."
|
||||
$DepsBuildDir = "${CheckoutDir}/../obs-build-dependencies"
|
||||
$ObsBuildDir = "${CheckoutDir}/../obs-studio"
|
||||
|
||||
. ${CheckoutDir}/CI/include/build_support_windows.ps1
|
||||
|
||||
# Handle installation of build system components and build dependencies
|
||||
. ${CheckoutDir}/CI/windows/01_install_dependencies.ps1
|
||||
|
||||
# Handle OBS build configuration
|
||||
. ${CheckoutDir}/CI/windows/02_build_obs.ps1
|
||||
|
||||
# Handle packaging
|
||||
. ${CheckoutDir}/CI/windows/03_package_obs.ps1
|
||||
|
||||
function Build-OBS-Main {
|
||||
Ensure-Directory ${CheckoutDir}
|
||||
Write-Step "Fetching version tags..."
|
||||
$null = git fetch origin --tags
|
||||
$GitBranch = git rev-parse --abbrev-ref HEAD
|
||||
$GitHash = git rev-parse --short HEAD
|
||||
$ErrorActionPreference = "SilentlyContinue"
|
||||
$GitTag = git describe --tags --abbrev=0
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if(Test-Path variable:BUILD_FOR_DISTRIBUTION) {
|
||||
$VersionString = "${GitTag}"
|
||||
} else {
|
||||
$VersionString = "${GitTag}-${GitHash}"
|
||||
}
|
||||
|
||||
$FileName = "${ProductName}-${VersionString}"
|
||||
|
||||
if($CombinedArchs.isPresent) {
|
||||
if (!(Test-Path env:obsInstallerTempDir)) {
|
||||
$Env:obsInstallerTempDir = "${CheckoutDir}/install_temp"
|
||||
}
|
||||
|
||||
if(!($SkipDependencyChecks.isPresent)) {
|
||||
Install-Dependencies -BuildArch x64
|
||||
}
|
||||
|
||||
Build-OBS -BuildArch x64
|
||||
|
||||
if(!($SkipDependencyChecks.isPresent)) {
|
||||
Install-Dependencies -BuildArch x86
|
||||
}
|
||||
|
||||
Build-OBS -BuildArch x86
|
||||
} else {
|
||||
if(!($SkipDependencyChecks.isPresent)) {
|
||||
Install-Dependencies
|
||||
}
|
||||
|
||||
Build-OBS
|
||||
}
|
||||
|
||||
if($Package.isPresent) {
|
||||
Package-OBS -CombinedArchs:$CombinedArchs
|
||||
}
|
||||
}
|
||||
|
||||
## MAIN SCRIPT FUNCTIONS ##
|
||||
function Print-Usage {
|
||||
Write-Host "build-windows.ps1 - Build script for ${ProductName}"
|
||||
$Lines = @(
|
||||
"Usage: ${_ScriptName}",
|
||||
"-Help : Print this help",
|
||||
"-Quiet : Suppress most build process output"
|
||||
"-Verbose : Enable more verbose build process output"
|
||||
"-SkipDependencyChecks : Skip dependency checks - Default: off",
|
||||
"-BuildDirectory : Directory to use for builds - Default: build64 on 64-bit systems, build32 on 32-bit systems",
|
||||
"-BuildArch : Build architecture to use (x86 or x64) - Default: local architecture",
|
||||
"-BuildConfiguration : Build configuration to use - Default: RelWithDebInfo",
|
||||
"-CombinedArchs : Create combined packages and installer (64-bit and 32-bit) - Default: off"
|
||||
"-Package : Prepare folder structure for installer creation"
|
||||
)
|
||||
$Lines | Write-Host
|
||||
}
|
||||
|
||||
$_ScriptName = "$($MyInvocation.MyCommand.Name)"
|
||||
if($Help.isPresent) {
|
||||
Print-Usage
|
||||
exit 0
|
||||
}
|
||||
|
||||
Build-OBS-Main
|
|
@ -1,2 +0,0 @@
|
|||
package '7zip.7zip', path: '7-zip', bin: '7z'
|
||||
package 'cmake', path: 'Cmake\bin', bin: 'cmake'
|
|
@ -1,193 +0,0 @@
|
|||
$CIWorkflow = "${CheckoutDir}/.github/workflows/main.yml"
|
||||
$WorkflowContent = Get-Content ${CIWorkflow}
|
||||
|
||||
$CIDepsVersion = ${WorkflowContent} | Select-String "[ ]+DEPS_VERSION_WIN: '([0-9\-]+)'" | ForEach-Object{$_.Matches.Groups[1].Value}
|
||||
$CIQtVersion = ${WorkflowContent} | Select-String "[ ]+QT_VERSION_WIN: '([0-9\.]+)'" | ForEach-Object{$_.Matches.Groups[1].Value}
|
||||
$CIVlcVersion = ${WorkflowContent} | Select-String "[ ]+VLC_VERSION_WIN: '(.+)'" | ForEach-Object{$_.Matches.Groups[1].Value}
|
||||
$CICefVersion = ${WorkflowContent} | Select-String "[ ]+CEF_BUILD_VERSION_WIN: '([0-9\.]+)'" | ForEach-Object{$_.Matches.Groups[1].Value}
|
||||
$CIGenerator = ${WorkflowContent} | Select-String "[ ]+CMAKE_GENERATOR: '(.+)'" | ForEach-Object{$_.Matches.Groups[1].Value}
|
||||
|
||||
function Write-Status {
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String] $Output
|
||||
)
|
||||
|
||||
if (!($Quiet.isPresent)) {
|
||||
if (Test-Path Env:CI) {
|
||||
Write-Host "[${ProductName}] ${Output}"
|
||||
} else {
|
||||
Write-Host -ForegroundColor blue "[${ProductName}] ${Output}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Write-Info {
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String] $Output
|
||||
)
|
||||
|
||||
if (!($Quiet.isPresent)) {
|
||||
if (Test-Path Env:CI) {
|
||||
Write-Host " + ${Output}"
|
||||
} else {
|
||||
Write-Host -ForegroundColor DarkYellow " + ${Output}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Write-Step {
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String] $Output
|
||||
)
|
||||
|
||||
if (!($Quiet.isPresent)) {
|
||||
if (Test-Path Env:CI) {
|
||||
Write-Host " + ${Output}"
|
||||
} else {
|
||||
Write-Host -ForegroundColor green " + ${Output}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Write-Failure {
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String] $Output
|
||||
)
|
||||
|
||||
if (Test-Path Env:CI) {
|
||||
Write-Host " + ${Output}"
|
||||
} else {
|
||||
Write-Host -ForegroundColor red " + ${Output}"
|
||||
}
|
||||
}
|
||||
|
||||
function Test-CommandExists {
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String] $Command
|
||||
)
|
||||
|
||||
$CommandExists = $false
|
||||
$OldActionPref = $ErrorActionPreference
|
||||
$ErrorActionPreference = "stop"
|
||||
|
||||
try {
|
||||
if (Get-Command $Command) {
|
||||
$CommandExists = $true
|
||||
}
|
||||
} Catch {
|
||||
$CommandExists = $false
|
||||
} Finally {
|
||||
$ErrorActionPreference = $OldActionPref
|
||||
}
|
||||
|
||||
return $CommandExists
|
||||
}
|
||||
|
||||
function Ensure-Directory {
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String] $Directory
|
||||
)
|
||||
|
||||
if (!(Test-Path $Directory)) {
|
||||
$null = New-Item -ItemType Directory -Force -Path $Directory
|
||||
}
|
||||
|
||||
Set-Location -Path $Directory
|
||||
}
|
||||
|
||||
function Invoke-External {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Invokes a non-PowerShell command.
|
||||
.DESCRIPTION
|
||||
Runs a non-PowerShell command, and captures its return code.
|
||||
Throws an exception if the command returns non-zero.
|
||||
.EXAMPLE
|
||||
Invoke-External 7z x $MyArchive
|
||||
#>
|
||||
|
||||
if ( $args.Count -eq 0 ) {
|
||||
throw 'Invoke-External called without arguments.'
|
||||
}
|
||||
|
||||
$Command = $args[0]
|
||||
$CommandArgs = @()
|
||||
|
||||
if ( $args.Count -gt 1) {
|
||||
$CommandArgs = $args[1..($args.Count - 1)]
|
||||
}
|
||||
|
||||
$_EAP = $ErrorActionPreference
|
||||
$ErrorActionPreference = "Continue"
|
||||
|
||||
Write-Debug "Invoke-External: ${Command} ${CommandArgs}"
|
||||
|
||||
& $command $commandArgs
|
||||
$Result = $LASTEXITCODE
|
||||
|
||||
$ErrorActionPreference = $_EAP
|
||||
|
||||
if ( $Result -ne 0 ) {
|
||||
throw "${Command} ${CommandArgs} exited with non-zero code ${Result}."
|
||||
}
|
||||
}
|
||||
|
||||
$BuildDirectory = "$(if (Test-Path Env:BuildDirectory) { $env:BuildDirectory } else { $BuildDirectory })"
|
||||
$BuildConfiguration = "$(if (Test-Path Env:BuildConfiguration) { $env:BuildConfiguration } else { $BuildConfiguration })"
|
||||
$BuildArch = "$(if (Test-Path Env:BuildArch) { $env:BuildArch } else { $BuildArch })"
|
||||
$WindowsDepsVersion = "$(if (Test-Path Env:WindowsDepsVersion ) { $env:WindowsDepsVersion } else { $CIDepsVersion })"
|
||||
$WindowsQtVersion = "$(if (Test-Path Env:WindowsQtVersion ) { $env:WindowsQtVersion } else { $CIQtVersion })"
|
||||
$WindowsVlcVersion = "$(if (Test-Path Env:WindowsVlcVersion ) { $env:WindowsVlcVersion } else { $CIVlcVersion })"
|
||||
$WindowsCefVersion = "$(if (Test-Path Env:WindowsCefVersion ) { $env:WindowsCefVersion } else { $CICefVersion })"
|
||||
$CmakeSystemVersion = "$(if (Test-Path Env:CMAKE_SYSTEM_VERSION) { $Env:CMAKE_SYSTEM_VERSION } else { "10.0.18363.657" })"
|
||||
$CmakeGenerator = "$(if (Test-Path Env:CmakeGenerator) { $Env:CmakeGenerator } else { $CIGenerator })"
|
||||
|
||||
|
||||
function Install-Windows-Dependencies {
|
||||
$WingetFile = "$PSScriptRoot/Wingetfile"
|
||||
|
||||
$Host64Bit = [System.Environment]::Is64BitOperatingSystem
|
||||
|
||||
$Prefix = (${Env:ProgramFiles(x86)}, $Env:ProgramFiles)[$Host64Bit]
|
||||
|
||||
$Paths = $Env:Path -split [System.IO.Path]::PathSeparator
|
||||
|
||||
$WingetOptions = @('install', '--accept-package-agreements', '--accept-source-agreements')
|
||||
|
||||
if ( $script:Quiet ) {
|
||||
$WingetOptions += '--silent'
|
||||
}
|
||||
|
||||
Get-Content $WingetFile | ForEach-Object {
|
||||
$_, $Package, $_, $Path, $_, $Binary = $_ -replace ',','' -replace "'", '' -split ' '
|
||||
|
||||
$FullPath = "${Prefix}\${Path}"
|
||||
if ( ( Test-Path $FullPath ) -and ! ( $Paths -contains $FullPath ) ) {
|
||||
$Paths += $FullPath
|
||||
$Env:Path = $Paths -join [System.IO.Path]::PathSeparator
|
||||
}
|
||||
|
||||
Write-Step "Checking for command ${Binary}"
|
||||
$Found = Get-Command -ErrorAction SilentlyContinue $Binary
|
||||
|
||||
if ( $Found ) {
|
||||
Write-Info "Found dependency ${Binary} as $($Found.Source)"
|
||||
} else {
|
||||
Write-Info "Installing package ${Package}"
|
||||
|
||||
try {
|
||||
$Params = $WingetOptions + $Package
|
||||
|
||||
winget @Params
|
||||
} catch {
|
||||
throw "Error while installing winget package ${Package}: $_"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,169 +0,0 @@
|
|||
Param(
|
||||
[Switch]$Help = $(if (Test-Path variable:Help) { $Help }),
|
||||
[Switch]$Quiet = $(if (Test-Path variable:Quiet) { $Quiet }),
|
||||
[Switch]$Verbose = $(if (Test-Path variable:Verbose) { $Verbose }),
|
||||
[ValidateSet('x86', 'x64')]
|
||||
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" } else { ('x86', 'x64')[[System.Environment]::Is64BitOperatingSystem] })
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# Windows dependency management function
|
||||
##############################################################################
|
||||
#
|
||||
# This script file can be included in build scripts for Windows or run
|
||||
# directly
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Function Install-obs-deps {
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$Version
|
||||
)
|
||||
|
||||
Write-Status "Setup for pre-built Windows OBS dependencies v${Version}"
|
||||
Ensure-Directory $DepsBuildDir
|
||||
|
||||
$ArchSuffix = $BuildArch
|
||||
|
||||
if (!(Test-Path "${DepsBuildDir}/windows-deps-${Version}-${ArchSuffix}")) {
|
||||
|
||||
Write-Step "Download..."
|
||||
curl.exe -Lf "https://github.com/obsproject/obs-deps/releases/download/${Version}/windows-deps-${Version}-${ArchSuffix}.zip" -o "windows-deps-${Version}-${ArchSuffix}.zip" $(if ($Quiet.isPresent) { "-s" })
|
||||
|
||||
Write-Step "Unpack..."
|
||||
|
||||
Expand-Archive -Path "windows-deps-${Version}-${ArchSuffix}.zip" -DestinationPath "${DepsBuildDir}/windows-deps-${Version}-${ArchSuffix}" -Force
|
||||
} else {
|
||||
Write-Step "Found existing pre-built dependencies..."
|
||||
}
|
||||
}
|
||||
|
||||
function Install-qt-deps {
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$Version
|
||||
)
|
||||
|
||||
Write-Status "Setup for pre-built dependency Qt v${Version}"
|
||||
Ensure-Directory $DepsBuildDir
|
||||
|
||||
$ArchSuffix = $BuildArch
|
||||
|
||||
if (!(Test-Path "${DepsBuildDir}/windows-deps-${Version}-${ArchSuffix}/mkspecs")) {
|
||||
|
||||
Write-Step "Download..."
|
||||
curl.exe -Lf "https://github.com/obsproject/obs-deps/releases/download/${Version}/windows-deps-qt6-${Version}-${ArchSuffix}.zip" -o "windows-deps-qt6-${Version}-${ArchSuffix}.zip" $(if ($Quiet.isPresent) { "-s" })
|
||||
|
||||
Write-Step "Unpack..."
|
||||
|
||||
Expand-Archive -Path "windows-deps-qt6-${Version}-${ArchSuffix}.zip" -DestinationPath "${DepsBuildDir}/windows-deps-${Version}-${ArchSuffix}" -Force
|
||||
} else {
|
||||
Write-Step "Found existing pre-built Qt..."
|
||||
}
|
||||
}
|
||||
|
||||
function Install-vlc {
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$Version
|
||||
)
|
||||
|
||||
Write-Status "Setup for dependency VLC v${Version}"
|
||||
Ensure-Directory $DepsBuildDir
|
||||
|
||||
if (!((Test-Path "$DepsBuildDir/vlc-${Version}") -and (Test-Path "$DepsBuildDir/vlc-${Version}/include/vlc/vlc.h"))) {
|
||||
Write-Step "Download..."
|
||||
curl.exe -Lf "https://cdn-fastly.obsproject.com/downloads/vlc.zip" -o "vlc_${Version}.zip" $(if ($Quiet.isPresent) { "-s" })
|
||||
|
||||
Write-Step "Unpack..."
|
||||
# Expand-Archive -Path "vlc_${Version}.zip"
|
||||
Invoke-Expression "7z x vlc_${Version}.zip -ovlc"
|
||||
Move-Item -Path vlc -Destination "vlc-${Version}"
|
||||
} else {
|
||||
Write-Step "Found existing VLC..."
|
||||
}
|
||||
}
|
||||
|
||||
function Install-cef {
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$Version
|
||||
)
|
||||
Write-Status "Setup for dependency CEF v${Version} - ${BuildArch}"
|
||||
|
||||
Ensure-Directory $DepsBuildDir
|
||||
$ArchSuffix = $BuildArch
|
||||
|
||||
if (!((Test-Path "${DepsBuildDir}/cef_binary_${Version}_windows_${ArchSuffix}") -and (Test-Path "${DepsBuildDir}/cef_binary_${Version}_windows_${ArchSuffix}/build/libcef_dll_wrapper/Release/libcef_dll_wrapper.lib"))) {
|
||||
Write-Step "Download..."
|
||||
curl.exe -Lf "https://cdn-fastly.obsproject.com/downloads/cef_binary_${Version}_windows_${ArchSuffix}.zip" -o "cef_binary_${Version}_windows_${ArchSuffix}.zip" $(if ($Quiet.isPresent) { "-s" })
|
||||
|
||||
Write-Step "Unpack..."
|
||||
Expand-Archive -Path "cef_binary_${Version}_windows_${ArchSuffix}.zip" -Force
|
||||
} else {
|
||||
Write-Step "Found existing CEF framework and loader library..."
|
||||
}
|
||||
}
|
||||
|
||||
function Install-Dependencies {
|
||||
Param(
|
||||
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" })
|
||||
)
|
||||
|
||||
Install-Windows-Dependencies
|
||||
|
||||
$BuildDependencies = @(
|
||||
@('obs-deps', $WindowsDepsVersion),
|
||||
@('qt-deps', $WindowsDepsVersion),
|
||||
@('vlc', $WindowsVlcVersion),
|
||||
@('cef', $WindowsCefVersion)
|
||||
)
|
||||
|
||||
Foreach($Dependency in ${BuildDependencies}) {
|
||||
$DependencyName = $Dependency[0]
|
||||
$DependencyVersion = $Dependency[1]
|
||||
|
||||
$FunctionName = "Install-${DependencyName}"
|
||||
Invoke-Expression "${FunctionName} -Version ${DependencyVersion}"
|
||||
}
|
||||
|
||||
Ensure-Directory ${CheckoutDir}
|
||||
}
|
||||
|
||||
function Install-Dependencies-Standalone {
|
||||
$ProductName = "OBS-Studio"
|
||||
$CheckoutDir = Resolve-Path -Path "$PSScriptRoot\..\.."
|
||||
$DepsBuildDir = "${CheckoutDir}/../obs-build-dependencies"
|
||||
$ObsBuildDir = "${CheckoutDir}/../obs-studio"
|
||||
|
||||
. ${CheckoutDir}/CI/include/build_support_windows.ps1
|
||||
|
||||
Write-Status "Setup of OBS build dependencies"
|
||||
Install-Dependencies
|
||||
}
|
||||
|
||||
function Print-Usage {
|
||||
$Lines = @(
|
||||
"Usage: ${_ScriptName}",
|
||||
"-Help : Print this help",
|
||||
"-Quiet : Suppress most build process output",
|
||||
"-Verbose : Enable more verbose build process output",
|
||||
"-Choco : Enable automatic dependency installation via Chocolatey - Default: off"
|
||||
"-BuildArch : Build architecture to use (x86 or x64) - Default: local architecture"
|
||||
)
|
||||
|
||||
$Lines | Write-Host
|
||||
}
|
||||
|
||||
if(!(Test-Path variable:_RunObsBuildScript)) {
|
||||
$_ScriptName = "$($MyInvocation.MyCommand.Name)"
|
||||
if($Help.isPresent) {
|
||||
Print-Usage
|
||||
exit 0
|
||||
}
|
||||
|
||||
Install-Dependencies-Standalone
|
||||
}
|
|
@ -1,161 +0,0 @@
|
|||
Param(
|
||||
[Switch]$Help = $(if (Test-Path variable:Help) { $Help }),
|
||||
[Switch]$Quiet = $(if (Test-Path variable:Quiet) { $Quiet }),
|
||||
[Switch]$Verbose = $(if (Test-Path variable:Verbose) { $Verbose }),
|
||||
[String]$BuildDirectory = $(if (Test-Path variable:BuildDirectory) { "${BuildDirectory}" } else { "build" }),
|
||||
[ValidateSet('x86', 'x64')]
|
||||
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" } else { ('x86', 'x64')[[System.Environment]::Is64BitOperatingSystem] }),
|
||||
[ValidateSet("Release", "RelWithDebInfo", "MinSizeRel", "Debug")]
|
||||
[String]$BuildConfiguration = $(if (Test-Path variable:BuildConfiguration) { "${BuildConfiguration}" } else { "RelWithDebInfo" })
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# Windows libobs library build function
|
||||
##############################################################################
|
||||
#
|
||||
# This script file can be included in build scripts for Windows or run
|
||||
# directly
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Build-OBS {
|
||||
Param(
|
||||
[String]$BuildDirectory = $(if (Test-Path variable:BuildDirectory) { "${BuildDirectory}" }),
|
||||
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" }),
|
||||
[String]$BuildConfiguration = $(if (Test-Path variable:BuildConfiguration) { "${BuildConfiguration}" })
|
||||
)
|
||||
|
||||
$NumProcessors = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
|
||||
|
||||
if ( $NumProcessors -gt 1 ) {
|
||||
$env:UseMultiToolTask = $true
|
||||
$env:EnforceProcessCountAcrossBuilds = $true
|
||||
}
|
||||
|
||||
Write-Status "Build OBS"
|
||||
|
||||
Configure-OBS
|
||||
|
||||
Ensure-Directory ${CheckoutDir}
|
||||
Write-Step "Build OBS targets..."
|
||||
|
||||
$BuildDirectoryActual = "${BuildDirectory}$(if (${BuildArch} -eq "x64") { "64" } else { "32" })"
|
||||
|
||||
Invoke-External cmake --build "${BuildDirectoryActual}" --config ${BuildConfiguration}
|
||||
}
|
||||
|
||||
function Configure-OBS {
|
||||
Ensure-Directory ${CheckoutDir}
|
||||
Write-Status "Configuration of OBS build system..."
|
||||
|
||||
$NumProcessors = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
|
||||
|
||||
if ( $NumProcessors -gt 1 ) {
|
||||
$env:UseMultiToolTask = $true
|
||||
$env:EnforceProcessCountAcrossBuilds = $true
|
||||
}
|
||||
|
||||
# TODO: Clean up archive and directory naming across dependencies
|
||||
$CmakePrefixPath = Resolve-Path -Path "${CheckoutDir}/../obs-build-dependencies/windows-deps-${WindowsDepsVersion}-${BuildArch}"
|
||||
$CefDirectory = Resolve-Path -Path "${CheckoutDir}/../obs-build-dependencies/cef_binary_${WindowsCefVersion}_windows_${BuildArch}"
|
||||
$BuildDirectoryActual = "${BuildDirectory}$(if (${BuildArch} -eq "x64") { "64" } else { "32" })"
|
||||
$GeneratorPlatform = "$(if (${BuildArch} -eq "x64") { "x64" } else { "Win32" })"
|
||||
|
||||
if ( $PSVersionTable.PSVersion -ge '7.3.0' ) {
|
||||
$CmakeCommand = @(
|
||||
"-G", ${CmakeGenerator}
|
||||
"-DCMAKE_GENERATOR_PLATFORM=${GeneratorPlatform}",
|
||||
"-DCMAKE_SYSTEM_VERSION=${CmakeSystemVersion}",
|
||||
"-DCMAKE_PREFIX_PATH:PATH=${CmakePrefixPath}",
|
||||
"-DCEF_ROOT_DIR:PATH=${CefDirectory}",
|
||||
"-DENABLE_BROWSER=ON",
|
||||
"-DVLC_PATH:PATH=${CheckoutDir}/../obs-build-dependencies/vlc-${WindowsVlcVersion}",
|
||||
"-DENABLE_VLC=ON",
|
||||
"-DCMAKE_INSTALL_PREFIX=${BuildDirectoryActual}/install",
|
||||
"-DVIRTUALCAM_GUID=${Env:VIRTUALCAM-GUID}",
|
||||
"-DTWITCH_CLIENTID=${Env:TWITCH_CLIENTID}",
|
||||
"-DTWITCH_HASH=${Env:TWITCH_HASH}",
|
||||
"-DRESTREAM_CLIENTID=${Env:RESTREAM_CLIENTID}",
|
||||
"-DRESTREAM_HASH=${Env:RESTREAM_HASH}",
|
||||
"-DYOUTUBE_CLIENTID=${Env:YOUTUBE_CLIENTID}",
|
||||
"-DYOUTUBE_CLIENTID_HASH=${Env:YOUTUBE_CLIENTID_HASH}",
|
||||
"-DYOUTUBE_SECRET=${Env:YOUTUBE_SECRET}",
|
||||
"-DYOUTUBE_SECRET_HASH=${Env:YOUTUBE_SECRET_HASH}",
|
||||
"-DGPU_PRIORITY_VAL=${Env:GPU_PRIORITY_VAL}",
|
||||
"-DCOPIED_DEPENDENCIES=OFF",
|
||||
"-DCOPY_DEPENDENCIES=ON",
|
||||
"-DBUILD_FOR_DISTRIBUTION=$(if (Test-Path Env:BUILD_FOR_DISTRIBUTION) { "ON" } else { "OFF" })",
|
||||
"$(if (Test-Path Env:CI) { "-DOBS_BUILD_NUMBER=${Env:GITHUB_RUN_ID}" })",
|
||||
"$(if (Test-Path Variable:$Quiet) { "-Wno-deprecated -Wno-dev --log-level=ERROR" })"
|
||||
)
|
||||
} else {
|
||||
$CmakeCommand = @(
|
||||
"-G", ${CmakeGenerator}
|
||||
"-DCMAKE_GENERATOR_PLATFORM=`"${GeneratorPlatform}`"",
|
||||
"-DCMAKE_SYSTEM_VERSION=`"${CmakeSystemVersion}`"",
|
||||
"-DCMAKE_PREFIX_PATH:PATH=`"${CmakePrefixPath}`"",
|
||||
"-DCEF_ROOT_DIR:PATH=`"${CefDirectory}`"",
|
||||
"-DENABLE_BROWSER=ON",
|
||||
"-DVLC_PATH:PATH=`"${CheckoutDir}/../obs-build-dependencies/vlc-${WindowsVlcVersion}`"",
|
||||
"-DENABLE_VLC=ON",
|
||||
"-DCMAKE_INSTALL_PREFIX=`"${BuildDirectoryActual}/install`"",
|
||||
"-DVIRTUALCAM_GUID=`"${Env:VIRTUALCAM-GUID}`"",
|
||||
"-DTWITCH_CLIENTID=`"${Env:TWITCH_CLIENTID}`"",
|
||||
"-DTWITCH_HASH=`"${Env:TWITCH_HASH}`"",
|
||||
"-DRESTREAM_CLIENTID=`"${Env:RESTREAM_CLIENTID}`"",
|
||||
"-DRESTREAM_HASH=`"${Env:RESTREAM_HASH}`"",
|
||||
"-DYOUTUBE_CLIENTID=`"${Env:YOUTUBE_CLIENTID}`"",
|
||||
"-DYOUTUBE_CLIENTID_HASH=`"${Env:YOUTUBE_CLIENTID_HASH}`"",
|
||||
"-DYOUTUBE_SECRET=`"${Env:YOUTUBE_SECRET}`"",
|
||||
"-DYOUTUBE_SECRET_HASH=`"${Env:YOUTUBE_SECRET_HASH}`"",
|
||||
"-DGPU_PRIORITY_VAL=`"${Env:GPU_PRIORITY_VAL}`"",
|
||||
"-DCOPIED_DEPENDENCIES=OFF",
|
||||
"-DCOPY_DEPENDENCIES=ON",
|
||||
"-DBUILD_FOR_DISTRIBUTION=`"$(if (Test-Path Env:BUILD_FOR_DISTRIBUTION) { "ON" } else { "OFF" })`"",
|
||||
"$(if (Test-Path Env:CI) { "-DOBS_BUILD_NUMBER=${Env:GITHUB_RUN_ID}" })",
|
||||
"$(if (Test-Path Variable:$Quiet) { "-Wno-deprecated -Wno-dev --log-level=ERROR" })"
|
||||
)
|
||||
}
|
||||
|
||||
Invoke-External cmake -S . -B "${BuildDirectoryActual}" @CmakeCommand
|
||||
|
||||
Ensure-Directory ${CheckoutDir}
|
||||
}
|
||||
|
||||
function Build-OBS-Standalone {
|
||||
$ProductName = "OBS-Studio"
|
||||
|
||||
$CheckoutDir = Resolve-Path -Path "$PSScriptRoot\..\.."
|
||||
$DepsBuildDir = "${CheckoutDir}/../obs-build-dependencies"
|
||||
$ObsBuildDir = "${CheckoutDir}/../obs-studio"
|
||||
|
||||
. ${CheckoutDir}/CI/include/build_support_windows.ps1
|
||||
|
||||
Build-OBS
|
||||
}
|
||||
|
||||
function Print-Usage {
|
||||
$Lines = @(
|
||||
"Usage: ${_ScriptName}",
|
||||
"-Help : Print this help",
|
||||
"-Quiet : Suppress most build process output",
|
||||
"-Verbose : Enable more verbose build process output",
|
||||
"-BuildDirectory : Directory to use for builds - Default: build64 on 64-bit systems, build32 on 32-bit systems",
|
||||
"-BuildArch : Build architecture to use (x86 or x64) - Default: local architecture",
|
||||
"-BuildConfiguration : Build configuration to use - Default: RelWithDebInfo"
|
||||
)
|
||||
|
||||
$Lines | Write-Host
|
||||
}
|
||||
|
||||
if(!(Test-Path variable:_RunObsBuildScript)) {
|
||||
$_ScriptName = "$($MyInvocation.MyCommand.Name)"
|
||||
if($Help.isPresent) {
|
||||
Print-Usage
|
||||
exit 0
|
||||
}
|
||||
|
||||
Build-OBS-Standalone
|
||||
}
|
|
@ -1,157 +0,0 @@
|
|||
Param(
|
||||
[Switch]$Help = $(if (Test-Path variable:Help) { $Help }),
|
||||
[Switch]$Quiet = $(if (Test-Path variable:Quiet) { $Quiet }),
|
||||
[Switch]$Verbose = $(if (Test-Path variable:Verbose) { $Verbose }),
|
||||
[Switch]$BuildInstaller = $(if ($BuildInstaller.isPresent) { $BuildInstaller }),
|
||||
[Switch]$CombinedArchs = $(if ($CombinedArchs.isPresent) { $CombinedArchs }),
|
||||
[String]$BuildDirectory = $(if (Test-Path variable:BuildDirectory) { "${BuildDirectory}" } else { "build" }),
|
||||
[ValidateSet('x86', 'x64')]
|
||||
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" } else { ('x86', 'x64')[[System.Environment]::Is64BitOperatingSystem] }),
|
||||
[ValidateSet("Release", "RelWithDebInfo", "MinSizeRel", "Debug")]
|
||||
[String]$BuildConfiguration = $(if (Test-Path variable:BuildConfiguration) { "${BuildConfiguration}" } else { "RelWithDebInfo" })
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# Windows OBS package function
|
||||
##############################################################################
|
||||
#
|
||||
# This script file can be included in build scripts for Windows or run
|
||||
# directly
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Package-OBS {
|
||||
Param(
|
||||
[String]$BuildDirectory = $(if (Test-Path variable:BuildDirectory) { "${BuildDirectory}" }),
|
||||
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" }),
|
||||
[String]$BuildConfiguration = $(if (Test-Path variable:BuildConfiguration) { "${BuildConfiguration}" })
|
||||
)
|
||||
|
||||
Write-Status "Package plugin ${ProductName}"
|
||||
Ensure-Directory ${CheckoutDir}
|
||||
|
||||
if ($CombinedArchs.isPresent) {
|
||||
if (!(Test-Path env:obsInstallerTempDir)) {
|
||||
$Env:obsInstallerTempDir = "${CheckoutDir}/install_temp"
|
||||
}
|
||||
|
||||
if (!(Test-Path ${CheckoutDir}/install_temp/bin/64bit)) {
|
||||
Write-Step "Build 64-bit OBS..."
|
||||
Invoke-Expression "cmake -S . -B `"${BuildDirectory}64`" -DCOPIED_DEPENDENCIES=OFF -DCOPY_DEPENDENCIES=ON"
|
||||
Invoke-Expression "cmake --build `"${BuildDirectory}64`" --config `"${BuildConfiguration}`""
|
||||
}
|
||||
|
||||
if (!(Test-Path ${CheckoutDir}/install_temp/bin/32bit)) {
|
||||
Write-Step "Build 32-bit OBS..."
|
||||
Invoke-Expression "cmake -S . -B `"${BuildDirectory}32`" -DCOPIED_DEPENDENCIES=OFF -DCOPY_DEPENDENCIES=ON"
|
||||
Invoke-Expression "cmake --build `"${BuildDirectory}32`" --config `"${BuildConfiguration}`""
|
||||
}
|
||||
|
||||
Write-Step "Prepare Installer run..."
|
||||
Invoke-Expression "cmake -S . -B build -DINSTALLER_RUN=ON -DCMAKE_INSTALL_PREFIX=`"${CheckoutDir}/build/install`""
|
||||
Write-Step "Execute Installer run..."
|
||||
Invoke-Expression "cmake --build build --config `"${BuildConfiguration}`" -t install"
|
||||
|
||||
$CompressVars = @{
|
||||
Path = "${CheckoutDir}/build/install/*"
|
||||
CompressionLevel = "Optimal"
|
||||
DestinationPath = "${FileName}-x86+x64.zip"
|
||||
}
|
||||
|
||||
Write-Step "Creating zip archive..."
|
||||
|
||||
$ProgressPreference = $(if ($Quiet.isPresent) { 'SilentlyContinue' } else { 'Continue' })
|
||||
Compress-Archive -Force @CompressVars
|
||||
$ProgressPreference = 'Continue'
|
||||
|
||||
} elseif ($BuildArch -eq "x64") {
|
||||
Write-Step "Install 64-bit OBS..."
|
||||
Invoke-Expression "cmake --build `"${BuildDirectory}64`" --config ${BuildConfiguration} -t install"
|
||||
|
||||
$CompressVars = @{
|
||||
Path = "${CheckoutDir}/build64/install/bin", "${CheckoutDir}/build64/install/data", "${CheckoutDir}/build64/install/obs-plugins"
|
||||
CompressionLevel = "Optimal"
|
||||
DestinationPath = "${FileName}-x64.zip"
|
||||
}
|
||||
|
||||
Write-Step "Creating zip archive..."
|
||||
|
||||
$ProgressPreference = $(if ($Quiet.isPresent) { 'SilentlyContinue' } else { 'Continue' })
|
||||
Compress-Archive -Force @CompressVars
|
||||
$ProgressPreference = 'Continue'
|
||||
|
||||
} elseif ($BuildArch -eq "x86") {
|
||||
Write-Step "Install 32-bit OBS..."
|
||||
Invoke-Expression "cmake --build `"${BuildDirectory}32`" --config ${BuildConfiguration} -t install"
|
||||
|
||||
$CompressVars = @{
|
||||
Path = "${CheckoutDir}/build32/install/bin", "${CheckoutDir}/build32/install/data", "${CheckoutDir}/build32/install/obs-plugins"
|
||||
CompressionLevel = "Optimal"
|
||||
DestinationPath = "${FileName}-x86.zip"
|
||||
}
|
||||
|
||||
Write-Step "Creating zip archive..."
|
||||
|
||||
$ProgressPreference = $(if ($Quiet.isPresent) { 'SilentlyContinue' } else { 'Continue' })
|
||||
Compress-Archive -Force @CompressVars
|
||||
$ProgressPreference = 'Continue'
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function Package-OBS-Standalone {
|
||||
$ProductName = "OBS-Studio"
|
||||
$CheckoutDir = Resolve-Path -Path "$PSScriptRoot\..\.."
|
||||
|
||||
. ${CheckoutDir}/CI/include/build_support_windows.ps1
|
||||
|
||||
if (!(Test-Path Env:CI)) {
|
||||
Write-Step "Fetch OBS tags..."
|
||||
$null = git fetch --tags origin
|
||||
}
|
||||
|
||||
Ensure-Directory ${CheckoutDir}
|
||||
$GitBranch = git rev-parse --abbrev-ref HEAD
|
||||
$GitHash = git rev-parse --short=9 HEAD
|
||||
$ErrorActionPreference = "SilentlyContinue"
|
||||
$GitTag = git describe --tags --abbrev=0
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if(Test-Path variable:BUILD_FOR_DISTRIBUTION) {
|
||||
$VersionString = "${GitTag}"
|
||||
} else {
|
||||
$VersionString = "${GitTag}-${GitHash}"
|
||||
}
|
||||
|
||||
$FileName = "obs-studio-${VersionString}-windows"
|
||||
|
||||
Package-OBS
|
||||
}
|
||||
|
||||
function Print-Usage {
|
||||
$Lines = @(
|
||||
"Usage: ${_ScriptName}",
|
||||
"-Help : Print this help",
|
||||
"-Quiet : Suppress most build process output",
|
||||
"-Verbose : Enable more verbose build process output",
|
||||
"-CombinedArchs : Create combined architecture package",
|
||||
"-BuildDirectory : Directory to use for builds - Default: build64 on 64-bit systems, build32 on 32-bit systems",
|
||||
"-BuildArch : Build architecture to use (x86 or x64) - Default: local architecture",
|
||||
"-BuildConfiguration : Build configuration to use - Default: RelWithDebInfo"
|
||||
)
|
||||
|
||||
$Lines | Write-Host
|
||||
}
|
||||
|
||||
|
||||
if(!(Test-Path variable:_RunObsBuildScript)) {
|
||||
$_ScriptName = "$($MyInvocation.MyCommand.Name)"
|
||||
if($Help.isPresent) {
|
||||
Print-Usage
|
||||
exit 0
|
||||
}
|
||||
|
||||
Package-OBS-Standalone
|
||||
}
|
Loading…
Reference in a new issue