Add CI build infrastructure from OBS plugin template
Some checks are pending
Build Windows DLL / Build for Windows (push) Waiting to run
Some checks are pending
Build Windows DLL / Build for Windows (push) Waiting to run
Added GitHub Actions workflow and build scripts from obsproject/obs-plugintemplate for Windows DLL builds. Push to GitHub and go to Actions tab to build the DLL.
This commit is contained in:
parent
184d132b59
commit
c5b35d8ec8
9 changed files with 928 additions and 47 deletions
113
.github/actions/build-plugin/action.yaml
vendored
Normal file
113
.github/actions/build-plugin/action.yaml
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
name: Set up and build plugin
|
||||
description: Builds the plugin for specified architecture and build config
|
||||
inputs:
|
||||
target:
|
||||
description: Target architecture for dependencies
|
||||
required: true
|
||||
config:
|
||||
description: Build configuration
|
||||
required: false
|
||||
default: RelWithDebInfo
|
||||
codesign:
|
||||
description: Enable codesigning (macOS only)
|
||||
required: false
|
||||
default: 'false'
|
||||
codesignIdent:
|
||||
description: Developer ID for application codesigning (macOS only)
|
||||
required: false
|
||||
default: '-'
|
||||
codesignTeam:
|
||||
description: Team ID for application codesigning (macOS only)
|
||||
required: false
|
||||
default: ''
|
||||
workingDirectory:
|
||||
description: Working directory for packaging
|
||||
required: false
|
||||
default: ${{ github.workspace }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Run macOS Build
|
||||
if: runner.os == 'macOS'
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
working-directory: ${{ inputs.workingDirectory }}
|
||||
env:
|
||||
CCACHE_DIR: ${{ inputs.workingDirectory }}/.ccache
|
||||
CODESIGN_IDENT: ${{ inputs.codesignIdent }}
|
||||
CODESIGN_TEAM: ${{ inputs.codesignTeam }}
|
||||
run: |
|
||||
: Run macOS Build
|
||||
|
||||
local -a build_args=(--config ${{ inputs.config }})
|
||||
if (( ${+RUNNER_DEBUG} )) build_args+=(--debug)
|
||||
|
||||
if [[ '${{ inputs.codesign }}' == 'true' ]] build_args+=(--codesign)
|
||||
|
||||
.github/scripts/build-macos ${build_args}
|
||||
|
||||
- name: Install Dependencies 🛍️
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
: Install Dependencies 🛍️
|
||||
echo ::group::Install Dependencies
|
||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
|
||||
brew install --quiet zsh
|
||||
echo ::endgroup::
|
||||
|
||||
- name: Run Ubuntu Build
|
||||
if: runner.os == 'Linux'
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
working-directory: ${{ inputs.workingDirectory }}
|
||||
env:
|
||||
CCACHE_DIR: ${{ inputs.workingDirectory }}/.ccache
|
||||
run: |
|
||||
: Run Ubuntu Build
|
||||
|
||||
local -a build_args=(
|
||||
--target ubuntu-${{ inputs.target }}
|
||||
--config ${{ inputs.config }}
|
||||
)
|
||||
if (( ${+RUNNER_DEBUG} )) build_args+=(--debug)
|
||||
|
||||
.github/scripts/build-ubuntu ${build_args}
|
||||
|
||||
- name: Run Windows Build
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: |
|
||||
# Run Windows Build
|
||||
if ( $Env:RUNNER_DEBUG -ne $null ) {
|
||||
Set-PSDebug -Trace 1
|
||||
}
|
||||
|
||||
$BuildArgs = @{
|
||||
Target = '${{ inputs.target }}'
|
||||
Configuration = '${{ inputs.config }}'
|
||||
}
|
||||
|
||||
.github/scripts/Build-Windows.ps1 @BuildArgs
|
||||
|
||||
- name: Create Summary 📊
|
||||
if: contains(fromJSON('["Linux", "macOS"]'),runner.os)
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
env:
|
||||
CCACHE_DIR: ${{ inputs.workingDirectory }}/.ccache
|
||||
run: |
|
||||
: Create Summary 📊
|
||||
|
||||
local -a ccache_data
|
||||
if (( ${+RUNNER_DEBUG} )) {
|
||||
setopt XTRACE
|
||||
ccache_data=("${(fA)$(ccache -s -vv)}")
|
||||
} else {
|
||||
ccache_data=("${(fA)$(ccache -s)}")
|
||||
}
|
||||
|
||||
print '### ${{ runner.os }} Ccache Stats (${{ inputs.target }})' >> $GITHUB_STEP_SUMMARY
|
||||
print '```' >> $GITHUB_STEP_SUMMARY
|
||||
for line (${ccache_data}) {
|
||||
print ${line} >> $GITHUB_STEP_SUMMARY
|
||||
}
|
||||
print '```' >> $GITHUB_STEP_SUMMARY
|
||||
113
.github/actions/package-plugin/action.yaml
vendored
Normal file
113
.github/actions/package-plugin/action.yaml
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
name: Package plugin
|
||||
description: Packages the plugin for specified architecture and build config.
|
||||
inputs:
|
||||
target:
|
||||
description: Build target for dependencies
|
||||
required: true
|
||||
config:
|
||||
description: Build configuration
|
||||
required: false
|
||||
default: RelWithDebInfo
|
||||
codesign:
|
||||
description: Enable codesigning (macOS only)
|
||||
required: false
|
||||
default: 'false'
|
||||
notarize:
|
||||
description: Enable notarization (macOS only)
|
||||
required: false
|
||||
default: 'false'
|
||||
codesignIdent:
|
||||
description: Developer ID for application codesigning (macOS only)
|
||||
required: false
|
||||
default: '-'
|
||||
installerIdent:
|
||||
description: Developer ID for installer package codesigning (macOS only)
|
||||
required: false
|
||||
default: ''
|
||||
codesignTeam:
|
||||
description: Developer team for codesigning (macOS only)
|
||||
required: false
|
||||
default: ''
|
||||
codesignUser:
|
||||
description: Apple ID username for notarization (macOS only)
|
||||
required: false
|
||||
default: ''
|
||||
codesignPass:
|
||||
description: Apple ID password for notarization (macOS only)
|
||||
required: false
|
||||
default: ''
|
||||
package:
|
||||
description: Create Windows or macOS installation package
|
||||
required: false
|
||||
default: 'false'
|
||||
workingDirectory:
|
||||
description: Working directory for packaging
|
||||
required: false
|
||||
default: ${{ github.workspace }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Run macOS Packaging
|
||||
if: runner.os == 'macOS'
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
working-directory: ${{ inputs.workingDirectory }}
|
||||
env:
|
||||
CODESIGN_IDENT: ${{ inputs.codesignIdent }}
|
||||
CODESIGN_IDENT_INSTALLER: ${{ inputs.installerIdent }}
|
||||
CODESIGN_TEAM: ${{ inputs.codesignTeam }}
|
||||
CODESIGN_IDENT_USER: ${{ inputs.codesignUser }}
|
||||
CODESIGN_IDENT_PASS: ${{ inputs.codesignPass }}
|
||||
run: |
|
||||
: Run macOS Packaging
|
||||
|
||||
local -a package_args=(--config ${{ inputs.config }})
|
||||
if (( ${+RUNNER_DEBUG} )) package_args+=(--debug)
|
||||
|
||||
if [[ '${{ inputs.codesign }}' == 'true' ]] package_args+=(--codesign)
|
||||
if [[ '${{ inputs.notarize }}' == 'true' ]] package_args+=(--notarize)
|
||||
if [[ '${{ inputs.package }}' == 'true' ]] package_args+=(--package)
|
||||
|
||||
.github/scripts/package-macos ${package_args}
|
||||
|
||||
- name: Install Dependencies 🛍️
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
: Install Dependencies 🛍️
|
||||
echo ::group::Install Dependencies
|
||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
|
||||
brew install --quiet zsh
|
||||
echo ::endgroup::
|
||||
|
||||
- name: Run Ubuntu Packaging
|
||||
if: runner.os == 'Linux'
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
working-directory: ${{ inputs.workingDirectory }}
|
||||
run: |
|
||||
: Run Ubuntu Packaging
|
||||
package_args=(
|
||||
--target ubuntu-${{ inputs.target }}
|
||||
--config ${{ inputs.config }}
|
||||
)
|
||||
if (( ${+RUNNER_DEBUG} )) build_args+=(--debug)
|
||||
|
||||
if [[ '${{ inputs.package }}' == 'true' ]] package_args+=(--package)
|
||||
|
||||
.github/scripts/package-ubuntu ${package_args}
|
||||
|
||||
- name: Run Windows Packaging
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: |
|
||||
# Run Windows Packaging
|
||||
if ( $Env:RUNNER_DEBUG -ne $null ) {
|
||||
Set-PSDebug -Trace 1
|
||||
}
|
||||
|
||||
$PackageArgs = @{
|
||||
Target = '${{ inputs.target }}'
|
||||
Configuration = '${{ inputs.config }}'
|
||||
}
|
||||
|
||||
.github/scripts/Package-Windows.ps1 @PackageArgs
|
||||
86
.github/scripts/Build-Windows.ps1
vendored
Normal file
86
.github/scripts/Build-Windows.ps1
vendored
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
[CmdletBinding()]
|
||||
param(
|
||||
[ValidateSet('x64')]
|
||||
[string] $Target = 'x64',
|
||||
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
|
||||
[string] $Configuration = 'RelWithDebInfo'
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
if ( $DebugPreference -eq 'Continue' ) {
|
||||
$VerbosePreference = 'Continue'
|
||||
$InformationPreference = 'Continue'
|
||||
}
|
||||
|
||||
if ( $env:CI -eq $null ) {
|
||||
throw "Build-Windows.ps1 requires CI environment"
|
||||
}
|
||||
|
||||
if ( ! ( [System.Environment]::Is64BitOperatingSystem ) ) {
|
||||
throw "A 64-bit system is required to build the project."
|
||||
}
|
||||
|
||||
if ( $PSVersionTable.PSVersion -lt '7.2.0' ) {
|
||||
Write-Warning 'The obs-studio PowerShell build script requires PowerShell Core 7. Install or upgrade your PowerShell version: https://aka.ms/pscore6'
|
||||
exit 2
|
||||
}
|
||||
|
||||
function Build {
|
||||
trap {
|
||||
Pop-Location -Stack BuildTemp -ErrorAction 'SilentlyContinue'
|
||||
Write-Error $_
|
||||
Log-Group
|
||||
exit 2
|
||||
}
|
||||
|
||||
$ScriptHome = $PSScriptRoot
|
||||
$ProjectRoot = Resolve-Path -Path "$PSScriptRoot/../.."
|
||||
|
||||
$UtilityFunctions = Get-ChildItem -Path $PSScriptRoot/utils.pwsh/*.ps1 -Recurse
|
||||
|
||||
foreach($Utility in $UtilityFunctions) {
|
||||
Write-Debug "Loading $($Utility.FullName)"
|
||||
. $Utility.FullName
|
||||
}
|
||||
|
||||
Push-Location -Stack BuildTemp
|
||||
Ensure-Location $ProjectRoot
|
||||
|
||||
$CmakeArgs = @('--preset', "windows-ci-${Target}")
|
||||
$CmakeBuildArgs = @('--build')
|
||||
$CmakeInstallArgs = @()
|
||||
|
||||
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}/release/${Configuration}"
|
||||
'--config', $Configuration
|
||||
)
|
||||
|
||||
Log-Group "Configuring ${ProductName}..."
|
||||
Invoke-External cmake @CmakeArgs
|
||||
|
||||
Log-Group "Building ${ProductName}..."
|
||||
Invoke-External cmake @CmakeBuildArgs
|
||||
|
||||
Log-Group "Installing ${ProductName}..."
|
||||
Invoke-External cmake @CmakeInstallArgs
|
||||
|
||||
Pop-Location -Stack BuildTemp
|
||||
Log-Group
|
||||
}
|
||||
|
||||
Build
|
||||
153
.github/scripts/build-macos
vendored
Normal file
153
.github/scripts/build-macos
vendored
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
builtin emulate -L zsh
|
||||
setopt EXTENDED_GLOB
|
||||
setopt PUSHD_SILENT
|
||||
setopt ERR_EXIT
|
||||
setopt ERR_RETURN
|
||||
setopt NO_UNSET
|
||||
setopt PIPE_FAIL
|
||||
setopt NO_AUTO_PUSHD
|
||||
setopt NO_PUSHD_IGNORE_DUPS
|
||||
setopt FUNCTION_ARGZERO
|
||||
|
||||
## Enable for script debugging
|
||||
# setopt WARN_CREATE_GLOBAL
|
||||
# setopt WARN_NESTED_VAR
|
||||
# setopt XTRACE
|
||||
|
||||
if (( ! ${+CI} )) {
|
||||
print -u2 -PR "%F{1} ✖︎ ${ZSH_ARGZERO:t:r} requires CI environment.%f"
|
||||
exit 1
|
||||
}
|
||||
|
||||
autoload -Uz is-at-least && if ! is-at-least 5.9; then
|
||||
print -u2 -PR "${CI:+::error::}%F{1}${funcstack[1]##*/}:%f Running on Zsh version %B${ZSH_VERSION}%b, but Zsh %B5.2%b is the minimum supported version. Upgrade Zsh to fix this issue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TRAPZERR() {
|
||||
print -u2 -PR "::error::%F{1} ✖︎ script execution error%f"
|
||||
print -PR -e "
|
||||
Callstack:
|
||||
${(j:\n :)funcfiletrace}
|
||||
"
|
||||
|
||||
exit 2
|
||||
}
|
||||
|
||||
build() {
|
||||
if (( ! ${+SCRIPT_HOME} )) typeset -g SCRIPT_HOME=${ZSH_ARGZERO:A:h}
|
||||
local host_os='macos'
|
||||
local project_root=${SCRIPT_HOME:A:h:h}
|
||||
local buildspec_file=${project_root}/buildspec.json
|
||||
|
||||
fpath=("${SCRIPT_HOME}/utils.zsh" ${fpath})
|
||||
autoload -Uz log_group log_info log_error log_output check_macos setup_ccache
|
||||
|
||||
if [[ ! -r ${buildspec_file} ]] {
|
||||
log_error \
|
||||
'No buildspec.json found. Please create a build specification for your project.'
|
||||
return 2
|
||||
}
|
||||
|
||||
local -i debug=0
|
||||
|
||||
local config='RelWithDebInfo'
|
||||
local -r -a _valid_configs=(Debug RelWithDebInfo Release MinSizeRel)
|
||||
local -i codesign=0
|
||||
|
||||
local -a args
|
||||
while (( # )) {
|
||||
case ${1} {
|
||||
-c|--config)
|
||||
if (( # == 1 )) || [[ ${2:0:1} == '-' ]] {
|
||||
log_error "Missing value for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
;;
|
||||
}
|
||||
case ${1} {
|
||||
--) shift; args+=($@); break ;;
|
||||
-c|--config)
|
||||
if (( ! ${_valid_configs[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
exit 2
|
||||
}
|
||||
config=${2}
|
||||
shift 2
|
||||
;;
|
||||
-s|--codesign) codesign=1; shift ;;
|
||||
--debug) debug=1; shift ;;
|
||||
*) log_error "Unknown option: %B${1}%b"; exit 2 ;;
|
||||
}
|
||||
}
|
||||
|
||||
set -- ${(@)args}
|
||||
|
||||
check_macos
|
||||
|
||||
local product_name
|
||||
local product_version
|
||||
read -r product_name product_version <<< \
|
||||
"$(jq -r '. | {name, version} | join(" ")' ${buildspec_file})"
|
||||
|
||||
pushd ${project_root}
|
||||
|
||||
local -a cmake_args=()
|
||||
local -a cmake_build_args=(--build)
|
||||
local -a cmake_install_args=(--install)
|
||||
|
||||
if (( debug )) cmake_args+=(--debug-output)
|
||||
|
||||
cmake_args+=(--preset 'macos-ci')
|
||||
|
||||
typeset -gx NSUnbufferedIO=YES
|
||||
|
||||
typeset -gx CODESIGN_IDENT="${CODESIGN_IDENT:--}"
|
||||
if (( codesign )) && [[ -z ${CODESIGN_TEAM} ]] {
|
||||
typeset -gx CODESIGN_TEAM="$(print "${CODESIGN_IDENT}" | /usr/bin/sed -En 's/.+\((.+)\)/\1/p')"
|
||||
}
|
||||
|
||||
log_group "Configuring ${product_name}..."
|
||||
cmake -S ${project_root} ${cmake_args}
|
||||
|
||||
log_group "Building ${product_name}..."
|
||||
run_xcodebuild() {
|
||||
if (( debug )) {
|
||||
xcodebuild ${@}
|
||||
} else {
|
||||
if [[ ${GITHUB_EVENT_NAME} == push ]] {
|
||||
xcodebuild ${@} 2>&1 | xcbeautify --renderer terminal
|
||||
} else {
|
||||
xcodebuild ${@} 2>&1 | xcbeautify --renderer github-actions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local -a build_args=(
|
||||
ONLY_ACTIVE_ARCH=NO
|
||||
-arch arm64
|
||||
-arch x86_64
|
||||
-project ${product_name}.xcodeproj
|
||||
-target ${product_name}
|
||||
-destination "generic/platform=macOS,name=Any Mac"
|
||||
-configuration ${config}
|
||||
-parallelizeTargets
|
||||
-hideShellScriptEnvironment
|
||||
build
|
||||
)
|
||||
|
||||
pushd build_macos
|
||||
run_xcodebuild ${build_args}
|
||||
popd
|
||||
|
||||
log_group "Installing ${product_name}..."
|
||||
cmake --install build_macos --config ${config} --prefix "${project_root}/release/${config}"
|
||||
|
||||
popd
|
||||
log_group
|
||||
}
|
||||
|
||||
build ${@}
|
||||
232
.github/scripts/build-ubuntu
vendored
Normal file
232
.github/scripts/build-ubuntu
vendored
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
builtin emulate -L zsh
|
||||
setopt EXTENDED_GLOB
|
||||
setopt PUSHD_SILENT
|
||||
setopt ERR_EXIT
|
||||
setopt ERR_RETURN
|
||||
setopt NO_UNSET
|
||||
setopt PIPE_FAIL
|
||||
setopt NO_AUTO_PUSHD
|
||||
setopt NO_PUSHD_IGNORE_DUPS
|
||||
setopt FUNCTION_ARGZERO
|
||||
|
||||
## Enable for script debugging
|
||||
# setopt WARN_CREATE_GLOBAL
|
||||
# setopt WARN_NESTED_VAR
|
||||
# setopt XTRACE
|
||||
|
||||
autoload -Uz is-at-least && if ! is-at-least 5.2; then
|
||||
print -u2 -PR "${CI:+::error::}%F{1}${funcstack[1]##*/}:%f Running on Zsh version %B${ZSH_VERSION}%b, but Zsh %B5.2%b is the minimum supported version. Upgrade Zsh to fix this issue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TRAPZERR() {
|
||||
if (( ${_loglevel:-3} > 2 )) {
|
||||
print -u2 -PR "${CI:+::error::}%F{1} ✖︎ script execution error%f"
|
||||
print -PR -e "
|
||||
Callstack:
|
||||
${(j:\n :)funcfiletrace}
|
||||
"
|
||||
}
|
||||
|
||||
exit 2
|
||||
}
|
||||
|
||||
build() {
|
||||
if (( ! ${+SCRIPT_HOME} )) typeset -g SCRIPT_HOME=${ZSH_ARGZERO:A:h}
|
||||
local host_os='ubuntu'
|
||||
local project_root=${SCRIPT_HOME:A:h:h}
|
||||
local buildspec_file=${project_root}/buildspec.json
|
||||
|
||||
fpath=("${SCRIPT_HOME}/utils.zsh" ${fpath})
|
||||
autoload -Uz log_group log_info log_error log_output set_loglevel check_ubuntu setup_ccache
|
||||
|
||||
if [[ ! -r ${buildspec_file} ]] {
|
||||
log_error \
|
||||
'No buildspec.json found. Please create a build specification for your project.'
|
||||
return 2
|
||||
}
|
||||
|
||||
local -i debug=0
|
||||
typeset -g -a skips=()
|
||||
local -i verbosity=1
|
||||
local -r _version='2.0.0'
|
||||
local -r -a _valid_targets=(
|
||||
ubuntu-x86_64
|
||||
)
|
||||
local target
|
||||
local config='RelWithDebInfo'
|
||||
local -r -a _valid_configs=(Debug RelWithDebInfo Release MinSizeRel)
|
||||
local -i codesign=0
|
||||
|
||||
local -r -a _valid_generators=(Ninja 'Unix Makefiles')
|
||||
local generator='Ninja'
|
||||
local -r _usage_host="
|
||||
%F{yellow} Additional options for Linux builds%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B--generator%b Specify build system to generate
|
||||
Available generators:
|
||||
- Ninja
|
||||
- Unix Makefiles"
|
||||
|
||||
local -i print_config=0
|
||||
local -r _usage="
|
||||
Usage: %B${functrace[1]%:*}%b <option> [<options>]
|
||||
|
||||
%BOptions%b:
|
||||
|
||||
%F{yellow} Build configuration options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-t | --target%b Specify target
|
||||
%B-c | --config%b Build configuration
|
||||
%B--skip-[all|build|deps]%b Skip all|building|checking for dependencies
|
||||
|
||||
%F{yellow} Output options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-q | --quiet%b Quiet (error output only)
|
||||
%B-v | --verbose%b Verbose (more detailed output)
|
||||
%B--debug%b Debug (very detailed and added output)
|
||||
|
||||
%F{yellow} General options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-h | --help%b Print this usage help
|
||||
%B-V | --version%b Print script version information
|
||||
${_usage_host:-}"
|
||||
|
||||
local -a args
|
||||
while (( # )) {
|
||||
case ${1} {
|
||||
-t|--target|-c|--config|--generator)
|
||||
if (( # == 1 )) || [[ ${2:0:1} == '-' ]] {
|
||||
log_error "Missing value for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
;;
|
||||
}
|
||||
case ${1} {
|
||||
--)
|
||||
shift
|
||||
args+=($@)
|
||||
break
|
||||
;;
|
||||
-t|--target)
|
||||
if (( ! ${_valid_targets[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
target=${2}
|
||||
shift 2
|
||||
;;
|
||||
-c|--config)
|
||||
if (( ! ${_valid_configs[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
config=${2}
|
||||
shift 2
|
||||
;;
|
||||
-s|--codesign) codesign=1; shift ;;
|
||||
-q|--quiet) (( verbosity -= 1 )) || true; shift ;;
|
||||
-v|--verbose) (( verbosity += 1 )); shift ;;
|
||||
-h|--help) log_output ${_usage}; exit 0 ;;
|
||||
-V|--version) print -Pr "${_version}"; exit 0 ;;
|
||||
--debug) verbosity=3; shift ;;
|
||||
--generator)
|
||||
if (( ! ${_valid_generators[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
generator=${2}
|
||||
shift 2
|
||||
;;
|
||||
--print-config) print_config=1; skips+=(deps); shift ;;
|
||||
--skip-*)
|
||||
local -r _skip="${${(s:-:)1}[-1]}"
|
||||
local -r -a _check=(all build deps)
|
||||
(( ${_check[(Ie)${_skip}]} )) || log_warning "Invalid skip mode %B${_skip}%b supplied"
|
||||
typeset -g -a skips=(${skips} ${_skip})
|
||||
shift
|
||||
;;
|
||||
*) log_error "Unknown option: %B${1}%b"; log_output ${_usage}; exit 2 ;;
|
||||
}
|
||||
}
|
||||
|
||||
: "${target:="${host_os}-${CPUTYPE}"}"
|
||||
|
||||
set -- ${(@)args}
|
||||
set_loglevel ${verbosity}
|
||||
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
|
||||
check_${host_os}
|
||||
}
|
||||
|
||||
if [[ ${host_os} == ubuntu ]] {
|
||||
autoload -Uz setup_ubuntu && setup_ubuntu
|
||||
}
|
||||
|
||||
local product_name
|
||||
local product_version
|
||||
read -r product_name product_version <<< \
|
||||
"$(jq -r '. | {name, version} | join(" ")' ${buildspec_file})"
|
||||
|
||||
pushd ${project_root}
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)build]}) )) {
|
||||
log_group "Configuring ${product_name}..."
|
||||
|
||||
local -a cmake_args=()
|
||||
local -a cmake_build_args=(--build)
|
||||
local -a cmake_install_args=(--install)
|
||||
|
||||
case ${_loglevel} {
|
||||
0) cmake_args+=(-Wno_deprecated -Wno-dev --log-level=ERROR) ;;
|
||||
1) ;;
|
||||
2) cmake_build_args+=(--verbose) ;;
|
||||
*) cmake_args+=(--debug-output) ;;
|
||||
}
|
||||
|
||||
local -r _preset="${target%%-*}${CI:+-ci}"
|
||||
case ${target} {
|
||||
ubuntu-*)
|
||||
cmake_args+=(
|
||||
--preset ${_preset}-${target##*-}
|
||||
-G "${generator}"
|
||||
-DQT_VERSION=${QT_VERSION:-6}
|
||||
-DCMAKE_BUILD_TYPE=${config}
|
||||
-DCMAKE_INSTALL_PREFIX=/usr
|
||||
)
|
||||
|
||||
local cmake_version
|
||||
read -r _ _ cmake_version <<< "$(cmake --version)"
|
||||
|
||||
cmake_build_args+=(--preset ${_preset}-${target##*-} --config ${config})
|
||||
if [[ ${generator} == 'Unix Makefiles' ]] {
|
||||
cmake_build_args+=(--parallel $(( $(nproc) + 1 )))
|
||||
} else {
|
||||
cmake_build_args+=(--parallel)
|
||||
}
|
||||
|
||||
cmake_install_args+=(build_${target##*-} --prefix ${project_root}/release/${config})
|
||||
;;
|
||||
}
|
||||
|
||||
log_debug "Attempting to configure with CMake arguments: ${cmake_args}"
|
||||
|
||||
cmake ${cmake_args}
|
||||
|
||||
log_group "Building ${product_name}..."
|
||||
cmake ${cmake_build_args}
|
||||
}
|
||||
|
||||
log_group "Installing ${product_name}..."
|
||||
if (( _loglevel > 1 )) cmake_install_args+=(--verbose)
|
||||
cmake ${cmake_install_args}
|
||||
popd
|
||||
log_group
|
||||
}
|
||||
|
||||
build ${@}
|
||||
29
.github/scripts/utils.pwsh/Ensure-Location.ps1
vendored
Normal file
29
.github/scripts/utils.pwsh/Ensure-Location.ps1
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
function Ensure-Location {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Ensures current location to be set to specified directory.
|
||||
.DESCRIPTION
|
||||
If specified directory exists, switch to it. Otherwise create it,
|
||||
then switch.
|
||||
.EXAMPLE
|
||||
Ensure-Location "My-Directory"
|
||||
Ensure-Location -Path "Path-To-My-Directory"
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string] $Path
|
||||
)
|
||||
|
||||
if ( ! ( Test-Path $Path ) ) {
|
||||
$_Params = @{
|
||||
ItemType = "Directory"
|
||||
Path = ${Path}
|
||||
ErrorAction = "SilentlyContinue"
|
||||
}
|
||||
|
||||
New-Item @_Params | Set-Location
|
||||
} else {
|
||||
Set-Location -Path ${Path}
|
||||
}
|
||||
}
|
||||
40
.github/scripts/utils.pwsh/Invoke-External.ps1
vendored
Normal file
40
.github/scripts/utils.pwsh/Invoke-External.ps1
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
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.'
|
||||
}
|
||||
|
||||
if ( ! ( Test-Path function:Log-Information ) ) {
|
||||
. $PSScriptRoot/Logger.ps1
|
||||
}
|
||||
|
||||
$Command = $args[0]
|
||||
$CommandArgs = @()
|
||||
|
||||
if ( $args.Count -gt 1) {
|
||||
$CommandArgs = $args[1..($args.Count - 1)]
|
||||
}
|
||||
|
||||
$_EAP = $ErrorActionPreference
|
||||
$ErrorActionPreference = "Continue"
|
||||
|
||||
Log-Debug "Invoke-External: ${Command} ${CommandArgs}"
|
||||
|
||||
& $command $commandArgs
|
||||
$Result = $LASTEXITCODE
|
||||
|
||||
$ErrorActionPreference = $_EAP
|
||||
|
||||
if ( $Result -ne 0 ) {
|
||||
throw "${Command} ${CommandArgs} exited with non-zero code ${Result}."
|
||||
}
|
||||
}
|
||||
149
.github/scripts/utils.pwsh/Logger.ps1
vendored
Normal file
149
.github/scripts/utils.pwsh/Logger.ps1
vendored
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
function Log-Debug {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
foreach($m in $Message) {
|
||||
Write-Debug "$(if ( $env:CI -ne $null ) { '::debug::' })$m"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Verbose {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
foreach($m in $Message) {
|
||||
Write-Verbose $m
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Warning {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
foreach($m in $Message) {
|
||||
Write-Warning "$(if ( $env:CI -ne $null ) { '::warning::' })$m"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Error {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
foreach($m in $Message) {
|
||||
Write-Error "$(if ( $env:CI -ne $null ) { '::error::' })$m"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Information {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
if ( ! ( $script:Quiet ) ) {
|
||||
$StageName = $( if ( $script:StageName -ne $null ) { $script:StageName } else { '' })
|
||||
$Icon = ' =>'
|
||||
|
||||
foreach($m in $Message) {
|
||||
Write-Host -NoNewLine -ForegroundColor Blue " ${StageName} $($Icon.PadRight(5)) "
|
||||
Write-Host "${m}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Group {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(ValueFromPipeline)]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
if ( $Env:CI -ne $null ) {
|
||||
if ( $script:LogGroup ) {
|
||||
Write-Output '::endgroup::'
|
||||
$script:LogGroup = $false
|
||||
}
|
||||
|
||||
if ( $Message.count -ge 1 ) {
|
||||
Write-Output "::group::$($Message -join ' ')"
|
||||
$script:LogGroup = $true
|
||||
}
|
||||
} else {
|
||||
if ( $Message.count -ge 1 ) {
|
||||
Log-Information $Message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Status {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
if ( ! ( $script:Quiet ) ) {
|
||||
$StageName = $( if ( $StageName -ne $null ) { $StageName } else { '' })
|
||||
$Icon = ' >'
|
||||
|
||||
foreach($m in $Message) {
|
||||
Write-Host -NoNewLine -ForegroundColor Green " ${StageName} $($Icon.PadRight(5)) "
|
||||
Write-Host "${m}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Output {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
if ( ! ( $script:Quiet ) ) {
|
||||
$StageName = $( if ( $script:StageName -ne $null ) { $script:StageName } else { '' })
|
||||
$Icon = ''
|
||||
|
||||
foreach($m in $Message) {
|
||||
Write-Output " ${StageName} $($Icon.PadRight(5)) ${m}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$Columns = (Get-Host).UI.RawUI.WindowSize.Width - 5
|
||||
60
.github/workflows/build.yml
vendored
60
.github/workflows/build.yml
vendored
|
|
@ -7,59 +7,25 @@ on:
|
|||
|
||||
jobs:
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
name: Build for Windows
|
||||
runs-on: windows-2022
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Visual Studio environment
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download OBS Studio source
|
||||
run: |
|
||||
Invoke-WebRequest -Uri "https://github.com/obsproject/obs-studio/archive/refs/tags/31.1.0.zip" -OutFile obs-studio.zip
|
||||
Expand-Archive -Path obs-studio.zip -DestinationPath C:\
|
||||
Rename-Item "C:\obs-studio-31.1.0" "C:\obs-studio"
|
||||
|
||||
- name: Download OBS pre-built dependencies
|
||||
run: |
|
||||
Invoke-WebRequest -Uri "https://github.com/obsproject/obs-deps/releases/download/2025-05-23/windows-x64-2025-05-23.tar.gz" -OutFile obs-deps.tar.gz
|
||||
mkdir C:\obs-deps
|
||||
tar -xzf obs-deps.tar.gz -C C:\obs-deps
|
||||
|
||||
- name: Download Qt6
|
||||
run: |
|
||||
Invoke-WebRequest -Uri "https://github.com/obsproject/obs-deps/releases/download/2025-05-23/windows-x64-qt6-2025-05-23.tar.gz" -OutFile qt6.tar.gz
|
||||
mkdir C:\qt6
|
||||
tar -xzf qt6.tar.gz -C C:\qt6
|
||||
|
||||
- name: Build OBS Studio libraries
|
||||
run: |
|
||||
cd C:\obs-studio
|
||||
cmake -S . -B build_x64 `
|
||||
-G "Visual Studio 17 2022" -A x64 `
|
||||
-DENABLE_PLUGINS=OFF `
|
||||
-DENABLE_UI=OFF `
|
||||
-DENABLE_SCRIPTING=OFF `
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build_x64 --config Release --target libobs -- /m
|
||||
cmake --build build_x64 --config Release --target obs-frontend-api -- /m
|
||||
|
||||
- name: Build plugin
|
||||
run: |
|
||||
cd ${{ github.workspace }}
|
||||
cmake -S . -B build `
|
||||
-G "Visual Studio 17 2022" -A x64 `
|
||||
-DBUILD_OUT_OF_TREE=On `
|
||||
-Dlibobs_DIR="C:/obs-studio/build_x64/libobs" `
|
||||
-Dobs-frontend-api_DIR="C:/obs-studio/build_x64/UI/obs-frontend-api" `
|
||||
-DCMAKE_PREFIX_PATH="C:/obs-deps;C:/qt6" `
|
||||
-DQt6_DIR="C:/qt6/lib/cmake/Qt6"
|
||||
cmake --build build --config Release -- /m
|
||||
- name: Build Plugin
|
||||
uses: ./.github/actions/build-plugin
|
||||
with:
|
||||
target: x64
|
||||
config: Release
|
||||
|
||||
- name: Upload DLL
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: vulcast-vertical-windows-x64
|
||||
path: build/Release/vulcast-vertical.dll
|
||||
path: ${{ github.workspace }}/release/**/vulcast-vertical.dll
|
||||
|
|
|
|||
Loading…
Reference in a new issue