mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-05-14 10:24:12 -04:00
CI: Simplify build scripts for CI-only use
This commit is contained in:
82
.github/scripts/Build-Windows.ps1
vendored
82
.github/scripts/Build-Windows.ps1
vendored
@@ -3,10 +3,7 @@ param(
|
||||
[ValidateSet('x64')]
|
||||
[string] $Target = 'x64',
|
||||
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
|
||||
[string] $Configuration = 'RelWithDebInfo',
|
||||
[switch] $SkipAll,
|
||||
[switch] $SkipBuild,
|
||||
[switch] $SkipDeps
|
||||
[string] $Configuration = 'RelWithDebInfo'
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
@@ -16,6 +13,10 @@ if ( $DebugPreference -eq 'Continue' ) {
|
||||
$InformationPreference = 'Continue'
|
||||
}
|
||||
|
||||
if ( $env:CI -eq $null ) {
|
||||
throw "Build-Windows.ps1 requires CI environment"
|
||||
}
|
||||
|
||||
if ( ! ( [System.Environment]::Is64BitOperatingSystem ) ) {
|
||||
throw "obs-studio requires a 64-bit system to build and run."
|
||||
}
|
||||
@@ -46,57 +47,40 @@ function Build {
|
||||
|
||||
$BuildSpec = Get-Content -Path ${BuildSpecFile} -Raw | ConvertFrom-Json
|
||||
|
||||
if ( ! $SkipDeps ) {
|
||||
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
|
||||
}
|
||||
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
|
||||
|
||||
Push-Location -Stack BuildTemp
|
||||
if ( ! ( ( $SkipAll ) -or ( $SkipBuild ) ) ) {
|
||||
Ensure-Location $ProjectRoot
|
||||
Ensure-Location $ProjectRoot
|
||||
|
||||
$Preset = "windows-$(if ( $env:CI -ne $null ) { 'ci-' })${Target}"
|
||||
$CmakeArgs = @(
|
||||
'--preset', $Preset
|
||||
)
|
||||
$CmakeArgs = @('--preset', "windows-ci-${Target}")
|
||||
$CmakeBuildArgs = @('--build')
|
||||
$CmakeInstallArgs = @()
|
||||
|
||||
$CmakeBuildArgs = @('--build')
|
||||
$CmakeInstallArgs = @()
|
||||
|
||||
if ( ( $env:CI -ne $null ) -and ( $env:CCACHE_CONFIGPATH -ne $null ) ) {
|
||||
$CmakeArgs += @(
|
||||
"-DENABLE_CCACHE:BOOL=TRUE"
|
||||
)
|
||||
}
|
||||
|
||||
if ( $VerbosePreference -eq 'Continue' ) {
|
||||
$CmakeBuildArgs += ('--verbose')
|
||||
$CmakeInstallArgs += ('--verbose')
|
||||
}
|
||||
|
||||
if ( $DebugPreference -eq 'Continue' ) {
|
||||
$CmakeArgs += ('--debug-output')
|
||||
}
|
||||
|
||||
$CmakeBuildArgs += @(
|
||||
'--preset', "windows-${Target}"
|
||||
'--config', $Configuration
|
||||
'--parallel'
|
||||
'--', '/consoleLoggerParameters:Summary', '/noLogo'
|
||||
)
|
||||
|
||||
$CmakeInstallArgs += @(
|
||||
'--install', "build_${Target}"
|
||||
'--prefix', "${ProjectRoot}/build_${Target}/install"
|
||||
'--config', $Configuration
|
||||
)
|
||||
|
||||
Log-Group "Configuring obs-studio..."
|
||||
Invoke-External cmake @CmakeArgs
|
||||
|
||||
Log-Group "Building obs-studio..."
|
||||
Invoke-External cmake @CmakeBuildArgs
|
||||
if ( $DebugPreference -eq 'Continue' ) {
|
||||
$CmakeArgs += ('--debug-output')
|
||||
$CmakeBuildArgs += ('--verbose')
|
||||
$CmakeInstallArgs += ('--verbose')
|
||||
}
|
||||
|
||||
$CmakeBuildArgs += @(
|
||||
'--preset', "windows-${Target}"
|
||||
'--config', $Configuration
|
||||
'--parallel'
|
||||
'--', '/consoleLoggerParameters:Summary', '/noLogo'
|
||||
)
|
||||
|
||||
$CmakeInstallArgs += @(
|
||||
'--install', "build_${Target}"
|
||||
'--prefix', "${ProjectRoot}/build_${Target}/install"
|
||||
'--config', $Configuration
|
||||
)
|
||||
|
||||
Log-Group "Configuring obs-studio..."
|
||||
Invoke-External cmake @CmakeArgs
|
||||
|
||||
Log-Group "Building obs-studio..."
|
||||
Invoke-External cmake @CmakeBuildArgs
|
||||
|
||||
Log-Group "Installing obs-studio..."
|
||||
Invoke-External cmake @CmakeInstallArgs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user