Compare commits

..

No commits in common. "master" and "1.24.1" have entirely different histories.

764 changed files with 34186 additions and 85475 deletions

View File

@ -1,6 +1,6 @@
# please use clang-format version 16 or later
# please use clang-format version 8 or later
Standard: c++17
Standard: Cpp11
AccessModifierOffset: -8
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
@ -8,14 +8,14 @@ AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
#AllowAllArgumentsOnNextLine: false # requires clang-format 9
#AllowAllConstructorInitializersOnNextLine: false # requires clang-format 9
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLambdasOnASingleLine: Inline
#AllowShortLambdasOnASingleLine: Inline # requires clang-format 9
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
@ -52,12 +52,11 @@ ContinuationIndentWidth: 8
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
FixNamespaceComments: true
ForEachMacros:
FixNamespaceComments: false
ForEachMacros:
- 'json_object_foreach'
- 'json_object_foreach_safe'
- 'json_array_foreach'
- 'HASH_ITER'
IncludeBlocks: Preserve
IndentCaseLabels: false
IndentPPDirectives: None
@ -66,7 +65,7 @@ IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
#ObjCBinPackProtocolList: Auto # requires clang-format 7
ObjCBlockIndentWidth: 8
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
@ -84,13 +83,13 @@ ReflowComments: false
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
#SpaceAfterLogicalNot: false # requires clang-format 9
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
#SpaceBeforeCtorInitializerColon: true # requires clang-format 7
#SpaceBeforeInheritanceColon: true # requires clang-format 7
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
#SpaceBeforeRangeBasedForLoopColon: true # requires clang-format 7
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
@ -98,111 +97,11 @@ SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
StatementMacros:
- 'Q_OBJECT'
#StatementMacros: # requires clang-format 8
# - 'Q_OBJECT'
TabWidth: 8
TypenameMacros:
- 'DARRAY'
#TypenameMacros: # requires clang-format 9
# - 'DARRAY'
UseTab: ForContinuationAndIndentation
---
Language: ObjC
AccessModifierOffset: 2
AlignArrayOfStructures: Right
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: false
AcrossComments: true
AllowShortBlocksOnASingleLine: Never
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: None
AttributeMacros: ['__unused', '__autoreleasing', '_Nonnull', '__bridge']
BitFieldColonSpacing: Both
#BreakBeforeBraces: Webkit
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: Never
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: true
BreakAfterAttributes: Never
BreakArrays: false
BreakBeforeConceptDeclarations: Allowed
BreakBeforeInlineASMColon: OnlyMultiline
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterComma
ColumnLimit: 120
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: Indent
IndentGotoLabels: false
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
InsertBraces: false
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
NamespaceIndentation: All
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: false
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PPIndentWidth: -1
PackConstructorInitializers: NextLine
QualifierAlignment: Leave
ReferenceAlignment: Right
RemoveSemicolon: false
RequiresClausePosition: WithPreceding
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Always
ShortNamespaceLines: 1
SortIncludes: false
#SortUsingDeclarations: LexicographicNumeric
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInConditionalStatement: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
Standard: c++17
TabWidth: 4
UseTab: Never

View File

@ -1,31 +0,0 @@
{
"format": {
"line_width": 80,
"tab_size": 2,
"enable_sort": true,
"autosort": true
},
"additional_commands": {
"set_target_properties_obs": {
"pargs": 1,
"flags": [],
"kwargs": {
"PROPERTIES": {
"kwargs": {
"PREFIX": 1,
"OUTPUT_NAME": 1,
"FOLDER": 1,
"VERSION": 1,
"SOVERSION": 1,
"AUTOMOC": 1,
"AUTOUIC": 1,
"AUTORCC": 1,
"AUTOUIC_SEARCH_PATHS": 1,
"BUILD_RPATH": 1,
"INSTALL_RPATH": 1
}
}
}
}
}
}

2
.gitattributes vendored
View File

@ -1,2 +0,0 @@
/build-aux/*.zsh eol=lf
/build-aux/.functions/* eol=lf

36
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,36 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Logs**
Please provide a log of your issue with verbose logging enabled (See General tab of the plugin).
In case of a crash, please also include the corresponding crash log.
See [here](https://obsproject.com/forum/threads/please-post-a-log-with-your-issue-heres-how.23074/) for a description where to find the log files and how to share them.
Please share the currently used plugin settings by exporting them them to a file (See General tab of the plugin).
If applicable, add screenshots to help explain your problem.
**Version information**
- OS: [e.g. Windows 10]
- OBS Version [e.g. 27.1.3]
- Plugin Version [e.g. 1.17.1]
**Additional context**
Add any other context about the problem here.

View File

@ -1,112 +0,0 @@
# Based on the OBS issue templates
# https://github.com/obsproject/.github/tree/master/.github/ISSUE_TEMPLATE
name: Bug Report
description: Report a bug or crash
body:
- type: markdown
id: md_welcome
attributes:
value: This form is for reporting bugs for Advanced Scene Switcher!
- type: dropdown
id: os_info
attributes:
label: Operating System Info
description: What Operating System are you running?
options:
- Windows 11
- Windows 10
- macOS 14
- macOS 13
- macOS 12
- macOS 11
- Ubuntu 24.04
- Ubuntu 23.10
- Ubuntu 22.04
- Other
validations:
required: true
- type: input
id: os_info_other
attributes:
label: Other OS
description: "If \"Other\" was selected above, what OS are you using?"
placeholder: "e.g., Arch Linux, FreeBSD"
validations:
required: false
- type: input
id: obs_version
attributes:
label: OBS Studio Version
description: What version of OBS Studio are you using?
placeholder: 30.2.2
validations:
required: true
- type: input
id: advss_version
attributes:
label: Advanced Scene Switcher Version
description: What version of the Advanced Scene Switcher are you using?
placeholder: 1.27.2
validations:
required: true
- type: input
id: settings
attributes:
label: Plugin settings
description: |
Please provide the plugin settings used.
Either only [export the macros](https://github.com/WarmUpTill/SceneSwitcher/wiki/Exporting-and-importing-individual-macros) relevant to this issue or [export all settings](https://github.com/WarmUpTill/SceneSwitcher/wiki/Saving-and-loading-settings#how-to-create-and-import-a-backup-of-your-settings) on the General tab of the plugin.
validations:
required: false
- type: input
id: obs_log_url
attributes:
label: OBS Studio Log URL
description: Please provide the obsproject.com URL (from Help menu > Log Files > Upload Current/Previous Log File) to the OBS log file where this issue occurred.
validations:
required: false
- type: input
id: obs_crash_log_url
attributes:
label: OBS Studio Crash Log URL
description: If this is a crash report, please provide the obsproject.com URL to the OBS crash log file where this issue occurred.
validations:
required: false
- type: textarea
id: expected_behavior
attributes:
label: Expected Behavior
description: "What did you expect to happen?"
validations:
required: true
- type: textarea
id: current_behavior
attributes:
label: Current Behavior
description: "What actually happened?"
validations:
required: true
- type: textarea
id: steps_to_reproduce
attributes:
label: Steps to Reproduce
description: "How do you trigger this bug? Please walk us through it step by step."
placeholder: |
1.
2.
3.
...
value: |
1.
2.
3.
...
validations:
required: true
- type: textarea
id: additional_notes
attributes:
label: Anything else we should know?
validations:
required: false

View File

@ -1,8 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: 📚 Wiki
- name: Help/Support
url: https://github.com/WarmUpTill/SceneSwitcher/wiki
about: For explanations on how the plugin works or to see example guides, check out the wiki.
- name: 💬 OBS Forum Thread
url: https://obsproject.com/forum/threads/advanced-scene-switcher.48264
about: To discuss the plugin or get assistance, feel free to use the OBS forum thread or the GitHub discussions page.
about: For general questions about how to use and configure the plugin please have a look at the wiki (https://github.com/WarmUpTill/SceneSwitcher/wiki) or ask questions in the OBS forum (https://obsproject.com/forum/threads/advanced-scene-switcher.48264/)

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -1,37 +0,0 @@
# Based on the OBS issue templates
# https://github.com/obsproject/.github/tree/master/.github/ISSUE_TEMPLATE
name: Feature request
description: Suggest an idea for this project
body:
- type: markdown
id: md_welcome
attributes:
value: This form is for requesting new features for Advanced Scene Switcher!
- type: textarea
id: background
attributes:
label: Background
description: "Is your feature request related to a problem? Please describe."
validations:
required: false
- type: textarea
id: solution
attributes:
label: Solution
description: "Describe the solution you'd like."
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives
description: "Describe alternatives you've considered."
validations:
required: false
- type: textarea
id: additional_notes
attributes:
label: Anything else we should know?
validations:
required: false

View File

@ -22,11 +22,11 @@ runs:
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.13
with:
cmake-version: '3.x.x'
cmake-version: '3.24.x'
- name: Restore cached dependencies
id: restore-cache
uses: actions/cache@v4
uses: actions/cache@v3
with:
path: ${{ env.DEP_DIR }}
key: ${{ env.DEP_DIR }}-${{ runner.os }}-${{ inputs.target }}
@ -37,13 +37,12 @@ runs:
run: |
build_args=(
-c ${{ inputs.config }}
-t ${{ inputs.target }}
-o ${{ env.DEP_DIR }}
-t macos-${{ inputs.target }}
)
if (( ${+CI} && ${+RUNNER_DEBUG} )) build_args+=(--debug)
.github/scripts/build-deps-macos.zsh -o ${{ env.DEP_DIR }} ${build_args}
${{ inputs.workingDirectory }}/.github/scripts/build-deps-macos.zsh -o ${{ env.DEP_DIR }} ${build_args}
- name: Run Linux Build
if: ${{ runner.os == 'Linux' && steps.restore-cache.outputs.cache-hit != 'true' }}
@ -58,7 +57,7 @@ runs:
build_args+=(--debug)
fi
.github/scripts/build-deps-linux.sh -o ${{ env.DEP_DIR }} "${build_args[@]}"
${{ inputs.workingDirectory }}/.github/scripts/build-deps-linux.sh -o ${{ env.DEP_DIR }} "${build_args[@]}"
- name: Run Windows Build
if: ${{ runner.os == 'Windows' && steps.restore-cache.outputs.cache-hit != 'true' }}
@ -67,7 +66,7 @@ runs:
$BuildArgs = @{
Target = '${{ inputs.target }}'
Configuration = '${{ inputs.config }}'
OutDirName = '${{ env.DEP_DIR }}'
CMakeGenerator = '${{ inputs.visualStudio }}'
}
if ( ( Test-Path env:CI ) -and ( Test-Path env:RUNNER_DEBUG ) ) {
@ -76,5 +75,5 @@ runs:
}
}
.github/scripts/Build-Deps-Windows.ps1 -OutDirName ${{ env.DEP_DIR }} @BuildArgs
${{ inputs.workingDirectory }}/.github/scripts/Build-Deps-Windows.ps1 -OutDirName ${{ env.DEP_DIR }} @BuildArgs

View File

@ -1,110 +0,0 @@
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: '-'
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:
CODESIGN_IDENT: ${{ inputs.codesignIdent }}
CODESIGN_TEAM: ${{ inputs.codesignTeam }}
run: |
: Run macOS Build
local -a build_args=(
--config ${{ inputs.config }}
--dep ${{ env.DEP_DIR }}
)
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 }}
run: |
: Run Ubuntu Build
local -a build_args=(
--target linux-${{ inputs.target }}
--config ${{ inputs.config }}
)
if (( ${+RUNNER_DEBUG} )) build_args+=(--debug)
.github/scripts/build-linux ${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 }}'
ADVSSDepName = '${{ env.DEP_DIR }}'
}
.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_CONFIGPATH: ${{ inputs.workingDirectory }}/.ccache.conf
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

89
.github/actions/build-plugin/action.yml vendored Normal file
View File

@ -0,0 +1,89 @@
name: 'Setup and build plugin'
description: 'Builds the plugin for specified architecture and build config.'
inputs:
target:
description: 'Build target for dependencies'
required: true
config:
description: 'Build configuration'
required: false
default: 'Release'
codesign:
description: 'Enable codesigning (macOS only)'
required: false
default: 'false'
codesignIdent:
description: 'Developer ID for application codesigning (macOS only)'
required: false
default: '-'
visualStudio:
description: 'Visual Studio version (Windows only)'
required: false
default: 'Visual Studio 16 2019'
portable:
description: 'Set portable mode (Linux only)'
required: false
default: 'false'
workingDirectory:
description: 'Working directory for packaging'
required: false
default: ${{ github.workspace }}
runs:
using: 'composite'
steps:
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.13
with:
cmake-version: '3.24.x'
- name: Run macOS Build
if: ${{ runner.os == 'macOS' }}
shell: zsh {0}
env:
CODESIGN_IDENT: ${{ inputs.codesignIdent }}
run: |
build_args=(
-c ${{ inputs.config }}
-t macos-${{ inputs.target }}
)
if [[ '${{ inputs.codesign }}' == 'true' ]] build_args+=(-s)
if (( ${+CI} && ${+RUNNER_DEBUG} )) build_args+=(--debug)
${{ inputs.workingDirectory }}/.github/scripts/build-macos.zsh -d ${{ env.DEP_DIR }} ${build_args}
- name: Run Linux Build
if: ${{ runner.os == 'Linux' }}
shell: bash
run: |
build_args=(
-c ${{ inputs.config }}
-t linux-${{ inputs.target }}
)
if [[ -n "${CI}" && -n "${RUNNER_DEBUG}" ]]; then
build_args+=(--debug)
fi
if [[ '${{ inputs.portable }}' == 'true' ]]; then
build_args+=(-p)
fi
${{ inputs.workingDirectory }}/.github/scripts/build-linux.sh -d ${{ env.DEP_DIR }} "${build_args[@]}"
- name: Run Windows Build
if: ${{ runner.os == 'Windows' }}
shell: pwsh
run: |
$BuildArgs = @{
Target = '${{ inputs.target }}'
Configuration = '${{ inputs.config }}'
CMakeGenerator = '${{ inputs.visualStudio }}'
}
if ( ( Test-Path env:CI ) -and ( Test-Path env:RUNNER_DEBUG ) ) {
$BuildArgs += @{
Debug = $true
}
}
${{ inputs.workingDirectory }}/.github/scripts/Build-Windows.ps1 -ADVSSDepName ${{ env.DEP_DIR }} @BuildArgs

View File

@ -1,117 +0,0 @@
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: 'true'
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 linux-${{ inputs.target }}
--config ${{ inputs.config }}
)
if (( ${+RUNNER_DEBUG} )) build_args+=(--debug)
if [[ '${{ inputs.package }}' == 'true' ]] package_args+=(--package)
.github/scripts/package-linux ${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 }}'
}
if ( '${{ inputs.package }}' -eq 'true' ) {
$PackageArgs += @{BuildInstaller = $true}
}
.github/scripts/Package-Windows.ps1 @PackageArgs

View File

@ -0,0 +1,109 @@
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: 'Release'
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: ''
codesignUser:
description: 'Apple ID username for notarization (macOS only)'
required: false
default: ''
codesignPass:
description: 'Apple ID password for notarization (macOS only)'
required: false
default: ''
createInstaller:
description: 'Create InnoSetup installer (Windows only)'
required: false
default: 'false'
portable:
description: 'Create deb package / portable archive (Linux only)'
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 {0}
env:
CODESIGN_IDENT: ${{ inputs.codesignIdent }}
CODESIGN_IDENT_INSTALLER: ${{ inputs.installerIdent }}
CODESIGN_IDENT_USER: ${{ inputs.codesignUser }}
CODESIGN_IDENT_PASS: ${{ inputs.codesignPass }}
run: |
package_args=(
-c ${{ inputs.config }}
-t macos-${{ inputs.target }}
)
if [[ '${{ inputs.codesign }}' == 'true' ]] package_args+=(-s)
if [[ '${{ inputs.notarize }}' == 'true' ]] package_args+=(-n)
if (( ${+CI} && ${+RUNNER_DEBUG} )) build_args+=(--debug)
package_args+=(-z)
${{ inputs.workingDirectory }}/.github/scripts/package-macos.zsh ${package_args}
- name: Run Linux packaging
if: ${{ runner.os == 'Linux' }}
shell: bash
run: |
package_args=(
-c ${{ inputs.config }}
-t linux-${{ inputs.target }}
)
if [[ -n "${CI}" && -n "${RUNNER_DEBUG}" ]]; then
build_args+=(--debug)
fi
if [[ '${{ inputs.portable }}' == 'true' ]]; then
package_args+=(-z)
fi
${{ inputs.workingDirectory }}/.github/scripts/package-linux.sh "${package_args[@]}"
- name: Run Windows packaging
if: ${{ runner.os == 'Windows' }}
shell: pwsh
run: |
$PackageArgs = @{
Target = '${{ inputs.target }}'
Configuration = '${{ inputs.config }}'
}
if ( '${{ inputs.createInstaller }}' -eq 'true' ) {
$PackageArgs += @{BuildInstaller = $true}
}
if ( ( Test-Path env:CI ) -and ( Test-Path env:RUNNER_DEBUG ) ) {
$BuildArgs += @{
Debug = $true
}
}
${{ inputs.workingDirectory }}/.github/scripts/Package-Windows.ps1 @PackageArgs

View File

@ -1,61 +0,0 @@
name: Run clang-format
description: Runs clang-format and checks for any changes introduced by it
inputs:
failCondition:
description: Controls whether failed checks also fail the workflow run
required: false
default: 'never'
workingDirectory:
description: Working directory for checks
required: false
default: ${{ github.workspace }}
runs:
using: composite
steps:
- name: Check Runner Operating System 🏃‍♂️
if: runner.os == 'Windows'
shell: bash
run: |
: Check Runner Operating System 🏃‍♂️
echo "::notice::run-clang-format action requires a macOS-based or Linux-based runner."
exit 2
- 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
echo "/home/linuxbrew/.linuxbrew/opt/clang-format@16/bin" >> $GITHUB_PATH
brew install --quiet zsh
echo ::endgroup::
- name: Run clang-format 🐉
id: result
shell: zsh --no-rcs --errexit --pipefail {0}
working-directory: ${{ inputs.workingDirectory }}
env:
GITHUB_EVENT_FORCED: ${{ github.event.forced }}
GITHUB_REF_BEFORE: ${{ github.event.before }}
run: |
: Run clang-format 🐉
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
local -a changes=($(git diff --name-only HEAD~1 HEAD))
case ${GITHUB_EVENT_NAME} {
pull_request) changes=($(git diff --name-only origin/${GITHUB_BASE_REF} HEAD)) ;;
push) if [[ ${GITHUB_EVENT_FORCED} != true ]] changes=($(git diff --name-only ${GITHUB_REF_BEFORE} HEAD)) ;;
*) ;;
}
if (( ${changes[(I)(*.c|*.h|*.cpp|*.hpp|*.m|*.mm)]} )) {
echo ::group::Install clang-format-16
brew install --quiet obsproject/tools/clang-format@16
echo ::endgroup::
echo ::group::Run clang-format-16
./build-aux/run-clang-format --fail-${{ inputs.failCondition }} --check
echo ::endgroup::
}

View File

@ -1,59 +0,0 @@
name: Run cmake-format
description: Runs cmake-format and checks for any changes introduced by it
inputs:
failCondition:
description: Controls whether failed checks also fail the workflow run
required: false
default: 'never'
workingDirectory:
description: Working directory for checks
required: false
default: ${{ github.workspace }}
runs:
using: composite
steps:
- name: Check Runner Operating System 🏃‍♂️
if: runner.os == 'Windows'
shell: bash
run: |
: Check Runner Operating System 🏃‍♂️
echo "::notice::run-cmake-format action requires a macOS-based or Linux-based runner."
exit 2
- 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 cmake-format 🎛️
id: result
shell: zsh --no-rcs --errexit --pipefail {0}
working-directory: ${{ github.workspace }}
env:
GITHUB_EVENT_FORCED: ${{ github.event.forced }}
GITHUB_REF_BEFORE: ${{ github.event.before }}
run: |
: Run cmake-format 🎛️
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
local -a changes=($(git diff --name-only HEAD~1 HEAD))
case ${GITHUB_EVENT_NAME} {
pull_request) changes=($(git diff --name-only origin/${GITHUB_BASE_REF} HEAD)) ;;
push) if [[ ${GITHUB_EVENT_FORCED} != true ]] changes=($(git diff --name-only ${GITHUB_REF_BEFORE} HEAD)) ;;
*) ;;
}
if (( ${changes[(I)*.cmake|*CMakeLists.txt]} )) {
echo ::group::Install cmakelang
pip3 install cmakelang
echo ::endgroup::
echo ::group::Run cmake-format
./build-aux/run-cmake-format --fail-${{ inputs.failCondition }} --check
echo ::endgroup::
}

View File

@ -1,29 +1,25 @@
name: "Run tests"
description: "Run tests."
name: 'Package plugin'
description: 'Packages the plugin for specified architecture and build config.'
inputs:
target:
description: "Build target"
description: 'Build target'
required: true
workingDirectory:
description: "Working directory"
description: 'Working directory'
required: false
default: ${{ github.workspace }}
config:
description: "Build config"
required: false
default: ""
runs:
using: "composite"
using: 'composite'
steps:
- name: Run macOS tests
if: ${{ runner.os == 'macOS' }}
shell: zsh {0}
run: |
if [[ '${{ inputs.target }}' != 'macos-universal' ]]; then
if [[ '${{ inputs.target }}' != 'x86_64' ]]; then
echo tests skipped!
exit 0
fi
${{ inputs.workingDirectory }}/build_macos/tests/${{ inputs.config }}/advanced-scene-switcher-tests
${{ inputs.workingDirectory }}/build_x86_64/tests/advanced-scene-switcher-tests
- name: Run Linux packaging
if: ${{ runner.os == 'Linux' }}
@ -38,4 +34,4 @@ runs:
if: ${{ runner.os == 'Windows' }}
shell: pwsh
run: |
${{ inputs.workingDirectory }}/build_x64/tests/${{ inputs.config }}/advanced-scene-switcher-tests.exe
${{ inputs.workingDirectory }}/build_x64/tests/RelWithDebInfo/advanced-scene-switcher-tests.exe

View File

@ -1,154 +0,0 @@
name: Set up macOS codesigning
description: Sets up code signing certificates, provisioning profiles, and notarization information
inputs:
codesignIdentity:
description: Codesigning identity
required: true
installerIdentity:
description: Codesigning identity for package installer
required: false
codesignCertificate:
description: PKCS12 certificate in base64 format
required: true
certificatePassword:
description: Password required to install PKCS12 certificate
required: true
keychainPassword:
description: Password to use for temporary keychain
required: false
notarizationUser:
description: Apple ID to use for notarization
required: false
notarizationPassword:
description: Application password for notarization
provisioningProfile:
description: Provisioning profile in base64 format
required: false
outputs:
haveCodesignIdent:
description: True if necessary codesigning credentials were found
value: ${{ steps.codesign.outputs.haveCodesignIdent }}
haveProvisioningProfile:
description: True if necessary provisioning profile credentials were found
value: ${{ steps.provisioning.outputs.haveProvisioningProfile }}
haveNotarizationUser:
description: True if necessary notarization credentials were found
value: ${{ steps.notarization.outputs.haveNotarizationUser }}
codesignIdent:
description: Codesigning identity
value: ${{ steps.codesign.outputs.codesignIdent }}
installerIdent:
description: Codesigning identity for package installer
value: ${{ steps.codesign.outputs.installerIdent }}
codesignTeam:
description: Codesigning team
value: ${{ steps.codesign.outputs.codesignTeam }}
runs:
using: composite
steps:
- name: Check Runner Operating System 🏃‍♂️
if: runner.os != 'macOS'
shell: bash
run: |
: Check Runner Operating System 🏃‍♂️
echo "setup-macos-codesigning action requires a macOS-based runner."
exit 2
- name: macOS Codesigning ✍️
shell: zsh --no-rcs --errexit --pipefail {0}
id: codesign
env:
MACOS_SIGNING_IDENTITY: ${{ inputs.codesignIdentity }}
MACOS_SIGNING_IDENTITY_INSTALLER: ${{ inputs.installerIdentity}}
MACOS_SIGNING_CERT: ${{ inputs.codesignCertificate }}
MAOCS_SIGNING_CERT_PASSWORD: ${{ inputs.certificatePassword }}
MACOS_KEYCHAIN_PASSWORD: ${{ inputs.keychainPassword }}
run: |
: macOS Codesigning ✍️
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
if [[ ${MACOS_SIGNING_IDENTITY} && ${MACOS_SIGNING_IDENTITY_INSTALLER} && ${MACOS_SIGNING_CERT} ]] {
print 'haveCodesignIdent=true' >> $GITHUB_OUTPUT
local -r certificate_path="${RUNNER_TEMP}/build_certificate.p12"
local -r keychain_path="${RUNNER_TEMP}/app-signing.keychain-db"
print -n "${MACOS_SIGNING_CERT}" | base64 --decode --output="${certificate_path}"
: "${MACOS_KEYCHAIN_PASSWORD:="$(print ${RANDOM} | shasum | head -c 32)"}"
print '::group::Keychain setup'
security create-keychain -p "${MACOS_KEYCHAIN_PASSWORD}" ${keychain_path}
security set-keychain-settings -lut 21600 ${keychain_path}
security unlock-keychain -p "${MACOS_KEYCHAIN_PASSWORD}" ${keychain_path}
security import "${certificate_path}" -P "${MAOCS_SIGNING_CERT_PASSWORD}" -A \
-t cert -f pkcs12 -k ${keychain_path} \
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/xcrun
security set-key-partition-list -S 'apple-tool:,apple:' -k "${MACOS_KEYCHAIN_PASSWORD}" \
${keychain_path} &> /dev/null
security list-keychain -d user -s ${keychain_path} 'login-keychain'
print '::endgroup::'
local -r team_id="${${MACOS_SIGNING_IDENTITY##* }//(\(|\))/}"
print "codesignIdent=${MACOS_SIGNING_IDENTITY}" >> $GITHUB_OUTPUT
print "installerIdent=${MACOS_SIGNING_IDENTITY_INSTALLER}" >> $GITHUB_OUTPUT
print "MACOS_KEYCHAIN_PASSWORD=${MACOS_KEYCHAIN_PASSWORD}" >> $GITHUB_ENV
print "codesignTeam=${team_id}" >> $GITHUB_OUTPUT
} else {
print 'haveCodesignIdent=false' >> $GITHUB_OUTPUT
}
- name: Provisioning Profile 👤
shell: zsh --no-rcs --errexit --pipefail {0}
id: provisioning
if: ${{ fromJSON(steps.codesign.outputs.haveCodesignIdent) }}
env:
MACOS_SIGNING_PROVISIONING_PROFILE: ${{ inputs.provisioningProfile }}
run: |
: Provisioning Profile 👤
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
if [[ ${MACOS_SIGNING_PROVISIONING_PROFILE} ]] {
print 'haveProvisioningProfile=true' >> $GITHUB_OUTPUT
local -r profile_path="${RUNNER_TEMP}/build_profile.provisionprofile"
print -n "${MACOS_SIGNING_PROVISIONING_PROFILE}" \
| base64 --decode --output ${profile_path}
print '::group::Provisioning Profile Setup'
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
security cms -D -i ${profile_path} -o ${RUNNER_TEMP}/build_profile.plist
local -r uuid="$(plutil -extract UUID raw ${RUNNER_TEMP}/build_profile.plist)"
local -r team_id="$(plutil -extract TeamIdentifier.0 raw -expect string ${RUNNER_TEMP}/build_profile.plist)"
if [[ ${team_id} != '${{ steps.codesign.codesignTeam }}' ]] {
print '::notice::Code Signing team in provisioning profile does not match certificate.'
}
cp ${profile_path} ~/Library/MobileDevice/Provisioning\ Profiles/${uuid}.provisionprofile
print "provisioningProfileUUID=${uuid}" >> $GITHUB_OUTPUT
print '::endgroup::'
} else {
print 'haveProvisioningProfile=false' >> $GITHUB_OUTPUT
}
- name: Notarization 🧑‍💼
shell: zsh --no-rcs --errexit --pipefail {0}
id: notarization
if: ${{ fromJSON(steps.codesign.outputs.haveCodesignIdent) }}
env:
MACOS_NOTARIZATION_USERNAME: ${{ inputs.notarizationUser }}
MACOS_NOTARIZATION_PASSWORD: ${{ inputs.notarizationPassword }}
run: |
: Notarization 🧑‍💼
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
if [[ ${MACOS_NOTARIZATION_USERNAME} && ${MACOS_NOTARIZATION_PASSWORD} ]] {
print 'haveNotarizationUser=true' >> $GITHUB_OUTPUT
} else {
print 'haveNotarizationUser=false' >> $GITHUB_OUTPUT
}

View File

@ -1,18 +1,14 @@
package 'cmake'
package 'ccache'
package 'curl'
package 'git'
package 'jq'
package 'ninja-build', bin: 'ninja'
package 'pkg-config'
package 'libcurl4-openssl-dev'
package 'clang'
package 'clang-format-13'
package 'libxtst-dev'
package 'libxss-dev'
package 'libopencv-dev'
package 'libtesseract-dev'
package 'libproc2-dev'
package 'libusb-1.0-0-dev'
package 'libpaho-mqttpp-dev'
package 'libpaho-mqtt-dev'
package 'libpaho-mqtt-dev'
package 'libasound2-dev'
package 'libpipewire-0.3-dev'
package 'libprocps-dev'

View File

@ -1,7 +1,6 @@
brew "ccache"
brew "coreutils"
brew "cmake"
brew "git"
brew "jq"
brew "xcbeautify"
brew "automake"
brew "libtool"
brew "ninja"

View File

@ -1,4 +1,4 @@
package '7zip.7zip', path: '7-zip', bin: '7z'
package 'cmake', path: 'Cmake\bin', bin: 'cmake'
package 'innosetup', path: 'Inno Setup 6', bin: 'iscc'
package 'OpenSSL', path: 'OpenSSL', bin: 'openssl'
package 'Microsoft.VisualStudio.Locator', path: 'vswhere', bin: 'vswhere'

View File

@ -33,6 +33,7 @@ _trap_error() {
build() {
if (( ! ${+SCRIPT_HOME} )) typeset -g SCRIPT_HOME=${ZSH_ARGZERO:A:h}
local host_os=${${(s:-:)ZSH_ARGZERO:t:r}[3]}
local target="${host_os}-${CPUTYPE}"
local project_root=${SCRIPT_HOME:A:h:h}
local buildspec_file="${project_root}/buildspec.json"
@ -52,6 +53,8 @@ build() {
local -i _verbosity=1
local -r _version='1.0.0'
local -r -a _valid_targets=(
macos-x86_64
macos-arm64
macos-universal
linux-x86_64
)
@ -123,7 +126,7 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
log_output ${_usage}
exit 2
}
config=${2}
BUILD_CONFIG=${2}
shift 2
;;
-o|--out)
@ -161,6 +164,11 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
check_${host_os}
setup_ccache
typeset -g QT_VERSION
typeset -g DEPLOYMENT_TARGET
typeset -g OBS_DEPS_VERSION
setup_${host_os}
local product_name
local product_version
local git_tag="$(git describe --tags)"
@ -175,111 +183,12 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
log_info "Using buildspec.json version identifier '${product_version}'"
}
case ${host_os} {
macos)
sed -i '' \
"s/project(\(.*\) VERSION \(.*\))/project(${product_name} VERSION ${product_version})/" \
"${project_root}/CMakeLists.txt"
;;
linux)
sed -i'' \
"s/project(\(.*\) VERSION \(.*\))/project(${product_name} VERSION ${product_version})/"\
"${project_root}/CMakeLists.txt"
;;
}
log_info "Run plugin configure step to download OBS deps ..."
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} {
macos-*)
if (( ${+CI} )) typeset -gx NSUnbufferedIO=YES
cmake_args+=(
-DENABLE_TWITCH_PLUGIN=OFF
--preset ${_preset}
)
if (( codesign )) {
autoload -Uz read_codesign_team && read_codesign_team
if [[ -z ${CODESIGN_TEAM} ]] {
autoload -Uz read_codesign && read_codesign
}
}
cmake_args+=(
-DCODESIGN_TEAM=${CODESIGN_TEAM:-}
-DCODESIGN_IDENTITY=${CODESIGN_IDENT:--}
)
cmake_build_args+=(--preset ${_preset} --parallel --config ${config} -- ONLY_ACTIVE_ARCH=NO -arch arm64 -arch x86_64)
cmake_install_args+=(build_macos --config ${config} --prefix "${project_root}/release/${config}")
local -a xcbeautify_opts=()
if (( _loglevel == 0 )) xcbeautify_opts+=(--quiet)
;;
linux-*)
cmake_args+=(
--preset ${_preset}-${target##*-}
-G "${generator}"
-DQT_VERSION=${QT_VERSION:-6}
-DCMAKE_BUILD_TYPE=${config}
)
local cmake_version
read -r _ _ cmake_version <<< "$(cmake --version)"
if [[ ${CPUTYPE} != ${target##*-} ]] {
if is-at-least 3.21.0 ${cmake_version}; then
cmake_args+=(--toolchain "${project_root}/cmake/linux/toolchains/${target##*-}-linux-gcc.cmake")
else
cmake_args+=(-D"CMAKE_TOOLCHAIN_FILE=${project_root}/cmake/linux/toolchains/${target##*-}-linux-gcc.cmake")
fi
}
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}
}
popd
log_group
if [[ -z "${OUT_DIR}" ]] {
OUT_DIR=".deps/advss-build-dependencies"
OUT_DIR="advss-build-dependencies"
}
mkdir -p "${project_root}/${OUT_DIR}"
local advss_dep_path="$(realpath ${project_root}/${OUT_DIR})"
local deps_version=$(jq -r '.dependencies.prebuilt.version' ${buildspec_file})
local qt_deps_version=$(jq -r '.dependencies.qt6.version' ${buildspec_file})
local _plugin_deps="${project_root:h}/.deps/obs-deps-${deps_version}-${target##*-};${project_root:h}/.deps/obs-deps-qt6-${qt_deps_version}-${target##*-}"
mkdir -p "${project_root}/../${OUT_DIR}"
local advss_dep_path="$(realpath ${project_root}/../${OUT_DIR})"
local _plugin_deps="${project_root:h}/obs-build-dependencies/plugin-deps-${OBS_DEPS_VERSION}-qt${QT_VERSION}-${target##*-}"
case ${host_os} {
macos)
@ -301,12 +210,12 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
pushd ${opencv_dir}
log_info "Configure OpenCV ..."
cmake -S . -B ${opencv_build_dir} ${opencv_cmake_args}
cmake -S . -B ${opencv_build_dir} -G ${generator} ${opencv_cmake_args}
log_info "Building OpenCV ..."
cmake --build ${opencv_build_dir} --config Release
log_info "Installing OpenCV ..."
log_info "Installing OpenCV..."
cmake --install ${opencv_build_dir} --prefix "${advss_dep_path}" --config Release || true
popd
@ -330,189 +239,81 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
pushd ${leptonica_dir}
log_info "Configure Leptonica ..."
cmake -S . -B ${leptonica_build_dir} ${leptonica_cmake_args}
cmake -S . -B ${leptonica_build_dir} -G ${generator} ${leptonica_cmake_args}
log_info "Building Leptonica ..."
cmake --build ${leptonica_build_dir} --config Release
log_info "Installing Leptonica ..."
log_info "Installing Leptonica..."
# Workaround for "unknown file attribute: H" errors when running install
cmake --install ${leptonica_build_dir} --prefix "${advss_dep_path}" --config Release || :
popd
local tesseract_dir="${project_root}/deps/tesseract"
local tesseract_build_dir_x86_64="${tesseract_dir}/build_x86_64"
local tesseract_build_dir="${tesseract_dir}/build_${target##*-}"
local -a tesseract_cmake_args=(
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
-DSW_BUILD=OFF
-DBUILD_TRAINING_TOOLS=OFF
-DCMAKE_PREFIX_PATH="${advss_dep_path};${_plugin_deps}"
-DCMAKE_INSTALL_PREFIX="${advss_dep_path}"
)
if [ "${target}" != "macos-x86_64" ]; then
tesseract_cmake_args+=(
-DCMAKE_SYSTEM_PROCESSOR=aarch64
-DHAVE_AVX=FALSE
-DHAVE_AVX2=FALSE
-DHAVE_AVX512F=FALSE
-DHAVE_FMA=FALSE
-DHAVE_SSE4_1=FALSE
-DHAVE_NEON=TRUE
)
sed -i'.original' 's/HAVE_NEON FALSE/HAVE_NEON TRUE/g' "${tesseract_dir}/CMakeLists.txt"
fi
pushd ${tesseract_dir}
log_info "Configure Tesseract (x86_64) ..."
log_info "Configure Tesseract ..."
cmake -S . -B ${tesseract_build_dir} -G ${generator} ${tesseract_cmake_args}
local -a tesseract_cmake_args=(
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_SYSTEM_NAME="Darwin"
-DCMAKE_OSX_ARCHITECTURES=x86_64
-DCMAKE_SYSTEM_PROCESSOR=x86_64
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
-DSW_BUILD=OFF
-DBUILD_TRAINING_TOOLS=OFF
-DCMAKE_PREFIX_PATH="${advss_dep_path};${_plugin_deps}"
-DCMAKE_INSTALL_PREFIX="${advss_dep_path}"
)
cmake -S . -B ${tesseract_build_dir_x86_64} ${tesseract_cmake_args}
log_info "Building Tesseract (x86_64) ..."
cmake --build ${tesseract_build_dir_x86_64} --config Release
log_info "Configure Tesseract (arm64) ..."
git checkout .
local tesseract_build_dir_arm64="${tesseract_dir}/build_arm64"
local -a tesseract_cmake_args=(
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_SYSTEM_NAME="Darwin"
-DCMAKE_OSX_ARCHITECTURES=arm64
-DCMAKE_SYSTEM_PROCESSOR=arm64
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
-DSW_BUILD=OFF
-DBUILD_TRAINING_TOOLS=OFF
-DCMAKE_PREFIX_PATH="${advss_dep_path};${_plugin_deps}"
-DCMAKE_INSTALL_PREFIX="${advss_dep_path}"
)
cmake -S . -B ${tesseract_build_dir_arm64} ${tesseract_cmake_args}
log_info "Building Tesseract (arm64) ..."
cmake --build ${tesseract_build_dir_arm64} --config Release
log_info "Combine arm and x86 libtesseract binaries ..."
mv ${tesseract_build_dir_arm64}/libtesseract.a ${tesseract_build_dir_arm64}/libtesseract_arm.a
lipo -create ${tesseract_build_dir_x86_64}/libtesseract.a ${tesseract_build_dir_arm64}/libtesseract_arm.a -output ${tesseract_build_dir_arm64}/libtesseract.a
log_info "Building Tesseract ..."
cmake --build ${tesseract_build_dir} --config Release
log_info "Installing Tesseract..."
cmake --install ${tesseract_build_dir_arm64} --prefix "${advss_dep_path}" --config Release
cmake --install ${tesseract_build_dir} --prefix "${advss_dep_path}" --config Release
popd
pushd ${advss_dep_path}
log_info "Prepare openssl ..."
rm -rf ${advss_dep_path}/openssl ${advss_dep_path}/openssl_build
mkdir ${advss_dep_path}/openssl_build
pushd ${advss_dep_path}/openssl_build
rm -rf openssl
git clone https://github.com/openssl/openssl.git --branch openssl-3.1.2 --depth 1
git clone git://git.openssl.org/openssl.git --branch openssl-3.1.2 --depth 1
mv openssl openssl_x86
cp -r openssl_x86 openssl_arm
log_info "Building openssl x86 ..."
export MACOSX_DEPLOYMENT_TARGET=10.9
pushd openssl_x86
./Configure darwin64-x86_64-cc no-shared no-module no-zlib --prefix=${advss_dep_path}
make -j$(nproc)
popd
cd openssl_x86
./Configure darwin64-x86_64-cc shared
make
log_info "Building openssl arm ..."
export MACOSX_DEPLOYMENT_TARGET=10.15
pushd openssl_arm
./Configure enable-rc5 darwin64-arm64-cc no-shared no-module no-asm no-zlib --prefix=${advss_dep_path}
make -j$(nproc)
log_info "Install openssl ..."
make install
popd
cd ../openssl_arm
./Configure enable-rc5 zlib darwin64-arm64-cc no-asm
make
log_info "Combine arm and x86 openssl binaries ..."
lipo -create openssl_x86/libcrypto.a openssl_arm/libcrypto.a -output ${advss_dep_path}/lib/libcrypto.a
lipo -create openssl_x86/libssl.a openssl_arm/libssl.a -output ${advss_dep_path}/lib/libssl.a
cd ..
mkdir openssl-combined
lipo -create openssl_x86/libcrypto.a openssl_arm/libcrypto.a -output openssl-combined/libcrypto.a
lipo -create openssl_x86/libssl.a openssl_arm/libssl.a -output openssl-combined/libssl.a
log_info "Clean up openssl dir ..."
rm -rf openssl_x86 openssl_arm
popd
pushd ${project_root}/deps/libusb
log_info "Configure libusb x86 ..."
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
export CC=$(xcrun --sdk macosx --find clang)
export CXX=$(xcrun --sdk macosx --find clang++)
export CFLAGS="-arch x86_64 -isysroot $SDKROOT"
export CXXFLAGS="-arch x86_64 -isysroot $SDKROOT"
export LDFLAGS="-arch x86_64 -isysroot $SDKROOT"
export MACOSX_DEPLOYMENT_TARGET=10.15
log_info "Building libusb x86 ..."
mkdir ${project_root}/deps/libusb/out_x86
./autogen.sh
./configure --host=x86_64-apple-darwin --prefix=${advss_dep_path}
make -j$(nproc)
make install
log_info "Configure libusb arm ..."
make clean
rm -r ${project_root}/deps/libusb/out_x86
mkdir ${project_root}/deps/libusb/out_x86
./configure --host=aarch64-apple-darwin --prefix=${project_root}/deps/libusb/out_x86
make -j$(nproc)
make install
log_info "Building libusb arm ..."
make clean
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
export CC=$(xcrun --sdk macosx --find clang)
export CXX=$(xcrun --sdk macosx --find clang++)
export CFLAGS="-arch arm64 -isysroot $SDKROOT"
export CXXFLAGS="-arch arm64 -isysroot $SDKROOT"
export LDFLAGS="-arch arm64 -isysroot $SDKROOT"
export MACOSX_DEPLOYMENT_TARGET=10.15
mkdir ${project_root}/deps/libusb/out_arm
./configure --host=aarch64-apple-darwin --prefix=${project_root}/deps/libusb/out_arm
make -j$(nproc)
make install
log_info "Combine arm and x86 libusb binaries ..."
lipo -create ${project_root}/deps/libusb/out_x86/lib/libusb-1.0.0.dylib \
${project_root}/deps/libusb/out_arm/lib/libusb-1.0.0.dylib \
-output ${advss_dep_path}/lib/temp-libusb-1.0.0.dylib
mv ${advss_dep_path}/lib/temp-libusb-1.0.0.dylib ${advss_dep_path}/lib/libusb-1.0.0.dylib
install_name_tool -id @rpath/libusb-1.0.0.dylib ${advss_dep_path}/lib/libusb-1.0.0.dylib
log_info "Clean up libusb ..."
unset SDKROOT
unset CC
unset CXX
unset CFLAGS
unset CXXFLAGS
unset LDFLAGS
unset MACOSX_DEPLOYMENT_TARGET
popd
local mqtt_dir="${project_root}/deps/paho.mqtt.cpp"
local mqtt_build_dir="${mqtt_dir}/build_${target##*-}"
local -a mqtt_cmake_args=(
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
-DCMAKE_PREFIX_PATH="${advss_dep_path};${_plugin_deps}"
-DCMAKE_INSTALL_PREFIX="${advss_dep_path}"
-DPAHO_BUILD_SHARED=OFF
-DPAHO_BUILD_STATIC=ON
-DPAHO_WITH_MQTT_C=ON
-DPAHO_WITH_SSL=ON
-DOPENSSL_USE_STATIC_LIBS=ON
)
pushd ${mqtt_dir}
log_info "Configure paho.mqtt.cpp ..."
cmake -S . -B ${mqtt_build_dir} ${mqtt_cmake_args}
log_info "Building paho.mqtt.cpp ..."
cmake --build ${mqtt_build_dir} --config Release
log_info "Installing paho.mqtt.cpp ..."
cmake --install ${mqtt_build_dir} --prefix "${advss_dep_path}" --config Release
popd
log_info "Clean up openssl dir..."
mv openssl_x86 openssl
rm -rf openssl_arm
;;
linux)
# Nothing to do for now

View File

@ -17,77 +17,56 @@ setopt FUNCTION_ARGZERO
# 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."
print -u2 -PR "%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
TRAPEXIT() {
local return_value=$?
if (( ${+CI} )) unset NSUnbufferedIO
return ${return_value}
}
TRAPZERR() {
if (( ${_loglevel:-3} > 2 )) {
print -u2 -PR "${CI:+::error::}%F{1} ✖︎ script execution error%f"
print -PR -e "
_trap_error() {
print -u2 -PR '%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=${${(s:-:)ZSH_ARGZERO:t:r}[2]}
local target="${host_os}-${CPUTYPE}"
local project_root=${SCRIPT_HOME:A:h:h}
local buildspec_file=${project_root}/buildspec.json
local buildspec_file="${project_root}/buildspec.json"
local dep_dir=""
trap '_trap_error' ZERR
fpath=("${SCRIPT_HOME}/utils.zsh" ${fpath})
autoload -Uz log_group log_info log_error log_output set_loglevel check_${host_os} setup_ccache
autoload -Uz log_info log_error log_output set_loglevel check_${host_os} setup_${host_os} setup_obs setup_ccache
if [[ ! -r ${buildspec_file} ]] {
log_error \
'No buildspec.json found. Please create a build specification for your project.'
'No buildspec.json found. Please create a build specification for your project.' \
'A buildspec.json.template file is provided in the repository to get you started.'
return 2
}
typeset -g -a skips=()
local -i verbosity=1
local -r _version='2.0.0'
local -i _verbosity=1
local -r _version='1.0.0'
local -r -a _valid_targets=(
macos-x86_64
macos-arm64
macos-universal
linux-x86_64
linux-aarch64
)
local target
local config='RelWithDebInfo'
local -r -a _valid_configs=(Debug RelWithDebInfo Release MinSizeRel)
local -i codesign=0
if [[ ${host_os} == linux ]] {
if [[ ${host_os} == 'macos' ]] {
local -r -a _valid_generators=(Xcode Ninja 'Unix Makefiles')
local generator="${${CI:+Ninja}:-Xcode}"
} else {
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"
} elif [[ ${host_os} == macos ]] {
local -r _usage_host="
%F{yellow} Additional options for macOS builds%f
-----------------------------------------------------------------------------
%B-s | --codesign%b Enable codesigning (macOS only)"
}
local -i print_config=0
local -r _usage="
Usage: %B${functrace[1]%:*}%b <option> [<options>]
@ -95,23 +74,28 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
%F{yellow} Build configuration options%f
-----------------------------------------------------------------------------
%B-t | --target%b Specify target
%B-c | --config%b Build configuration
%B-t | --target%b Specify target - default: %B%F{green}${host_os}-${CPUTYPE}%f%b
%B-c | --config%b Build configuration - default: %B%F{green}RelWithDebInfo%f%b
%B-s | --codesign%b Enable codesigning (macOS only)
%B-p | --portable%b Enable portable mode (Linux only)
%B-d | --dep%b Dependency directory name - default: %B%F{green}advss-build-dependencies%f%b
%B--skip-[all|build|deps]%b Skip all|building|checking for dependencies
%B--generator%b Specify build system to generate - default: %B%F{green}Ninja%f%b
Available generators:
- Ninja
- Unix Makefiles
- Xcode (macOS only)
%F{yellow} Output options%f
-----------------------------------------------------------------------------
%B-q | --quiet%b Quiet (error output only)
%B-v | --verbose%b Verbose (more detailed output)
%B--skip-[all|build|deps|unpack]%b Skip all|building OBS|checking for dependencies|unpacking dependencies
%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:-}"
%B-V | --version%b Print script version information"
local -a args
while (( # )) {
@ -145,35 +129,32 @@ ${_usage_host:-}"
log_output ${_usage}
exit 2
}
config=${2}
BUILD_CONFIG=${2}
shift 2
;;
-s|--codesign) codesign=1; shift ;;
-d|--dep)
dep_dir="${2}"
shift 2
;;
-s|--codesign) CODESIGN=1; shift ;;
-p|--portable) typeset -g PORTABLE=1; shift ;;
-q|--quiet) (( verbosity -= 1 )) || true; shift ;;
-v|--verbose) (( verbosity += 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 ;;
--debug) _verbosity=3; shift ;;
--generator)
if [[ ${host_os} == linux ]] {
if (( ! ${_valid_generators[(Ie)${2}]} )) {
log_error "Invalid value %B${2}%b for option %B${1}%b"
log_output ${_usage}
exit 2
}
generator=${2}
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)
local _skip="${${(s:-:)1}[-1]}"
local _check=(all deps unpack build)
(( ${_check[(Ie)${_skip}]} )) || log_warning "Invalid skip mode %B${_skip}%b supplied"
typeset -g -a skips=(${skips} ${_skip})
shift
@ -182,32 +163,30 @@ ${_usage_host:-}"
}
}
: "${target:="${host_os}-${CPUTYPE}"}"
set -- ${(@)args}
set_loglevel ${verbosity}
set_loglevel ${_verbosity}
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
check_${host_os}
setup_ccache
}
check_${host_os}
setup_ccache
if [[ ${host_os} == linux ]] {
autoload -Uz setup_linux && setup_linux
}
typeset -g QT_VERSION
typeset -g DEPLOYMENT_TARGET
typeset -g OBS_DEPS_VERSION
setup_${host_os}
local advss_deps_path
if [[ -z "${dep_dir}" ]] {
log_info "Building advss deps ..."
dep_dir=".deps/advss-build-dependencies"
${SCRIPT_HOME}/build-deps-${host_os}.zsh -c "${BUILD_CONFIG:-RelWithDebInfo}" -t "${target}" --generator "${generator}" -o "${dep_dir}"
dep_dir="advss-build-dependencies"
${SCRIPT_HOME}/build-deps-${host_os}.zsh -c "${BUILD_CONFIG:-RelWithDebInfo}" -t "${target}" --generator "${generator}" -o "${dep_dir}" --skip-deps --skip-unpack
}
advss_deps_path=$(realpath ${project_root}/${dep_dir})
advss_deps_path=$(realpath ${project_root}/../${dep_dir})
log_info "Using advss deps at $advss_deps_path ..."
local product_name
local product_version
local git_tag="$(git describe --tags)"
read -r product_name product_version <<< \
"$(jq -r '. | {name, version} | join(" ")' ${buildspec_file})"
@ -231,104 +210,77 @@ ${_usage_host:-}"
;;
}
setup_obs
pushd ${project_root}
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)build]}) )) {
log_group "Configuring ${product_name}..."
log_info "Configuring ${product_name}..."
local _plugin_deps="${project_root:h}/obs-build-dependencies/plugin-deps-${OBS_DEPS_VERSION}-qt${QT_VERSION}-${target##*-}"
local -a cmake_args=(
-DCMAKE_PREFIX_PATH="${advss_deps_path}"
-DCMAKE_BUILD_TYPE=${BUILD_CONFIG:-RelWithDebInfo}
-DQT_VERSION=${QT_VERSION}
-DCMAKE_PREFIX_PATH="${_plugin_deps};${advss_deps_path}"
)
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) ;;
}
if (( _loglevel == 0 )) cmake_args+=(-Wno_deprecated -Wno-dev --log-level=ERROR)
if (( _loglevel > 2 )) cmake_args+=(--debug-output)
local num_procs
local -r _preset="${target%%-*}${CI:+-ci}"
case ${target} {
macos-*)
if (( ${+CI} )) typeset -gx NSUnbufferedIO=YES
cmake_args+=(
-DCMAKE_PREFIX_PATH="${advss_deps_path}"
--preset ${_preset}
)
if (( codesign )) {
autoload -Uz read_codesign_team && read_codesign_team
if [[ -z ${CODESIGN_TEAM} ]] {
autoload -Uz read_codesign && read_codesign
}
autoload -Uz read_codesign
if (( ${+CODESIGN} )) {
read_codesign
}
num_procs=$(( $(sysctl -n hw.ncpu) + 1 ))
local openssl_lib_dir="${advss_deps_path}/openssl-combined/"
local openssl_include_dir="${advss_deps_path}/openssl/include"
cmake_args+=(
-DCODESIGN_TEAM=${CODESIGN_TEAM:-}
-DCODESIGN_IDENTITY=${CODESIGN_IDENT:--}
-DCMAKE_FRAMEWORK_PATH="${_plugin_deps}/Frameworks"
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
-DOBS_CODESIGN_LINKER=ON
-DOBS_BUNDLE_CODESIGN_IDENTITY="${CODESIGN_IDENT:--}"
-DOPENSSL_INCLUDE_DIR="${openssl_include_dir}"
-DOPENSSL_LIBRARIES="${openssl_lib_dir}/libcrypto.a;${openssl_lib_dir}/libssl.a"
)
cmake_build_args+=(--preset ${_preset} --parallel --config ${config} -- ONLY_ACTIVE_ARCH=NO -arch arm64 -arch x86_64)
cmake_install_args+=(build_macos --config ${config} --prefix "${project_root}/release/${config}")
local -a xcbeautify_opts=()
if (( _loglevel == 0 )) xcbeautify_opts+=(--quiet)
;;
linux-*)
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)"
if [[ ${CPUTYPE} != ${target##*-} ]] {
if is-at-least 3.21.0 ${cmake_version}; then
cmake_args+=(--toolchain "${project_root}/cmake/linux/toolchains/${target##*-}-linux-gcc.cmake")
else
cmake_args+=(-D"CMAKE_TOOLCHAIN_FILE=${project_root}/cmake/linux/toolchains/${target##*-}-linux-gcc.cmake")
fi
}
cmake_build_args+=(--preset ${_preset}-${target##*-} --config ${config})
if [[ ${generator} == 'Unix Makefiles' ]] {
cmake_build_args+=(--parallel $(( $(nproc) + 1 )))
if (( ${+PORTABLE} )) {
cmake_args+=(
-DLINUX_PORTABLE=ON
)
} else {
cmake_build_args+=(--parallel)
cmake_args+=(
-DCMAKE_INSTALL_PREFIX=/usr
-DLINUX_PORTABLE=OFF
)
}
cmake_install_args+=(build_${target##*-} --prefix ${project_root}/release/${config})
num_procs=$(( $(nproc) + 1 ))
;;
}
log_debug "Attempting to configure with CMake arguments: ${cmake_args}"
log_debug "Attempting to configure ${product_name} with CMake arguments: ${cmake_args}"
cmake -S . -B build_${target##*-} -G ${generator} ${cmake_args}
cmake ${cmake_args}
log_group "Building ${product_name}..."
if [[ ${host_os} == macos ]] {
if (( _loglevel > 1 )) {
cmake ${cmake_build_args}
} else {
cmake ${cmake_build_args} 2>&1 | xcbeautify ${xcbeautify_opts}
}
} else {
cmake ${cmake_build_args}
}
log_info "Building ${product_name}..."
local -a cmake_args=()
if (( _loglevel > 1 )) cmake_args+=(--verbose)
if [[ ${generator} == 'Unix Makefiles' ]] cmake_args+=(--parallel ${num_procs})
cmake --build build_${target##*-} --config ${BUILD_CONFIG:-RelWithDebInfo} ${cmake_args}
}
log_group "Installing ${product_name}..."
if (( _loglevel > 1 )) cmake_install_args+=(--verbose)
cmake ${cmake_install_args}
log_info "Installing ${product_name}..."
local -a cmake_args=()
if (( _loglevel > 1 )) cmake_args+=(--verbose)
cmake --install build_${target##*-} --config ${BUILD_CONFIG:-RelWithDebInfo} --prefix "${project_root}/release" ${cmake_args}
popd
log_group
}
build ${@}

View File

@ -17,70 +17,39 @@ setopt FUNCTION_ARGZERO
# 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."
print -u2 -PR "%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
TRAPEXIT() {
local return_value=$?
if (( ${+CI} )) {
unset NSUnbufferedIO
}
return ${return_value}
}
TRAPZERR() {
if (( ${_loglevel:-3} > 2 )) {
print -u2 -PR "${CI:+::error::}%F{1} ✖︎ script execution error%f"
print -PR -e "
_trap_error() {
print -u2 -PR '%F{1} ✖︎ script execution error%f'
print -PR -e "
Callstack:
${(j:\n :)funcfiletrace}
"
}
"
exit 2
}
package() {
if (( ! ${+SCRIPT_HOME} )) typeset -g SCRIPT_HOME=${ZSH_ARGZERO:A:h}
local host_os=${${(s:-:)ZSH_ARGZERO:t:r}[2]}
local target="${host_os}-${CPUTYPE}"
local project_root=${SCRIPT_HOME:A:h:h}
local buildspec_file=${project_root}/buildspec.json
local buildspec_file="${project_root}/buildspec.json"
trap '_trap_error' ZERR
fpath=("${SCRIPT_HOME}/utils.zsh" ${fpath})
autoload -Uz set_loglevel log_info log_group log_error log_output check_${host_os}
autoload -Uz set_loglevel log_info log_error log_output check_${host_os}
if [[ ! -r ${buildspec_file} ]] {
log_error \
'No buildspec.json found. Please create a build specification for your project.'
return 2
}
local -i verbosity=1
local -r _version='2.0.0'
local -i _verbosity=1
local -r _version='1.0.0'
local -r -a _valid_targets=(
macos-x86_64
macos-arm64
macos-universal
linux-x86_64
)
local target
local config='RelWithDebInfo'
local -r -a _valid_configs=(Debug RelWithDebInfo Release MinSizeRel)
local -i codesign=0
local -i notarize=0
local -i package=0
local -i skip_deps=0
if [[ ${host_os} == macos ]] {
local -r _usage_host="
%F{yellow} Additional options for macOS builds%f
-----------------------------------------------------------------------------
%B-s | --codesign%b Enable codesigning (macOS only)
%B-n | --notarize%b Enable notarization (macOS only)
%B-p | --package%b Create package installer (macOS only)"
}
local -r _usage="
Usage: %B${functrace[1]%:*}%b <option> [<options>]
@ -88,9 +57,11 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
%F{yellow} Package configuration options%f
-----------------------------------------------------------------------------
%B-t | --target%b Specify target
%B-c | --config%b Build configuration
%B--skip-deps%b Skip checking for dependencies
%B-t | --target%b Specify target - default: %B%F{green}${host_os}-${CPUTYPE}%f%b
%B-c | --config%b Build configuration - default: %B%F{green}RelWithDebInfo%f%b
%B-s | --codesign%b Enable codesigning (macOS only)
%B-n | --notarize%b Enable notarization (macOS only)
%B-z | --zip%b Zip only (Linux only)
%F{yellow} Output options%f
-----------------------------------------------------------------------------
@ -101,8 +72,7 @@ Usage: %B${functrace[1]%:*}%b <option> [<options>]
%F{yellow} General options%f
-----------------------------------------------------------------------------
%B-h | --help%b Print this usage help
%B-V | --version%b Print script version information
${_usage_host:-}"
%B-V | --version%b Print script version information"
local -a args
while (( # )) {
@ -131,152 +101,115 @@ ${_usage_host:-}"
shift 2
;;
-c|--config)
if (( !${_valid_configs[(Ie)${2}]} )) {
if (( ! ${_valid_configs[(Ie)${2}]} )) {
log_error "Invalid value %B${2}%b for option %B${1}%b"
log_output ${_usage}
exit 2
}
config=${2}
BUILD_CONFIG=${2}
shift 2
;;
-s|--codesign) typeset -g codesign=1; shift ;;
-n|--notarize) typeset -g notarize=1; typeset -g codesign=1; shift ;;
-p|--package) typeset -g package=1; shift ;;
--skip-deps) typeset -g skip_deps=1; shift ;;
-q|--quiet) (( verbosity -= 1 )) || true; shift ;;
-v|--verbose) (( verbosity += 1 )); shift ;;
-s|--codesign) typeset -g CODESIGN=1; shift ;;
-n|--notarize) typeset -g NOTARIZE=1; typeset -g CODESIGN=1; shift ;;
-z|--zip) typeset -g ZIP=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 ;;
--debug) _verbosity=3; shift ;;
*) log_error "Unknown option: %B${1}%b"; log_output ${_usage}; exit 2 ;;
}
}
: "${target:="${host_os}-${CPUTYPE}"}"
set -- ${(@)args}
set_loglevel ${verbosity}
set_loglevel ${_verbosity}
if (( ! skip_deps )) {
check_${host_os}
}
check_${host_os}
local product_name
local product_version
local git_tag="$(git describe --tags)"
read -r product_name product_version <<< \
"$(jq -r '. | {name, version} | join(" ")' ${buildspec_file})"
"$(jq -r '. | {name, version} | join(" ")' ${project_root}/buildspec.json)"
log_info "Using git tag as version identifier '${git_tag}'"
product_version="${git_tag}"
if [[ "${git_tag}" =~ '^([0-9]+\.){0,2}(\*|[0-9]+)$' ]] {
log_info "Using git tag as version identifier '${git_tag}'"
product_version="${git_tag}"
} else {
log_info "Using buildspec.json version identifier '${product_version}'"
}
if [[ ${host_os} == macos ]] {
if [[ ${host_os} == 'macos' ]] {
autoload -Uz check_packages read_codesign read_codesign_installer read_codesign_pass
local output_name="${product_name}-${product_version}-${host_os}-universal"
local output_name="${product_name}-${host_os}-${target##*-}.pkg"
if [[ ! -d ${project_root}/release/${config}/${product_name}.plugin ]] {
if [[ ! -d ${project_root}/release/${product_name}.plugin ]] {
log_error 'No release artifact found. Run the build script or the CMake install procedure first.'
return 2
}
local _tarflags='cJf'
if (( _loglevel > 1 || ${+CI} )) _tarflags="v${_tarflags}"
if [[ ! -f ${project_root}/build_${target##*-}/installer-macos.generated.pkgproj ]] {
log_error 'Packages project file not found. Run the build script or the CMake build and install procedures first.'
return 2
}
if (( package )) {
if [[ ! -f ${project_root}/release/${config}/${product_name}.pkg ]] {
log_error 'Installer Package not found. Run the build script or the CMake build and install procedures first.'
check_packages
log_info "Packaging ${product_name}..."
pushd ${project_root}
packagesbuild \
--build-folder ${project_root}/release \
${project_root}/build_${target##*-}/installer-macos.generated.pkgproj
if (( ${+CODESIGN} )) {
read_codesign_installer
productsign \
--sign "${CODESIGN_IDENT_INSTALLER}" \
"${project_root}/release/${product_name}.pkg" \
"${project_root}/release/${output_name}"
rm "${project_root}/release/${product_name}.pkg"
} else {
mv "${project_root}/release/${product_name}.pkg" \
"${project_root}/release/${output_name}"
}
if (( ${+CODESIGN} && ${+NOTARIZE} )) {
if [[ ! -f "${project_root}/release/${output_name}" ]] {
log_error "No package for notarization found."
return 2
}
log_group "Packaging ${product_name}..."
read_codesign_installer
read_codesign_pass
xcrun notarytool submit "${project_root}/release/${output_name}" \
--keychain-profile "OBS-Codesign-Password" --wait
xcrun stapler staple "${project_root}/release/${output_name}"
}
if (( ${+ZIP} )) {
local output_name="${product_name}-${host_os}-${target##*-}.zip"
pushd ${project_root}/release
zip -r "${output_name}" *~*.pkg
popd
}
popd
} elif [[ ${host_os} == 'linux' ]] {
if (( ${+ZIP} )) {
local output_name="${product_name}-${host_os}-${target##*-}.zip"
pushd ${project_root}/release
zip -r "${output_name}" *
popd
} else {
local -a cmake_args=()
if (( _loglevel > 1 )) cmake_args+=(--verbose)
pushd ${project_root}
if (( codesign )) {
read_codesign_installer
productsign \
--sign "${CODESIGN_IDENT_INSTALLER}" \
${project_root}/release/${config}/${product_name}.pkg \
${project_root}/release/${output_name}.pkg
rm ${project_root}/release/${config}/${product_name}.pkg
} else {
mv ${project_root}/release/${config}/${product_name}.pkg \
${project_root}/release/${output_name}.pkg
}
if (( codesign && notarize )) {
if [[ ! -f ${project_root}/release/${output_name}.pkg ]] {
log_error "No package for notarization found."
return 2
}
read_codesign_installer
read_codesign_pass
xcrun notarytool submit ${project_root}/release/${output_name}.pkg \
--keychain-profile "OBS-Codesign-Password" --wait
local -i _status=0
xcrun stapler staple ${project_root}/release/${output_name}.pkg || _status=1
if (( _status )) {
log_error "Notarization failed. Use 'xcrun notarytool log <submission ID>' to check for errors."
return 2
}
}
cmake --build build_${target##*-} --config ${BUILD_CONFIG:-RelWithDebInfo} -t package ${cmake_args}
popd
}
log_group "Archiving ${product_name}..."
pushd ${project_root}/release/${config}
XZ_OPT=-T0 tar "-${_tarflags}" ${project_root}/release/${output_name}.tar.xz ${product_name}.plugin
popd
if [[ ${config} == Release ]] {
log_group "Archiving ${product_name} Debug Symbols..."
pushd ${project_root}/release/${config}
XZ_OPT=-T0 tar "-${_tarflags}" ${project_root}/release/${output_name}-dSYMs.tar.xz ${product_name}.plugin.dSYM
popd
}
log_group
} elif [[ ${host_os} == linux ]] {
local -a cmake_args=()
if (( _loglevel > 1 )) cmake_args+=(--verbose)
log_group "Creating source tarball for ${product_name}..."
pushd ${project_root}
cmake --build build_${target##*-} --config ${config} -t package_source ${cmake_args}
popd
local output_name="${product_name}-${product_version}-${target##*-}-linux-gnu"
if (( package )) {
log_group "Packaging ${product_name}..."
pushd ${project_root}
cmake --build build_${target##*-} --config ${config} -t package ${cmake_args}
# Mark certain deps as optional
build-aux/CI/linux/demote-deps.sh ${project_root}/release/*.deb Recommends '(mqtt)|(opencv)|(tesseract)|(usb)|(x11)'
if [ ! -e ${project_root}/release/${output_name}.deb ]; then
mv ${project_root}/release/*.deb ${project_root}/release/${output_name}.deb
mv ${project_root}/release/*.ddeb ${project_root}/release/${output_name}.ddeb
fi
popd
}
log_group "Archiving ${product_name}..."
local _tarflags='cJf'
if (( _loglevel > 1 || ${+CI} )) _tarflags="v${_tarflags}"
pushd ${project_root}/release/${config}
XZ_OPT=-T0 tar "-${_tarflags}" ${project_root}/release/${output_name}.tar.xz (lib|share)
popd
log_group
}
}

View File

@ -13,10 +13,6 @@ param(
$ErrorActionPreference = 'Stop'
if (-not $Target) {
$Target = "x64"
}
if ( $DebugPreference -eq 'Continue' ) {
$VerbosePreference = 'Continue'
$InformationPreference = 'Continue'
@ -45,65 +41,28 @@ function Build {
. $Utility.FullName
}
if ( ! $SkipDeps ) {
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
}
Log-Information "Run plugin configure step to download OBS deps ..."
Push-Location -Stack BuildTemp
if ( ! ( ( $SkipAll ) -or ( $SkipBuild ) ) ) {
Ensure-Location $ProjectRoot
$CmakeArgs = @(
"-DCMAKE_PREFIX_PATH:PATH=${ADVSSDepPath}"
)
$CmakeBuildArgs = @()
$CmakeInstallArgs = @()
if ( $VerbosePreference -eq 'Continue' ) {
$CmakeBuildArgs += ('--verbose')
$CmakeInstallArgs += ('--verbose')
}
if ( $DebugPreference -eq 'Continue' ) {
$CmakeArgs += ('--debug-output')
}
$Preset = "windows-$(if ( $Env:CI -ne $null ) { 'ci-' })${Target}"
$CmakeArgs += @(
'--preset', $Preset
)
$CmakeBuildArgs += @(
'--build'
'--preset', $Preset
'--config', $Configuration
'--parallel'
'--', '/consoleLoggerParameters:Summary', '/noLogo'
)
$CmakeInstallArgs += @(
'--install', "build_${Target}"
'--prefix', "${ProjectRoot}/release/${Configuration}"
'--config', $Configuration
)
Log-Group "Configuring ${ProductName}..."
Invoke-External cmake @CmakeArgs
}
$BuildSpec = Get-Content -Path ${BuildSpecFile} -Raw | ConvertFrom-Json
$depsVersion = $BuildSpec.dependencies.prebuilt.version
$qtDepsVersion = $BuildSpec.dependencies.qt6.version
$OBSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/.deps/obs-deps-${depsVersion}-${Target});$(Resolve-Path -Path ${ProjectRoot}/.deps/obs-deps-qt6-${qtDepsVersion}-${Target})"
$ProductName = $BuildSpec.name
$ProductVersion = $BuildSpec.version
$script:VisualStudioVersion = ''
$script:PlatformSDK = '10.0.18363.657'
Setup-Host
if ( $CmakeGenerator -eq '' ) {
$CmakeGenerator = $script:VisualStudioVersion
}
$DepsPath = "plugin-deps-${script:DepsVersion}-*-${script:Target}"
$OBSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/../obs-build-dependencies/${DepsPath})"
if ( $OutDirName -eq '' ) {
$OutDirName = ".deps/advss-build-dependencies"
$OutDirName = "advss-build-dependencies"
}
New-Item -ItemType Directory -Force -Path ${ProjectRoot}/${OutDirName}
New-Item -ItemType Directory -Force -Path ${ProjectRoot}/../${OutDirName}
$ADVSSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/${OutDirName})"
$ADVSSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/../${OutDirName})"
$OpenCVPath = "${ProjectRoot}/deps/opencv"
$OpenCVBuildPath = "${OpenCVPath}/build"
@ -112,6 +71,9 @@ function Build {
Ensure-Location $ProjectRoot
$OpenCVCmakeArgs = @(
'-G', $CmakeGenerator
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
"-DCMAKE_BUILD_TYPE=Release"
"-DCMAKE_PREFIX_PATH:PATH=${OBSDepPath}"
"-DCMAKE_INSTALL_PREFIX:PATH=${ADVSSDepPath}"
@ -141,6 +103,9 @@ function Build {
Ensure-Location $ProjectRoot
$LeptonicaCmakeArgs = @(
'-G', $CmakeGenerator
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
"-DCMAKE_BUILD_TYPE=${Configuration}"
"-DCMAKE_PREFIX_PATH:PATH=${OBSDepPath}"
"-DCMAKE_INSTALL_PREFIX:PATH=${ADVSSDepPath}"
@ -173,6 +138,9 @@ function Build {
# Explicitly disable PkgConfig and tiff as it will lead build errors
$TesseractCmakeArgs = @(
'-G', $CmakeGenerator
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
"-DCMAKE_BUILD_TYPE=${Configuration}"
"-DCMAKE_PREFIX_PATH:PATH=${OBSDepPath}"
"-DCMAKE_INSTALL_PREFIX:PATH=${ADVSSDepPath}"
@ -199,75 +167,6 @@ function Build {
Log-Information "Install tesseract..."
Invoke-External cmake --install "${TesseractBuildPath}" --prefix "${ADVSSDepPath}" @TesseractCmakeArgs
Push-Location -Stack BuildLibusbTemp
Ensure-Location $ProjectRoot
$LibusbPath = "${ProjectRoot}/deps/libusb"
Log-Information "Building libusb..."
$msbuildExe = vswhere -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe | select-object -first 1
if ($msbuildExe) {
$env:CL="/wd5287"
Invoke-External $msbuildExe "${LibusbPath}/msvc/libusb.sln" /property:Configuration=Release /property:Platform=x64
Remove-Item Env:CL
$libusbBuildResultDirectory = "${LibusbPath}/build/v143/x64/Release"
if (-not (Test-Path -Path $libusbBuildResultDirectory)) {
$libusbBuildResultDirectory = "${LibusbPath}/x64/Release/dll"
}
Copy-Item -Path "${libusbBuildResultDirectory}/*" -Destination ${ADVSSDepPath} -Recurse -Force
} else {
Log-Information "Failed to locate msbuild.exe - skipping libusb build"
}
Push-Location -Stack BuildMqttTemp
Ensure-Location $ProjectRoot
$MqttPath = "${ProjectRoot}/deps/paho.mqtt.cpp"
$MqttBuildPath = "${MqttPath}/build"
# Explicitly disable PkgConfig and tiff as it will lead build errors
$MqttCmakeArgs = @(
"-DCMAKE_BUILD_TYPE=${Configuration}"
"-DCMAKE_PREFIX_PATH:PATH=${OBSDepPath}"
"-DCMAKE_INSTALL_PREFIX:PATH=${ADVSSDepPath}"
"-DPAHO_WITH_MQTT_C=ON"
"-DPAHO_WITH_SSL=ON"
)
# Try to find OpenSSL installed via winget
$pf64 = Join-Path $Env:ProgramFiles "OpenSSL-Win64"
$pf = Join-Path $Env:ProgramFiles "OpenSSL"
$possibleDirs = @($pf64, $pf)
$opensslDir = $possibleDirs | Where-Object { Test-Path (Join-Path $_ "include\openssl\ssl.h") } | Select-Object -First 1
if ($opensslDir) {
Write-Host "Detected OpenSSL at: $opensslDir"
$MqttCmakeArgs += "-DOPENSSL_ROOT_DIR=$opensslDir"
$MqttCmakeArgs += "-DOPENSSL_CRYPTO_LIBRARY=$opensslDir\lib\VC\x64\MD\libcrypto.lib"
$MqttCmakeArgs += "-DOPENSSL_SSL_LIBRARY=$opensslDir\lib\VC\x64\MD\libssl.lib"
} else {
Write-Warning "OpenSSL not found - maybe cmake will find it ..."
}
Log-Information "Configuring paho.mqtt.cpp..."
Invoke-External cmake -S ${MqttPath} -B ${MqttBuildPath} @MqttCmakeArgs
$MqttCmakeArgs = @(
'--config', "${Configuration}"
)
if ( $VerbosePreference -eq 'Continue' ) {
$MqttCmakeArgs += ('--verbose')
}
Log-Information "Building paho.mqtt.cpp..."
Invoke-External cmake --build "${MqttBuildPath}" @MqttCmakeArgs
Log-Information "Install paho.mqtt.cpp..."
Invoke-External cmake --install "${MqttBuildPath}" --prefix "${ADVSSDepPath}" @MqttCmakeArgs
}
Build

View File

@ -1,13 +1,16 @@
[CmdletBinding()]
param(
[ValidateSet('x64')]
[string] $Target = 'x64',
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
[string] $Configuration = 'RelWithDebInfo',
[ValidateSet('x86', 'x64')]
[string] $Target,
[ValidateSet('Visual Studio 17 2022', 'Visual Studio 16 2019')]
[string] $CMakeGenerator,
[string] $ADVSSDepName,
[switch] $SkipAll,
[switch] $SkipBuild,
[switch] $SkipDeps,
[string] $ADVSSDepName
[switch] $SkipUnpack
)
$ErrorActionPreference = 'Stop'
@ -17,10 +20,6 @@ if ( $DebugPreference -eq 'Continue' ) {
$InformationPreference = 'Continue'
}
if ( ! ( [System.Environment]::Is64BitOperatingSystem ) ) {
throw "A 64-bit system is required to build the project."
}
if ( $PSVersionTable.PSVersion -lt '7.0.0' ) {
Write-Warning 'The obs-deps PowerShell build script requires PowerShell Core 7. Install or upgrade your PowerShell version: https://aka.ms/pscore6'
exit 2
@ -30,7 +29,6 @@ function Build {
trap {
Pop-Location -Stack BuildTemp -ErrorAction 'SilentlyContinue'
Write-Error $_
Log-Group
exit 2
}
@ -40,7 +38,7 @@ function Build {
$UtilityFunctions = Get-ChildItem -Path $PSScriptRoot/utils.pwsh/*.ps1 -Recurse
foreach($Utility in $UtilityFunctions) {
foreach ($Utility in $UtilityFunctions) {
Write-Debug "Loading $($Utility.FullName)"
. $Utility.FullName
}
@ -49,82 +47,66 @@ function Build {
$ProductName = $BuildSpec.name
$ProductVersion = $BuildSpec.version
$GitOutput = git describe --tags
if ($GitOutput -match '^([0-9]+\.){0,2}(\*|[0-9]+)$') {
Log-Information "Using git tag as version identifier '${GitOutput}'"
$ProductVersion = $GitOutput
} else {
Log-Information "Using buildspec.json version identifier '${ProductVersion}'"
$script:DepsVersion = ''
$script:QtVersion = '5'
$script:VisualStudioVersion = ''
$script:PlatformSDK = '10.0.18363.657'
Setup-Host
if ( $CmakeGenerator -eq '' ) {
$CmakeGenerator = $script:VisualStudioVersion
}
if ( ! $SkipDeps ) {
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
}
$DepsPath = "plugin-deps-${script:DepsVersion}-qt${script:QtVersion}-${script:Target}"
$DepInstallPath = "$(Resolve-Path -Path ${ProjectRoot}/../obs-build-dependencies/${DepsPath})"
if ( $ADVSSDepName -eq '' ) {
$ADVSSDepName = ".deps/advss-build-dependencies"
Log-Information "Building advss deps ..."
$ADVSSDepName = "advss-build-dependencies"
invoke-expression -Command "$PSScriptRoot/Build-Deps-Windows.ps1 -Configuration $Configuration -Target $Target -CMakeGenerator `"$CMakeGenerator`" -OutDirName $ADVSSDepName -SkipDeps -SkipUnpack"
}
if ( -not (Test-Path -LiteralPath "${ProjectRoot}/${ADVSSDepName}") ) {
Log-Information "Building advss deps ${ProjectRoot}/${ADVSSDepName} ..."
invoke-expression -Command "$PSScriptRoot/Build-Deps-Windows.ps1 -Configuration $Configuration -Target $Target -OutDirName $ADVSSDepName"
}
$ADVSSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/${ADVSSDepName})"
$ADVSSDepPath = "$(Resolve-Path -Path ${ProjectRoot}/../${script:ADVSSDepName})"
Log-Information "Using advss deps at $ADVSSDepPath ..."
(Get-Content -Path ${ProjectRoot}/CMakeLists.txt -Raw) `
-replace "project\((.*) VERSION (.*)\)", "project(${ProductName} VERSION ${ProductVersion})" `
| Out-File -Path ${ProjectRoot}/CMakeLists.txt -NoNewline
Setup-Obs
Push-Location -Stack BuildTemp
if ( ! ( ( $SkipAll ) -or ( $SkipBuild ) ) ) {
Ensure-Location $ProjectRoot
$CmakeArgs = @()
$CmakeBuildArgs = @()
$CmakeInstallArgs = @()
$CmakeArgs = @(
'-G', $CmakeGenerator
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
"-DCMAKE_BUILD_TYPE=${Configuration}"
"-DCMAKE_PREFIX_PATH:PATH=${DepInstallPath};${ADVSSDepPath}"
"-DQT_VERSION=${script:QtVersion}"
)
Log-Debug "Attempting to configure OBS with CMake arguments: $($CmakeArgs | Out-String)"
Log-Information "Configuring ${ProductName}..."
Invoke-External cmake -S . -B build_${script:Target} @CmakeArgs
$CmakeArgs = @(
'--config', "${Configuration}"
)
if ( $VerbosePreference -eq 'Continue' ) {
$CmakeBuildArgs += ('--verbose')
$CmakeInstallArgs += ('--verbose')
$CmakeArgs += ('--verbose')
}
if ( $DebugPreference -eq 'Continue' ) {
$CmakeArgs += ('--debug-output')
}
$Preset = "windows-$(if ( $Env:CI -ne $null ) { 'ci-' })${Target}"
$CmakeArgs += @(
'--preset', $Preset
"-DCMAKE_PREFIX_PATH:PATH=${ADVSSDepPath}"
)
$CmakeBuildArgs += @(
'--build'
'--preset', $Preset
'--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-Information "Building ${ProductName}..."
Invoke-External cmake --build "build_${script:Target}" @CmakeArgs
}
Log-Group "Install ${ProductName}..."
Invoke-External cmake @CmakeInstallArgs
Log-Information "Install ${ProductName}..."
Invoke-External cmake --install "build_${script:Target}" --prefix "${ProjectRoot}/release" @CmakeArgs
Pop-Location -Stack BuildTemp
Log-Group
}
Build

View File

@ -1,11 +1,10 @@
[CmdletBinding()]
param(
[ValidateSet('x64')]
[string] $Target = 'x64',
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
[string] $Configuration = 'RelWithDebInfo',
[switch] $BuildInstaller,
[switch] $SkipDeps
[ValidateSet('x86', 'x64', 'x86+x64')]
[string] $Target,
[switch] $BuildInstaller = $false
)
$ErrorActionPreference = 'Stop'
@ -15,21 +14,14 @@ if ( $DebugPreference -eq 'Continue' ) {
$InformationPreference = 'Continue'
}
if ( ! ( [System.Environment]::Is64BitOperatingSystem ) ) {
throw "Packaging script requires a 64-bit system to build and run."
}
if ( $PSVersionTable.PSVersion -lt '7.0.0' ) {
Write-Warning 'The packaging script requires PowerShell Core 7. Install or upgrade your PowerShell version: https://aka.ms/pscore6'
Write-Warning 'The obs-deps PowerShell build script requires PowerShell Core 7. Install or upgrade your PowerShell version: https://aka.ms/pscore6'
exit 2
}
function Package {
trap {
Pop-Location -Stack BuildTemp -ErrorAction 'SilentlyContinue'
Write-Error $_
Log-Group
exit 2
}
@ -46,17 +38,12 @@ function Package {
$BuildSpec = Get-Content -Path ${BuildSpecFile} -Raw | ConvertFrom-Json
$ProductName = $BuildSpec.name
$ProductVersion = $BuildSpec.version
$GitOutput = git describe --tags
Log-Information "Using git tag as version identifier '${GitOutput}'"
$ProductVersion = $GitOutput
$OutputName = "${ProductName}-windows-${Target}"
$OutputName = "${ProductName}-${ProductVersion}-windows-${Target}"
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
if ( ! $SkipDeps ) {
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
}
Log-Information "Packaging ${ProductName}..."
$RemoveArgs = @{
ErrorAction = 'SilentlyContinue'
@ -68,20 +55,19 @@ function Package {
Remove-Item @RemoveArgs
Log-Group "Archiving ${ProductName}..."
$CompressArgs = @{
Path = (Get-ChildItem -Path "${ProjectRoot}/release/${Configuration}" -Exclude "${OutputName}*.*")
CompressionLevel = 'Optimal'
DestinationPath = "${ProjectRoot}/release/${OutputName}.zip"
Verbose = ($Env:CI -ne $null)
}
Compress-Archive -Force @CompressArgs
Log-Group
if ( ( $BuildInstaller ) ) {
Log-Group "Packaging ${ProductName}..."
if ( $Target -eq 'x86+x64' ) {
$IsccCandidates = Get-ChildItem -Recurse -Path '*.iss'
if ( $IsccCandidates.length -gt 0 ) {
$IsccFile = $IsccCandidates[0].FullName
} else {
$IsccFile = ''
}
} else {
$IsccFile = "${ProjectRoot}/build_${Target}/installer-Windows.generated.iss"
}
$IsccFile = "${ProjectRoot}/build_${Target}/installer-Windows.generated.iss"
if ( ! ( Test-Path -Path $IsccFile ) ) {
throw 'InnoSetup install script not found. Run the build script or the CMake build and install procedures first.'
}
@ -89,13 +75,17 @@ function Package {
Log-Information 'Creating InnoSetup installer...'
Push-Location -Stack BuildTemp
Ensure-Location -Path "${ProjectRoot}/release"
Copy-Item -Path ${Configuration} -Destination Package -Recurse
Invoke-External iscc ${IsccFile} /O"${ProjectRoot}/release" /F"${OutputName}-Installer"
Remove-Item -Path Package -Recurse
Invoke-External iscc ${IsccFile} /O. /F"${OutputName}-Installer"
Pop-Location -Stack BuildTemp
Log-Group
}
$CompressArgs = @{
Path = (Get-ChildItem -Path "${ProjectRoot}/release" -Exclude "${OutputName}*.*")
CompressionLevel = 'Optimal'
DestinationPath = "${ProjectRoot}/release/${OutputName}.zip"
}
Compress-Archive -Force @CompressArgs
}
Package

13
.github/scripts/build-linux.sh vendored Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
if ! type zsh > /dev/null 2>&1; then
echo ' => Installing script dependency Zsh.'
sudo apt-get -y update
sudo apt-get -y install zsh
fi
SCRIPT=$(readlink -f "${0}")
SCRIPT_DIR=$(dirname "${SCRIPT}")
zsh ${SCRIPT_DIR}/build-linux.zsh "${@}"

11
.github/scripts/check-changes.sh vendored Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
dirty=$(git ls-files --modified)
set +x
if [[ $dirty ]]; then
echo "================================="
echo "Files were not formatted properly"
echo "$dirty"
echo "================================="
exit 1
fi

53
.github/scripts/check-cmake.sh vendored Executable file
View File

@ -0,0 +1,53 @@
#!/usr/bin/env bash
set -o errexit
set -o pipefail
if [ ${#} -eq 1 -a "${1}" = "VERBOSE" ]; then
VERBOSITY="-l debug"
else
VERBOSITY=""
fi
if [ "${CI}" ]; then
MODE="--check"
else
MODE="-i"
fi
# Runs the formatter in parallel on the code base.
# Return codes:
# - 1 there are files to be formatted
# - 0 everything looks fine
# Get CPU count
OS=$(uname)
NPROC=1
if [[ ${OS} = "Linux" ]] ; then
NPROC=$(nproc)
elif [[ ${OS} = "Darwin" ]] ; then
NPROC=$(sysctl -n hw.physicalcpu)
fi
# Discover clang-format
if ! type cmake-format 2> /dev/null ; then
echo "Required cmake-format not found"
exit 1
fi
find . -type d \( \
-path ./\*build -o \
-path ./deps/jansson -o \
-path ./plugins/decklink/\*/decklink-sdk -o \
-path ./plugins/enc-amf -o \
-path ./plugins/mac-syphon/syphon-framework -o \
-path ./plugins/obs-outputs/ftl-sdk -o \
-path ./plugins/obs-vst -o \
-path ./plugins/obs-browser -o \
-path ./plugins/win-dshow/libdshowcapture -o \
-path ./plugins/obs-websocket/deps -o \
-path ./deps \
\) -prune -false -type f -o \
-name 'CMakeLists.txt' -or \
-name '*.cmake' \
| xargs -L10 -P ${NPROC} cmake-format ${MODE} ${VERBOSITY}

60
.github/scripts/check-format.sh vendored Executable file
View File

@ -0,0 +1,60 @@
#!/usr/bin/env bash
# Original source https://github.com/Project-OSRM/osrm-backend/blob/master/scripts/format.sh
set -o errexit
set -o pipefail
set -o nounset
if [ ${#} -eq 1 ]; then
VERBOSITY="--verbose"
else
VERBOSITY=""
fi
# Runs the Clang Formatter in parallel on the code base.
# Return codes:
# - 1 there are files to be formatted
# - 0 everything looks fine
# Get CPU count
OS=$(uname)
NPROC=1
if [[ ${OS} = "Linux" ]] ; then
NPROC=$(nproc)
elif [[ ${OS} = "Darwin" ]] ; then
NPROC=$(sysctl -n hw.physicalcpu)
fi
# Discover clang-format
if type clang-format-13 2> /dev/null ; then
CLANG_FORMAT=clang-format-13
elif type clang-format 2> /dev/null ; then
# Clang format found, but need to check version
CLANG_FORMAT=clang-format
V=$(clang-format --version)
if [[ $V != *"version 13.0"* ]]; then
echo "clang-format is not 13.0 (returned ${V})"
exit 1
fi
else
echo "No appropriate clang-format found (expected clang-format-13.0.0, or clang-format)"
exit 1
fi
find . -type d \( \
-path ./\*build -o \
-path ./cmake -o \
-path ./plugins/decklink/\*/decklink-sdk -o \
-path ./plugins/enc-amf -o \
-path ./plugins/mac-syphon/syphon-framework -o \
-path ./plugins/obs-outputs/ftl-sdk -o \
-path ./plugins/obs-websocket/deps -o \
-path ./deps \
\) -prune -false -type f -o \
-name '*.h' -or \
-name '*.hpp' -or \
-name '*.m' -or \
-name '*.mm' -or \
-name '*.c' -or \
-name '*.cpp' \
| xargs -L100 -P ${NPROC} "${CLANG_FORMAT}" ${VERBOSITY} -i -style=file -fallback-style=none

13
.github/scripts/package-linux.sh vendored Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
if ! type zsh > /dev/null 2>&1; then
echo ' => Installing script dependency Zsh.'
sudo apt-get update
sudo apt-get install zsh
fi
SCRIPT=$(readlink -f "${0}")
SCRIPT_DIR=$(dirname "${SCRIPT}")
zsh ${SCRIPT_DIR}/package-linux.zsh "${@}"

View File

@ -0,0 +1,25 @@
function Check-Git {
<#
.SYNOPSIS
Ensures available git executable on host system.
.DESCRIPTION
Checks whether a git command is available on the host system. If none is found,
Git is installed via winget.
.EXAMPLE
Check-Git
#>
if ( ! ( Test-Path function:Log-Info ) ) {
. $PSScriptRoot/Logger.ps1
}
Log-Information 'Checking for Git executable...'
if ( ! ( Get-Command git ) ) {
Log-Warning 'No Git executable found. Will try to install via winget.'
winget install git
} else {
Log-Debug "Git found at $(Get-Command git)."
Log-Status "Git found."
}
}

View File

@ -17,12 +17,8 @@ function Install-BuildDependencies {
if ( ! ( Test-Path function:Log-Warning ) ) {
. $PSScriptRoot/Logger.ps1
}
$Prefixes = @{
'x64' = ${Env:ProgramFiles}
'x86' = ${Env:ProgramFiles(x86)}
'arm64' = ${Env:ProgramFiles(arm)}
}
$Host64Bit = [System.Environment]::Is64BitOperatingSystem
$Paths = $Env:Path -split [System.IO.Path]::PathSeparator
@ -32,15 +28,14 @@ function Install-BuildDependencies {
$WingetOptions += '--silent'
}
Log-Group 'Check Windows build requirements'
Get-Content $WingetFile | ForEach-Object {
$_, $Package, $_, $Path, $_, $Binary, $_, $Version = $_ -replace ',','' -split " +(?=(?:[^\']*\'[^\']*\')*[^\']*$)" -replace "'",''
$_, $Package, $_, $Path, $_, $Binary = ([regex]::Split($_, " (?=(?:[^']|'[^']*')*$)")) -replace ',', '' -replace "'",''
$Prefixes.GetEnumerator() | ForEach-Object {
$Prefix = $_.value
(${Env:ProgramFiles(x86)}, $Env:ProgramFiles) | ForEach-Object {
$Prefix = $_
$FullPath = "${Prefix}\${Path}"
if ( ( Test-Path $FullPath ) -and ! ( $Paths -contains $FullPath ) ) {
$Paths = @($FullPath) + $Paths
$Paths += $FullPath
$Env:Path = $Paths -join [System.IO.Path]::PathSeparator
}
}
@ -51,11 +46,7 @@ function Install-BuildDependencies {
if ( $Found ) {
Log-Status "Found dependency ${Binary} as $($Found.Source)"
} else {
Log-Status "Installing package ${Package} $(if ( $Version -ne $null ) { "Version: ${Version}" } )"
if ( $Version -ne $null ) {
$WingetOptions += @('--version', ${Version})
}
Log-Status "Installing package ${Package}"
try {
$Params = $WingetOptions + $Package
@ -66,5 +57,4 @@ function Install-BuildDependencies {
}
}
}
Log-Group
}

View File

@ -0,0 +1,117 @@
function Set-GitConfig {
<#
.SYNOPSIS
Sets a git config value.
.DESCRIPTION
Allows setting single or multiple config values in a PowerShell-friendly fashion.
.EXAMPLE
Set-GitConfig advice.detachedHead false
#>
if ( $args.Count -lt 2 ) {
throw 'Set-GitConfig called without required arguments <OPTION> <VALUE>.'
}
Invoke-External git config @args
}
function Invoke-GitCheckout {
<#
.SYNOPSIS
Checks out a specified git repository.
.DESCRIPTION
Wraps the git executable with PowerShell syntax to check out
a specified Git repository with a given commit hash and branch,
or a GitHub pull request ID.
.EXAMPLE
Invoke-GitCheckout -Uri "My-Repo-Uri" -Commit "My-Commit-Hash"
Invoke-GitCheckout -Uri "My-Repo-Uri" -Commit "My-Commit-Hash" -Branch "main"
Invoke-GitCheckout -Uri "My-Repo-Uri" -Commit "My-Commit-Hash" -PullRequest 250
#>
param(
[Parameter(Mandatory)]
[string] $Uri,
[Parameter(Mandatory)]
[string] $Commit,
[string] $Path,
[string] $Branch = "master",
[string] $PullRequest
)
if ( ! ( $Uri -like "*github.com*" ) -and ( $PullRequest -ne "" ) ) {
throw 'Fetching pull requests is only supported with GitHub-based repositories.'
}
if ( ! ( Test-Path function:Log-Information ) ) {
. $PSScriptRoot/Logger.ps1
}
if ( ! ( Test-Path function:Invoke-External ) ) {
. $PSScriptRoot/Invoke-External.ps1
}
$RepositoryName = [System.IO.Path]::GetFileNameWithoutExtension($Uri)
if ( $Path -eq "" ) {
$Path = "$(Get-Location | Convert-Path)\${RepositoryName}"
}
Push-Location -Stack GitCheckoutTemp
if ( Test-Path $Path/.git ) {
Write-Information "Repository ${RepositoryName} found in ${Path}"
Set-Location $Path
Set-GitConfig advice.detachedHead false
Set-GitConfig remote.origin.url $Uri
Set-GitConfig remote.origin.tapOpt --no-tags
$Ref = "+refs/heads/{0}:refs/remotes/origin/{0}" -f $Branch
Set-GitConfig --replace-all remote.origin.fetch $Ref
if ( $PullRequest -ne "" ) {
try {
Invoke-External git show-ref --quiet --verify refs/heads/pr-$PullRequest
} catch {
Invoke-External git fetch origin $("pull/{0}/head:pull-{0}" -f $PullRequest)
} finally {
Invoke-External git checkout -f "pull-${PullRequest}"
}
}
try {
$null = Invoke-External git rev-parse -q --verify "${Commit}^{commit}"
} catch {
Invoke-External git fetch origin
}
Invoke-External git checkout -f $Commit -- | Log-Information
} else {
Invoke-External git clone $Uri $Path
Set-Location $Path
Set-GitConfig advice.detachedHead false
if ( $PullRequest -ne "" ) {
$Ref = "pull/{0}/head:pull-{0}" -f $PullRequest
$Branch = "pull-${PullRequest}"
Invoke-External git fetch origin $Ref
Invoke-External git checkout $Branch
}
Invoke-External git checkout -f $Commit
}
Log-Information "Checked out commit ${Commit} on branch ${Branch}"
if ( Test-Path ${Path}/.gitmodules ) {
Invoke-External git submodule foreach --recursive git submodule sync
Invoke-External git submodule update --init --recursive
}
Pop-Location -Stack GitCheckoutTemp
}

View File

@ -8,7 +8,7 @@ function Log-Debug {
Process {
foreach($m in $Message) {
Write-Debug "$(if ( $env:CI -ne $null ) { '::debug::' })$m"
Write-Debug $m
}
}
}
@ -38,7 +38,7 @@ function Log-Warning {
Process {
foreach($m in $Message) {
Write-Warning "$(if ( $env:CI -ne $null ) { '::warning::' })$m"
Write-Warning $m
}
}
}
@ -53,7 +53,7 @@ function Log-Error {
Process {
foreach($m in $Message) {
Write-Error "$(if ( $env:CI -ne $null ) { '::error::' })$m"
Write-Error $m
}
}
}
@ -79,32 +79,6 @@ function Log-Information {
}
}
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(

View File

@ -0,0 +1,103 @@
function Setup-Host {
if ( ! ( Test-Path function:Log-Output ) ) {
. $PSScriptRoot/Logger.ps1
}
if ( ! ( Test-Path function:Ensure-Location ) ) {
. $PSScriptRoot/Ensure-Location.ps1
}
if ( ! ( Test-Path function:Install-BuildDependencies ) ) {
. $PSScriptRoot/Install-BuildDependencies.ps1
}
if ( ! ( Test-Path function:Expand-ArchiveExt ) ) {
. $PSScriptRoot/Expand-ArchiveExt.ps1
}
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
if ( $script:Target -eq '' ) { $script:Target = $script:HostArchitecture }
$script:QtVersion = $BuildSpec.platformConfig."windows-${script:Target}".qtVersion
$script:VisualStudioVersion = $BuildSpec.platformConfig."windows-${script:Target}".visualStudio
$script:PlatformSDK = $BuildSpec.platformConfig."windows-${script:Target}".platformSDK
if ( ! ( ( $script:SkipAll ) -or ( $script:SkipDeps ) ) ) {
('prebuilt', "qt${script:QtVersion}") | ForEach-Object {
$_Dependency = $_
$_Version = $BuildSpec.dependencies."${_Dependency}".version
$_BaseUrl = $BuildSpec.dependencies."${_Dependency}".baseUrl
$_Label = $BuildSpec.dependencies."${_Dependency}".label
$_Hash = $BuildSpec.dependencies."${_Dependency}".hashes."windows-${script:Target}"
if ( $BuildSpec.dependencies."${_Dependency}".PSobject.Properties.Name -contains "pdb-hashes" ) {
$_PdbHash = $BuildSpec.dependencies."${_Dependency}".'pdb-hashes'."$windows-${script:Target}"
}
if ( $_Version -eq '' ) {
throw "No ${_Dependency} spec found in ${script:BuildSpecFile}."
}
Log-Information "Setting up ${_Label}..."
Push-Location -Stack BuildTemp
Ensure-Location -Path "$(Resolve-Path -Path "${ProjectRoot}/..")/obs-build-dependencies"
switch -wildcard ( $_Dependency ) {
prebuilt {
$_Filename = "windows-deps-${_Version}-${script:Target}.zip"
$_Uri = "${_BaseUrl}/${_Version}/${_Filename}"
$_Target = "plugin-deps-${_Version}-qt${script:QtVersion}-${script:Target}"
$script:DepsVersion = ${_Version}
}
"qt*" {
$_Filename = "windows-deps-qt${script:QtVersion}-${_Version}-${script:Target}.zip"
$_Uri = "${_BaseUrl}/${_Version}/${_Filename}"
$_Target = "plugin-deps-${_Version}-qt${script:QtVersion}-${script:Target}"
}
}
if ( ! ( Test-Path -Path $_Filename ) ) {
$Params = @{
UserAgent = 'NativeHost'
Uri = $_Uri
OutFile = $_Filename
UseBasicParsing = $true
ErrorAction = 'Stop'
}
Invoke-WebRequest @Params
Log-Status "Downloaded ${_Label} for ${script:Target}."
} else {
Log-Status "Found downloaded ${_Label}."
}
$_FileHash = Get-FileHash -Path $_Filename -Algorithm SHA256
if ( $_FileHash.Hash.ToLower() -ne $_Hash ) {
throw "Checksum of downloaded ${_Label} does not match specification. Expected '${_Hash}', 'found $(${_FileHash}.Hash.ToLower())'"
}
Log-Status "Checksum of downloaded ${_Label} matches."
if ( ! ( ( $script:SkipAll ) -or ( $script:SkipUnpack ) ) ) {
Push-Location -Stack BuildTemp
Ensure-Location -Path $_Target
Expand-ArchiveExt -Path "../${_Filename}" -DestinationPath . -Force
Pop-Location -Stack BuildTemp
}
Pop-Location -Stack BuildTemp
}
}
}
function Get-HostArchitecture {
$Host64Bit = [System.Environment]::Is64BitOperatingSystem
$HostArchitecture = ('x86', 'x64')[$Host64Bit]
return $HostArchitecture
}
$script:HostArchitecture = Get-HostArchitecture

View File

@ -0,0 +1,84 @@
function Setup-Obs {
if ( ! ( Test-Path function:Log-Output ) ) {
. $PSScriptRoot/Logger.ps1
}
if ( ! ( Test-Path function:Check-Git ) ) {
. $PSScriptRoot/Check-Git.ps1
}
Check-Git
if ( ! ( Test-Path function:Ensure-Location ) ) {
. $PSScriptRoot/Ensure-Location.ps1
}
if ( ! ( Test-Path function:Invoke-GitCheckout ) ) {
. $PSScriptRoot/Invoke-GitCheckout.ps1
}
if ( ! ( Test-Path function:Invoke-External ) ) {
. $PSScriptRoot/Invoke-External.ps1
}
Log-Information 'Setting up OBS Studio...'
$ObsVersion = $BuildSpec.dependencies.'obs-studio'.version
$ObsRepository = $BuildSpec.dependencies.'obs-studio'.repository
$ObsBranch = $BuildSpec.dependencies.'obs-studio'.branch
$ObsHash = $BuildSpec.dependencies.'obs-studio'.hash
if ( $ObsVersion -eq '' ) {
throw 'No obs-studio version found in buildspec.json.'
}
Push-Location -Stack BuildTemp
Ensure-Location -Path "$(Resolve-Path -Path "${ProjectRoot}/../")/obs-studio"
if ( ! ( ( $script:SkipAll ) -or ( $script:SkipUnpack ) ) ) {
Invoke-GitCheckout -Uri $ObsRepository -Commit $ObsHash -Path . -Branch $ObsBranch
}
if ( ! ( ( $script:SkipAll ) -or ( $script:SkipBuild ) ) ) {
Log-Information 'Configuring OBS Studio...'
$NumProcessors = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
if ( $NumProcessors -gt 1 ) {
$env:UseMultiToolTask = $true
$env:EnforceProcessCountAcrossBuilds = $true
}
$DepsPath = "plugin-deps-${script:DepsVersion}-qt${script:QtVersion}-${script:Target}"
$CmakeArgs = @(
'-G', $CmakeGenerator
"-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
"-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
"-DCMAKE_BUILD_TYPE=${script:Configuration}"
"-DQT_VERSION=${script:QtVersion}"
'-DENABLE_PLUGINS=OFF'
'-DENABLE_UI=OFF'
'-DENABLE_SCRIPTING=OFF'
"-DCMAKE_INSTALL_PREFIX:PATH=$(Resolve-Path -Path "${ProjectRoot}/../obs-build-dependencies/${DepsPath}")"
"-DCMAKE_PREFIX_PATH:PATH=$(Resolve-Path -Path "${ProjectRoot}/../obs-build-dependencies/${DepsPath}")"
)
Log-Debug "Attempting to configure OBS with CMake arguments: $($CmakeArgs | Out-String)"
Log-Information "Configuring OBS..."
Invoke-External cmake -S . -B plugin_build_${script:Target} @CmakeArgs
Log-Information 'Building libobs and obs-frontend-api...'
$CmakeArgs = @(
'--config', "$( if ( $script:Configuration -eq '' ) { 'RelWithDebInfo' } else { $script:Configuration })"
)
if ( $VerbosePreference -eq 'Continue' ) {
$CmakeArgs+=('--verbose')
}
Invoke-External cmake --build plugin_build_${script:Target} @CmakeArgs -t obs-frontend-api
Invoke-External cmake --install plugin_build_${script:Target} @CmakeArgs --component obs_libraries
}
Pop-Location -Stack BuildTemp
}

37
.github/scripts/utils.zsh/check_linux vendored Normal file → Executable file
View File

@ -1,20 +1,4 @@
autoload -Uz log_info log_status log_error log_debug log_warning log_group
log_group 'Check Linux build requirements'
log_debug 'Checking Linux distribution name and version...'
# Check for Ubuntu version 22.10 or later, which have srt and librist available via apt-get
typeset -g -i UBUNTU_2210_OR_LATER=0
if [[ -f /etc/os_release ]] {
local dist_name
local dist_version
read -r dist_name dist_version <<< "$(source /etc/os_release; print "${NAME} ${VERSION_ID}")"
autoload -Uz is-at-least
if [[ ${dist_name} == Ubuntu ]] && is-at-least 22.10 ${dist_version}; then
typeset -g -i UBUNTU_2210_OR_LATER=1
fi
}
autoload -Uz log_info log_status log_error log_debug log_warning
log_debug 'Checking for apt-get...'
if (( ! ${+commands[apt-get]} )) {
@ -24,14 +8,12 @@ if (( ! ${+commands[apt-get]} )) {
log_debug "Apt-get located at ${commands[apt-get]}"
}
local -a dependencies=("${(fA)$(<${SCRIPT_HOME}/.Aptfile)}")
local -a dependencies=("${(f)$(<${SCRIPT_HOME}/.Aptfile)}")
local -a install_list
local binary
sudo apt-get update -qq
for dependency (${dependencies}) {
local -a tokens=(${=dependency//(,|:|\')/})
local -a tokens=(${(s: :)dependency//(,|:|\')/})
if [[ ! ${tokens[1]} == 'package' ]] continue
@ -44,18 +26,11 @@ for dependency (${dependencies}) {
if (( ! ${+commands[${binary}]} )) install_list+=(${tokens[2]})
}
local -a _quiet=('' '--quiet')
log_debug "List of dependencies to install: ${install_list}"
if (( ${#install_list} )) {
if (( ! ${+CI} )) log_warning 'Dependency installation via apt may require elevated privileges'
local -a apt_args=(
${CI:+-y}
--no-install-recommends
)
if (( _loglevel == 0 )) apt_args+=(--quiet)
sudo apt-get ${apt_args} install ${install_list}
sudo apt-get -y install ${install_list} ${_quiet[(( (_loglevel == 0) + 1 ))]}
}
rehash
log_group

12
.github/scripts/utils.zsh/check_macos vendored Normal file → Executable file
View File

@ -1,10 +1,9 @@
autoload -Uz is-at-least log_group log_info log_error log_status read_codesign
autoload -Uz is-at-least log_info log_error log_status read_codesign
local macos_version=$(sw_vers -productVersion)
log_group 'Install macOS build requirements'
log_info 'Checking macOS version...'
if ! is-at-least 11.0 ${macos_version}; then
if ! is-at-least 11.0 "${macos_version}"; then
log_error "Minimum required macOS version is 11.0, but running on macOS ${macos_version}"
return 2
else
@ -17,8 +16,5 @@ if (( ! ${+commands[brew]} )) {
return 2
}
brew bundle --file ${SCRIPT_HOME}/.Brewfile
# Workaround to make sure locally built openssl is picked up by cmake
brew uninstall --ignore-dependencies openssl@3 || true
rehash || true
log_group
brew bundle --file "${SCRIPT_HOME}/.Brewfile"
rehash

52
.github/scripts/utils.zsh/check_packages vendored Executable file
View File

@ -0,0 +1,52 @@
if (( ! ${+commands[packagesbuild]} )) {
autoload -Uz log_info log_status mkcd
if (( ! ${+commands[curl]} )) {
log_error 'curl not found. Please install curl.'
return 2
}
if (( ! ${+project_root} )) {
log_error "'project_root' not set. Please set before running ${0}."
return 2
}
local -a curl_opts=()
if (( ! ${+CI} )) {
curl_opts+=(--progress-bar)
} else {
curl_opts+=(--show-error --silent)
}
curl_opts+=(--location -O ${@})
log_info 'Installing Packages.app...'
pushd
mkcd ${project_root:h}/obs-build-dependencies
local packages_url='https://web.archive.org/web/20230727054218/http://s.sudre.free.fr/Software/files/Packages.dmg'
local packages_hash='6afdd25386295974dad8f078b8f1e41cabebd08e72d970bf92f707c7e48b16c9'
if [[ ! -f Packages.dmg ]] {
log_status 'Download Packages.app'
curl ${curl_opts} ${packages_url}
}
local image_checksum
read -r image_checksum _ <<< "$(sha256sum Packages.dmg)"
if [[ ${packages_hash} != ${image_checksum} ]] {
log_error "Checksum mismatch of Packages.app download.
Expected : ${packages_hash}
Actual : ${image_checksum}"
return 2
}
hdiutil attach -noverify Packages.dmg &> /dev/null && log_status 'Packages.dmg image mounted.'
log_info 'Installing Packages.app...'
packages_volume=$(hdiutil info -plist | grep '<string>/Volumes/Packages' | sed 's/.*<string>\(\/Volumes\/[^<]*\)<\/string>/\1/')
sudo installer -pkg "${packages_volume}/packages/Packages.pkg" -target / && rehash
hdiutil detach ${packages_volume} &> /dev/null && log_status 'Packages.dmg image unmounted.'
}

2
.github/scripts/utils.zsh/log_debug vendored Normal file → Executable file
View File

@ -1,3 +1,3 @@
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
if (( _loglevel > 2 )) print -PR -e -- "${CI:+::debug::}%F{220}DEBUG: ${@}%f"
if (( _loglevel > 2 )) print -PR -e -- "%F{220}DEBUG: ${@}%f"

2
.github/scripts/utils.zsh/log_error vendored Normal file → Executable file
View File

@ -1,3 +1,3 @@
local icon=' ✖︎ '
print -u2 -PR "${CI:+::error::}%F{1} ${icon} %f ${@}"
print -u2 -PR "%F{1} ${icon} %f ${@}"

View File

@ -1,16 +0,0 @@
autoload -Uz log_info
if (( ! ${+_log_group} )) typeset -g _log_group=0
if (( ${+CI} )) {
if (( _log_group )) {
print "::endgroup::"
typeset -g _log_group=0
}
if (( # )) {
print "::group::${@}"
typeset -g _log_group=1
}
} else {
if (( # )) log_info ${@}
}

0
.github/scripts/utils.zsh/log_info vendored Normal file → Executable file
View File

0
.github/scripts/utils.zsh/log_output vendored Normal file → Executable file
View File

0
.github/scripts/utils.zsh/log_status vendored Normal file → Executable file
View File

2
.github/scripts/utils.zsh/log_warning vendored Normal file → Executable file
View File

@ -1,5 +1,5 @@
if (( _loglevel > 0 )) {
local icon=' =>'
print -PR "${CI:+::warning::}%F{3} ${(r:5:)icon} ${@}%f"
print -PR "%F{3} ${(r:5:)icon} ${@}%f"
}

0
.github/scripts/utils.zsh/mkcd vendored Normal file → Executable file
View File

4
.github/scripts/utils.zsh/read_codesign vendored Normal file → Executable file
View File

@ -2,8 +2,6 @@ autoload -Uz log_info
if (( ! ${+CODESIGN_IDENT} )) {
typeset -g CODESIGN_IDENT
log_info 'Setting up Apple Developer ID for application codesigning...'
log_info 'Setting up identity for application codesigning...'
read CODESIGN_IDENT'?Apple Developer Application ID: '
}
typeset -g CODESIGN_TEAM=$(print "${CODESIGN_IDENT}" | /usr/bin/sed -En 's/.+\((.+)\)/\1/p')

2
.github/scripts/utils.zsh/read_codesign_installer vendored Normal file → Executable file
View File

@ -2,6 +2,6 @@ autoload -Uz log_info
if (( ! ${+CODESIGN_IDENT_INSTALLER} )) {
typeset -g CODESIGN_IDENT_INSTALLER
log_info 'Setting up Apple Developer Installer ID for installer package codesigning...'
log_info 'Setting up identity for installer package codesigning...'
read CODESIGN_IDENT_INSTALLER'?Apple Developer Installer ID: '
}

13
.github/scripts/utils.zsh/read_codesign_pass vendored Normal file → Executable file
View File

@ -11,12 +11,14 @@
# 'OBS-Codesign-Password'with access Apple's 'altool' only.
##############################################################################
autoload -Uz read_codesign read_codesign_user log_info log_warning
autoload -Uz read_codesign read_codesign_user log_info
if (( ! ${+CODESIGN_IDENT} )) {
read_codesign
}
local codesign_ident_short=$(print "${CODESIGN_IDENT}" | /usr/bin/sed -En 's/.+\((.+)\)/\1/p')
if (( ! ${+CODESIGN_IDENT_USER} )) {
read_codesign_user
}
@ -28,11 +30,4 @@ if (( ! ${+CODESIGN_IDENT_PASS} )) {
print ''
log_info 'Setting up notarization keychain...'
log_warning "
+ Your Apple ID and an app-specific password is necessary for notarization from CLI
+ This password will be stored in your macOS keychain under the identifier
'OBS-Codesign-Password' with access Apple's 'altool' only.
"
xcrun notarytool store-credentials 'OBS-Codesign-Password' --apple-id "${CODESIGN_IDENT_USER}" --team-id "${CODESIGN_TEAM}" --password "${CODESIGN_IDENT_PASS}"
xcrun notarytool store-credentials 'OBS-Codesign-Password' --apple-id "${CODESIGN_IDENT_USER}" --team-id "${codesign_ident_short}" --password "${CODESIGN_IDENT_PASS}"

View File

@ -1,7 +0,0 @@
autoload -Uz log_info
if (( ! ${+CODESIGN_TEAM} )) {
typeset -g CODESIGN_TEAM
log_info 'Setting up Apple Developer Team ID for codesigning...'
read CODESIGN_TEAM'?Apple Developer Team ID (leave empty to use Apple Developer ID instead): '
}

4
.github/scripts/utils.zsh/read_codesign_user vendored Normal file → Executable file
View File

@ -2,6 +2,6 @@ autoload -Uz log_info
if (( ! ${+CODESIGN_IDENT_USER} )) {
typeset -g CODESIGN_IDENT_USER
log_info 'Setting up Apple ID for notarization...'
read CODESIGN_IDENT_USER'?Apple ID: '
log_info 'Setting up developer id for codesigning...'
read CODESIGN_IDENT_USER'?Apple Developer ID: '
}

0
.github/scripts/utils.zsh/set_loglevel vendored Normal file → Executable file
View File

31
.github/scripts/utils.zsh/setup_ccache vendored Normal file → Executable file
View File

@ -1,39 +1,12 @@
autoload -Uz log_debug log_warning
if (( ! ${+project_root} )) {
log_error "'project_root' not set. Please set before running ${0}."
return 2
}
if (( ${+commands[ccache]} )) {
log_debug "Found ccache at ${commands[ccache]}"
typeset -gx CCACHE_CONFIGPATH="${project_root}/.ccache.conf"
ccache --set-config=direct_mode=true
ccache --set-config=inode_cache=true
ccache --set-config=compiler_check=content
ccache --set-config=file_clone=true
local -a sloppiness=(
include_file_mtime
include_file_ctime
file_stat_matches
system_headers
)
if [[ ${host_os} == macos ]] {
sloppiness+=(
modules
clang_index_store
)
ccache --set-config=sloppiness=${(j:,:)sloppiness}
}
if (( ${+CI} )) {
ccache --set-config=cache_dir="${GITHUB_WORKSPACE:-${HOME}}/.ccache"
ccache --set-config=max_size="${CCACHE_SIZE:-1G}"
ccache --set-config=max_size="${CCACHE_SIZE:-500M}"
ccache --set-config=compression=true
ccache -z > /dev/null
}
} else {

70
.github/scripts/utils.zsh/setup_linux vendored Normal file → Executable file
View File

@ -13,54 +13,52 @@ if (( ! ${+target} )) {
pushd ${project_root}
typeset -g QT_VERSION
local -a apt_args=(
${CI:+-y}
--no-install-recommends
)
if (( _loglevel == 0 )) apt_args+=(--quiet)
read -r QT_VERSION <<< \
"$(jq -r --arg target "${target}" \
'.platformConfig[$target] | { qtVersion } | join(" ")' \
${project_root}/buildspec.json)"
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
log_group 'Installing obs-studio build dependencies...'
log_info 'Installing obs build dependencies...'
local suffix
if [[ ${CPUTYPE} != "${target##*-}" ]] {
local -A arch_mappings=(
aarch64 arm64
x86_64 amd64
)
suffix=":${arch_mappings[${target##*-}]}"
sudo apt-get install ${apt_args} gcc-${${target##*-}//_/-}-linux-gnu g++-${${target##*-}//_/-}-linux-gnu
}
sudo add-apt-repository --yes ppa:obsproject/obs-studio
sudo apt update
sudo apt-get install ${apt_args} \
sudo apt-get install -y \
build-essential \
libcurl4-openssl-dev \
libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev \
libswresample-dev libswscale-dev \
libjansson-dev \
libx11-xcb-dev \
libgles2-mesa-dev \
libsimde-dev \
obs-studio
libwayland-dev \
libpulse-dev
log_info 'Installing obs plugin dependencies...'
local -a _qt_packages=()
if (( QT_VERSION == 5 )) {
_qt_packages+=(
qtbase5-dev${suffix}
libqt5svg5-dev${suffix}
qtbase5-private-dev${suffix}
libqt5x11extras5-dev${suffix}
qtbase5-dev
libqt5svg5-dev
qtbase5-private-dev
libqt5x11extras5-dev
)
} elif (( QT_VERSION == 6 )) {
_qt_packages+=(
qt6-base-dev
libqt6svg6-dev
qt6-base-private-dev
)
} else {
_qt_packages+=(
qt6-base-dev${suffix}
libqt6svg6-dev${suffix}
qt6-base-private-dev${suffix}
)
log_error "Unsupported Qt version '${QT_VERSION}' specified."
return 2
}
sudo apt-get install ${apt_args} ${_qt_packages}
log_group
sudo apt-get install -y ${_qt_packages}
}
local deps_version
read -r deps_version <<< \
"$(jq -r '.dependencies.prebuilt.version' ${buildspec_file})"
typeset -g OBS_DEPS_VERSION=${deps_version}

127
.github/scripts/utils.zsh/setup_macos vendored Executable file
View File

@ -0,0 +1,127 @@
autoload -Uz log_error log_status log_info mkcd
if (( ! ${+commands[curl]} )) {
log_error 'curl not found. Please install curl.'
return 2
}
if (( ! ${+commands[jq]} )) {
log_error 'jq not found. Please install jq.'
return 2
}
if (( ! ${+project_root} )) {
log_error "'project_root' not set. Please set before running ${0}."
return 2
}
if (( ! ${+target} )) {
log_error "'target' not set. Please set before running ${0}."
return 2
}
local -a curl_opts=()
if (( ! ${+CI} )) {
curl_opts+=(--progress-bar)
} else {
curl_opts+=(--show-error --silent)
}
curl_opts+=(--location -O ${@})
pushd ${project_root}
local _qt_version
local _deployment_target
read -r _qt_version _deployment_target <<< \
"$(jq -r --arg target "${target}" \
'.platformConfig[$target] | { qtVersion, deploymentTarget } | join (" ")' \
${buildspec_file})"
typeset -g QT_VERSION=${_qt_version}
typeset -g DEPLOYMENT_TARGET=${_deployment_target}
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
mkdir -p ${project_root:h}/obs-build-dependencies
local dependency
local deps_version
local deps_baseurl
local deps_label
local deps_hash
local _filename
local _url
local _target
local artifact_checksum
for dependency ('prebuilt' "qt${QT_VERSION}") {
IFS=';' read -r deps_version deps_baseurl deps_label deps_hash <<< \
"$(jq -r --arg dependency "${dependency}" --arg target "${target}" \
'.dependencies[$dependency] | {version, baseUrl, "label", "hash": .hashes[$target]} | join(";")' \
${buildspec_file})"
if [[ -z "${deps_version}" ]] {
log_error "No ${dependency} spec found in ${buildspec_file}."
return 2
}
log_info "Setting up ${deps_label}..."
pushd ${project_root:h}/obs-build-dependencies
case ${dependency} {
prebuilt)
_filename="macos-deps-${deps_version}-${target##*-}.tar.xz"
_url="${deps_baseurl}/${deps_version}/${_filename}"
_target="plugin-deps-${deps_version}-qt${QT_VERSION}-${target##*-}"
typeset -g OBS_DEPS_VERSION=${deps_version}
;;
qt*)
if (( ${+CI} )) {
_filename="macos-deps-qt${QT_VERSION}-${deps_version}-universal.tar.xz"
deps_hash="$(jq -r --arg dependency "${dependency}" \
'.dependencies[$dependency].hashes["macos-universal"]' \
${buildspec_file})"
} else {
_filename="macos-deps-qt${QT_VERSION}-${deps_version}-${target##*-}.tar.xz"
}
_url="${deps_baseurl}/${deps_version}/${_filename}"
_target="plugin-deps-${deps_version}-qt${QT_VERSION}-${target##*-}"
;;
}
if [[ ! -f ${_filename} ]] {
log_debug "Running curl ${curl_opts} ${_url}"
curl ${curl_opts} ${_url} && \
log_status "Downloaded ${deps_label} for ${target}."
} else {
log_status "Found downloaded ${deps_label}"
}
read -r artifact_checksum _ <<< "$(sha256sum ${_filename})"
if [[ ${deps_hash} != ${artifact_checksum} ]] {
log_error "Checksum of downloaded ${deps_label} does not match specification.
Expected : ${deps_hash}
Actual : ${artifact_checksum}"
return 2
}
log_status "Checksum of downloaded ${deps_label} matches."
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)unpack]}) )) {
mkdir -p ${_target} && pushd ${_target}
XZ_OPT=-T0 tar -xzf ../${_filename} && log_status "${deps_label} extracted."
popd
}
}
popd
pushd ${project_root:h}/obs-build-dependencies
xattr -r -d com.apple.quarantine *
log_status 'Removed quarantine flag from downloaded dependencies...'
popd
} else {
local deps_version
read -r deps_version <<< \
"$(jq -r '.dependencies.prebuilt.version' ${buildspec_file})"
typeset -g OBS_DEPS_VERSION=${deps_version}
}

122
.github/scripts/utils.zsh/setup_obs vendored Executable file
View File

@ -0,0 +1,122 @@
autoload -Uz log_error log_info log_status
if (( ! ${+buildspec_file} )) {
log_error "'buildspec_file' not set. Please set before running ${0}."
return 2
}
if (( ! ${+commands[git]} )) {
log_error 'git not found. Please install git.'
return 2
}
if (( ! ${+commands[jq]} )) {
log_error 'jq not found. Please install jq.'
return 2
}
if (( ! ${+project_root} )) {
log_error "'project_root' not set. Please set before running ${0}."
return 2
}
if (( ! ${+target} )) {
log_error "'target' not set. Please set before running ${0}."
return 2
}
log_info 'Setting up OBS-Studio...'
local obs_version
local obs_repo
local obs_branch
local obs_hash
read -r obs_version obs_repo obs_branch obs_hash <<< \
"$(jq -r --arg key "obs-studio" \
'.dependencies[$key] | {version, repository, branch, hash} | join(" ")' \
${buildspec_file})"
if [[ -z ${obs_version} ]] {
log_error "No obs-studio version found in buildspec.json"
return 2
}
pushd
mkcd ${project_root:h}/obs-studio
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)unpack]}) )) {
if [[ -d .git ]] {
git config advice.detachedHead false
git config remote.pluginbuild.url "${obs_repo:-https://github.com/obsproject/obs-studio.git}"
git config remote.pluginbuild.fetch "+refs/heads/${obs_branch:-master}:refs/remotes/origin/${obs_branch:-master}"
git rev-parse -q --verify "${obs_hash}^{commit}" > /dev/null || git fetch pluginbuild
git checkout ${obs_branch:-master} -B ${product_name}
git reset --hard "${obs_hash}"
log_status 'Found existing obs-studio repository.'
} else {
git clone "${obs_repo:-https://github.com/obsproject/obs-studio.git}" "${PWD}"
git config advice.detachedHead false
git checkout -f "${obs_hash}" --
git checkout ${obs_branch:-master} -b ${product_name}
log_status 'obs-studio checked out.'
}
git submodule foreach --recursive git submodule sync
git submodule update --init --recursive
}
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)build]}) )) {
log_info 'Configuring obs-studio...'
local -a cmake_args=(
-DCMAKE_BUILD_TYPE=${BUILD_CONFIG:-Release}
-DQT_VERSION=${QT_VERSION}
-DENABLE_PLUGINS=OFF
-DENABLE_UI=OFF
-DENABLE_SCRIPTING=OFF
-DCMAKE_INSTALL_PREFIX="${project_root:h}/obs-build-dependencies/plugin-deps-${OBS_DEPS_VERSION}-qt${QT_VERSION}-${target##*-}"
-DCMAKE_PREFIX_PATH="${project_root:h}/obs-build-dependencies/plugin-deps-${OBS_DEPS_VERSION}-qt${QT_VERSION}-${target##*-}"
)
if (( _loglevel == 0 )) cmake_args+=(-Wno_deprecated -Wno-dev --log-level=ERROR)
if (( _loglevel > 2 )) cmake_args+=(--debug-output)
local num_procs
case ${target} {
macos-*)
autoload -Uz read_codesign
if (( ${+CODESIGN} )) {
read_codesign
}
cmake_args+=(
-DCMAKE_OSX_ARCHITECTURES=${${target##*-}//universal/x86_64;arm64}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPLOYMENT_TARGET:-10.15}
-DOBS_CODESIGN_LINKER=ON
-DOBS_BUNDLE_CODESIGN_IDENTITY="${CODESIGN_IDENT:--}"
)
num_procs=$(( $(sysctl -n hw.ncpu) + 1 ))
;;
linux-*)
cmake_args+=(
-DENABLE_PIPEWIRE=OFF
)
num_procs=$(( $(nproc) + 1 ))
;;
}
log_debug "Attempting to configure OBS with CMake arguments: ${cmake_args}"
cmake -S . -B plugin_build_${target##*-} -G ${generator} ${cmake_args}
log_info 'Building libobs and obs-frontend-api...'
local -a cmake_args=()
if (( _loglevel > 1 )) cmake_args+=(--verbose)
if [[ ${generator} == 'Unix Makefiles' ]] cmake_args+=(--parallel ${num_procs})
cmake --build plugin_build_${target##*-} --config ${BUILD_CONFIG:-Release} ${cmake_args} -t obs-frontend-api
cmake --install plugin_build_${target##*-} --config ${BUILD_CONFIG:-Release} --component obs_libraries ${cmake_args}
}
popd

View File

@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: check_libobs_revision
@ -37,20 +37,20 @@ jobs:
tar --exclude=.git -cvzf obs-scene-switcher_0.1+testonly.orig.tar.gz SceneSwitcher
- name: create_debian_dir
run: |
cp -a build-aux/CI/linux/debian .
cp -a CI/linux/debian .
- name: install_dependencies
run: |
# devscripts and libobs-dev are needed but they were already installed
# from check_libobs_revision and install_frontend_header sections.
sudo apt update
sudo apt install build-essential cmake debhelper libcurl4-openssl-dev libxss-dev libxtst-dev qt6-base-dev libopencv-dev libproc2-dev
sudo apt install cmake debhelper libcurl4-openssl-dev libxss-dev libxtst-dev qtbase5-dev libopencv-dev libprocps-dev
- name: build
run: |
debuild --no-lintian --no-sign
mv ../*.deb .
- name: Publish
if: success()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v2.2.1
with:
name: "obs-scene-switcher.deb"
path: ${{ github.workspace }}/*.deb

View File

@ -1,317 +0,0 @@
name: Build Project
on:
workflow_call:
outputs:
pluginName:
description: "Project name detected by parsing build spec file"
value: ${{ jobs.check-event.outputs.pluginName }}
env:
DEP_DIR: .deps/advss-build-dependencies-3
jobs:
check-event:
name: Check GitHub Event Data 🔎
runs-on: ubuntu-latest
defaults:
run:
shell: bash
outputs:
package: ${{ steps.setup.outputs.package }}
codesign: ${{ steps.setup.outputs.codesign }}
notarize: ${{ steps.setup.outputs.notarize }}
config: ${{ steps.setup.outputs.config }}
commitHash: ${{ steps.setup.outputs.commitHash }}
pluginName: ${{ steps.setup.outputs.pluginName }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check Event Data ☑️
id: setup
env:
GH_TOKEN: ${{ github.token }}
run: |
: Check Event Data ☑️
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
case "${GITHUB_EVENT_NAME}" in
pull_request)
config_data=('codesign:false' 'notarize:false' 'package:true' 'config:RelWithDebInfo')
if gh pr view ${{ github.event.number }} --json labels \
| jq -e -r '.labels[] | select(.name == "Seeking Testers")' > /dev/null; then
config_data[0]='codesign:true'
config_data[2]='package:true'
fi
;;
push)
config_data=('codesign:true' 'notarize:false' 'package:true' 'config:RelWithDebInfo')
if [[ ${GITHUB_REF_NAME} =~ [0-9]+.[0-9]+.[0-9]+(-(rc|beta).+)? ]]; then
config_data[1]='notarize:false'
config_data[3]='config:RelWithDebInfo'
fi
;;
workflow_dispatch)
config_data=('codesign:true' 'notarize:false' 'package:true' 'config:RelWithDebInfo')
;;
schedule)
config_data=('codesign:true' 'notarize:false' 'package:true' 'config:RelWithDebInfo')
;;
*) ;;
esac
for config in "${config_data[@]}"; do
IFS=':' read -r key value <<< "${config}"
echo "${key}=${value}" >> $GITHUB_OUTPUT
done
echo "commitHash=${GITHUB_SHA:0:9}" >> $GITHUB_OUTPUT
plugin_name="$(grep 'name' buildspec.json | sed -E -e 's/^.+"name":[^"]+"(.+)",?$/\1/g')"
plugin_display_name="$(grep 'displayName' buildspec.json | sed -E -e 's/^.+"displayName":[^"]+"(.+)",?$/\1/g' || echo "")"
if [[ "${plugin_display_name}" ]]; then
echo "pluginName=${plugin_display_name}" >> $GITHUB_OUTPUT
else
echo "pluginName=${plugin_name}" >> $GITHUB_OUTPUT
fi
macos-build:
name: Build for macOS 🍏
runs-on: macos-15
needs: check-event
defaults:
run:
shell: zsh --no-rcs --errexit --pipefail {0}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set Up Environment 🔧
id: setup
run: |
: Set Up Environment 🔧
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
print '::group::Clean Homebrew Environment'
local -a to_remove=()
if (( #to_remove )) brew uninstall --ignore-dependencies ${to_remove}
print '::endgroup::'
local product_name
local product_version
read -r product_name product_version <<< \
"$(jq -r '. | {name, version} | join(" ")' buildspec.json)"
local git_tag="$(git describe --tags)"
print "pluginName=${product_name}" >> $GITHUB_OUTPUT
print "pluginVersion=${git_tag}" >> $GITHUB_OUTPUT
print '::group::Enable Xcode 16.1'
sudo xcode-select --switch /Applications/Xcode_16.1.0.app/Contents/Developer
print '::endgroup::'
- uses: actions/cache@v4
id: ccache-cache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-ccache-${{ needs.check-event.outputs.config }}
restore-keys: |
${{ runner.os }}-ccache-
- name: Build Dependencies 🏗️
uses: ./.github/actions/build-dependencies
with:
workingDirectory: ${{ github.workspace }}/plugin
target: macos-universal
config: ${{ needs.check-event.outputs.config }}
- name: Set Up Codesigning 🔑
uses: ./.github/actions/setup-macos-codesigning
if: fromJSON(needs.check-event.outputs.codesign)
id: codesign
with:
codesignIdentity: ${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}
installerIdentity: ${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}
codesignCertificate: ${{ secrets.MACOS_SIGNING_CERT }}
certificatePassword: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }}
keychainPassword: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }}
provisioningProfile: ${{ secrets.MACOS_SIGNING_PROVISIONING_PROFILE }}
notarizationUser: ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
notarizationPassword: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
- name: Build Plugin 🧱
uses: ./.github/actions/build-plugin
with:
target: macos-universal
config: ${{ needs.check-event.outputs.config }}
codesign: ${{ fromJSON(needs.check-event.outputs.codesign) }}
codesignIdent: ${{ steps.codesign.outputs.codesignIdent }}
- name: Package Plugin 📀
uses: ./.github/actions/package-plugin
with:
target: macos-universal
config: ${{ needs.check-event.outputs.config }}
package: ${{ fromJSON(needs.check-event.outputs.package) }}
codesign: ${{ fromJSON(needs.check-event.outputs.codesign) && fromJSON(steps.codesign.outputs.haveCodesignIdent) }}
codesignIdent: ${{ steps.codesign.outputs.codesignIdent }}
installerIdent: ${{ steps.codesign.outputs.installerIdent }}
codesignTeam: ${{ steps.codesign.outputs.codesignTeam }}
notarize: ${{ fromJSON(needs.check-event.outputs.notarize) && fromJSON(steps.codesign.outputs.haveNotarizationUser) }}
codesignUser: ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
codesignPass: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
- name: Upload Artifacts 📡
uses: actions/upload-artifact@v4
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-macos-universal-${{ needs.check-event.outputs.commitHash }}
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-macos-universal.*
- name: Upload Debug Symbol Artifacts 🪲
uses: actions/upload-artifact@v4
if: ${{ needs.check-event.outputs.config == 'Release' }}
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-macos-universal-${{ needs.check-event.outputs.commitHash }}-dSYMs
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-macos-universal-dSYMs.*
ubuntu-build:
name: Build for Ubuntu 🐧
runs-on: ubuntu-latest
needs: check-event
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set Up Environment 🔧
id: setup
run: |
: Set Up Environment 🔧
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
git_tag="$(git describe --tags)"
read -r product_name product_version <<< \
"$(jq -r '. | {name, version} | join(" ")' buildspec.json)"
echo "pluginName=${product_name}" >> $GITHUB_OUTPUT
echo "pluginVersion=${git_tag}" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: ccache-cache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-ccache-x86_64-${{ needs.check-event.outputs.config }}
restore-keys: |
${{ runner.os }}-ccache-x86_64-
- name: Set up CMake 🏗️
uses: jwlawson/actions-setup-cmake@v1.13
with:
cmake-version: '3.x.x'
- name: Set up Homebrew 🍺
uses: Homebrew/actions/setup-homebrew@master
- name: Build Plugin 🧱
uses: ./.github/actions/build-plugin
with:
target: x86_64
config: ${{ needs.check-event.outputs.config }}
- name: Run tests
uses: ./.github/actions/run-tests
with:
target: x86_64
config: ${{ needs.check-event.outputs.config }}
- name: Package Plugin 📀
uses: ./.github/actions/package-plugin
with:
package: ${{ fromJSON(needs.check-event.outputs.package) }}
target: x86_64
config: ${{ needs.check-event.outputs.config }}
- name: Upload Source Tarball 🗜️
uses: actions/upload-artifact@v4
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-sources-${{ needs.check-event.outputs.commitHash }}
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-source.*
- name: Upload Artifacts 📡
uses: actions/upload-artifact@v4
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-ubuntu-24.04-x86_64-${{ needs.check-event.outputs.commitHash }}
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-x86_64*.*
- name: Upload debug symbol artifacts 🪲
uses: actions/upload-artifact@v4
if: ${{ fromJSON(needs.check-event.outputs.package) }}
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-ubuntu-24.04-x86_64-${{ needs.check-event.outputs.commitHash }}-dbgsym
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-x86_64*-dbgsym.ddeb
windows-build:
name: Build for Windows 🪟
runs-on: windows-2022
needs: check-event
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set Up Environment 🔧
id: setup
run: |
# Set Up Environment 🔧
if ( $Env:RUNNER_DEBUG -ne $null ) {
Set-PSDebug -Trace 1
}
$BuildSpec = Get-Content -Path buildspec.json -Raw | ConvertFrom-Json
$ProductName = $BuildSpec.name
$GitOutput = git describe --tags
"pluginName=${ProductName}" >> $env:GITHUB_OUTPUT
"pluginVersion=${GitOutput}" >> $env:GITHUB_OUTPUT
- name: Build Dependencies 🏗️
uses: ./.github/actions/build-dependencies
with:
workingDirectory: ${{ github.workspace }}/plugin
target: x64
config: ${{ needs.check-event.outputs.config }}
- name: Build Plugin 🧱
uses: ./.github/actions/build-plugin
with:
target: x64
config: ${{ needs.check-event.outputs.config }}
- name: Run tests
uses: ./.github/actions/run-tests
with:
target: x64
config: ${{ needs.check-event.outputs.config }}
- name: Package Plugin 📀
uses: ./.github/actions/package-plugin
with:
target: x64
config: ${{ needs.check-event.outputs.config }}
package: ${{ fromJSON(needs.check-event.outputs.package) }}
- name: Upload Artifacts 📡
uses: actions/upload-artifact@v4
with:
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64-${{ needs.check-event.outputs.commitHash }}
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-windows-x64*.*

View File

@ -1,27 +0,0 @@
name: Check Code Formatting 🛠️
on:
workflow_call:
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: clang-format check 🐉
id: clang-format
uses: ./.github/actions/run-clang-format
with:
failCondition: error
cmake-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: cmake-format check 🎛️
id: cmake-format
uses: ./.github/actions/run-cmake-format
with:
failCondition: error

View File

@ -1,18 +0,0 @@
name: Dispatch
run-name: Dispatched Repository Actions - ${{ inputs.job }} ⌛️
on:
workflow_dispatch:
inputs:
job:
description: Dispatch job to run
required: true
type: choice
options:
- build
permissions:
contents: write
jobs:
check-and-build:
if: inputs.job == 'build'
uses: ./.github/workflows/build-project.yaml
secrets: inherit

View File

@ -19,8 +19,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Check locale files
run: |
python3 ./build-aux/CI/check-locale.py -p data/locale/
python3 ./CI/checkLocale.py -p data/locale/

460
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,460 @@
name: Plugin Build
on:
push:
paths-ignore:
- '**.md'
branches:
- master
tags:
- '*'
pull_request:
paths-ignore:
- '**.md'
branches:
- master
env:
PLUGIN_NAME: SceneSwitcher
LIB_NAME: advanced-scene-switcher
DEP_DIR: advss-build-dependencies-1
jobs:
clang_check:
name: 01 - Code Format Check
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install clang-format
run: sudo apt-get install -y clang-format-13
- name: Run clang-format
run: ./.github/scripts/check-format.sh && ./.github/scripts/check-changes.sh
- name: Install cmake-format
run: sudo pip install cmakelang
- name: Run cmake-format
run: ./.github/scripts/check-cmake.sh
macos_build:
name: 02 - macOS
runs-on: macos-12
strategy:
fail-fast: true
matrix:
arch: [x86_64, arm64, universal]
if: always()
needs: [clang_check]
outputs:
commitHash: ${{ steps.setup.outputs.commitHash }}
env:
CODESIGN_IDENT: '-'
CODESIGN_IDENT_INSTALLER: ''
MACOSX_DEPLOYMENT_TARGET: '10.15'
defaults:
run:
shell: zsh {0}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: plugin
submodules: recursive
- name: Checkout obs-studio
uses: actions/checkout@v3
with:
repository: 'obsproject/obs-studio'
path: obs-studio
fetch-depth: 0
submodules: recursive
- name: Setup Environment
id: setup
working-directory: ${{ github.workspace }}/plugin
run: |
## SETUP ENVIRONMENT SCRIPT
print '::group::Clean Homebrew Environment'
typeset -a to_remove=()
for formula (speexdsp curl php) {
if [[ -d ${HOMEBREW_PREFIX}/opt/${formula} ]] to_remove+=(${formula})
}
if (( #to_remove > 0 )) brew uninstall --ignore-dependencies ${to_remove}
print '::endgroup::'
print '::group::Set up code signing'
if [[ '${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}' != '' && \
'${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}' != '' && \
'${{ secrets.MACOS_SIGNING_CERT }}' != '' ]] {
print 'haveCodesignIdent=true' >> $GITHUB_OUTPUT
} else {
print 'haveCodesignIdent=false' >> $GITHUB_OUTPUT
}
if [[ '${{ secrets.MACOS_NOTARIZATION_USERNAME }}' != '' && \
'${{ secrets.MACOS_NOTARIZATION_PASSWORD }}' != '' ]] {
print 'haveNotarizationUser=true' >> $GITHUB_OUTPUT
} else {
print 'haveNotarizationUser=false' >> $GITHUB_OUTPUT
}
print '::endgroup::'
print "ccacheDate=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT
print "commitHash=${"$(git rev-parse HEAD)"[0,9]}" >> $GITHUB_OUTPUT
echo "$PWD/.github/scripts" >> $GITHUB_PATH
- name: Restore Compilation Cache
id: ccache-cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.ccache
key: macos-${{ matrix.arch }}-ccache-plugin-${{ steps.setup.outputs.ccacheDate }}
restore-keys: |
macos-${{ matrix.arch }}-ccache-plugin-
- name: Check for GitHub Labels
id: seekingTesters
if: ${{ github.event_name == 'pull_request' }}
run: |
if [[ -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')" ]] {
print 'found=true' >> $GITHUB_OUTPUT
} else {
print 'found=false' >> $GITHUB_OUTPUT
}
- name: Install Apple Developer Certificate
if: ${{ steps.setup.outputs.haveCodesignIdent == 'true' }}
uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
with:
keychain-password: ${{ github.run_id }}
p12-file-base64: ${{ secrets.MACOS_SIGNING_CERT }}
p12-password: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }}
- name: Set Signing Identity
if: ${{ steps.setup.outputs.haveCodesignIdent == 'true' }}
run: |
print "CODESIGN_IDENT=${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}" >> $GITHUB_ENV
print "CODESIGN_IDENT_INSTALLER=${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}" >> $GITHUB_ENV
- name: Build Dependencies
uses: ./plugin/.github/actions/build-dependencies
with:
workingDirectory: ${{ github.workspace }}/plugin
target: ${{ matrix.arch }}
config: RelWithDebInfo
- name: Build Plugin
uses: ./plugin/.github/actions/build-plugin
with:
workingDirectory: ${{ github.workspace }}/plugin
target: ${{ matrix.arch }}
config: RelWithDebInfo
codesign: 'true'
codesignIdent: ${{ env.CODESIGN_IDENT }}
- name: Run tests
uses: ./plugin/.github/actions/run-tests
with:
workingDirectory: ${{ github.workspace }}/plugin
target: ${{ matrix.arch }}
- name: Package Plugin
uses: ./plugin/.github/actions/package-plugin
with:
workingDirectory: ${{ github.workspace }}/plugin
target: ${{ matrix.arch }}
config: RelWithDebInfo
codesign: ${{ steps.setup.outputs.haveCodesignIdent == 'true' }}
notarize: ${{ startsWith(github.ref, 'refs/tags/') && steps.setup.outputs.haveNotarizationUser == 'true' }}
codesignIdent: ${{ env.CODESIGN_IDENT }}
installerIdent: ${{ env.CODESIGN_IDENT_INSTALLER }}
codesignUser: ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
codesignPass: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
- name: Upload Installer Artifact
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.PLUGIN_NAME }}-macos-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}-installer
path: ${{ github.workspace }}/plugin/release/${{ env.LIB_NAME }}*-macos-${{ matrix.arch }}.pkg
- name: Upload Build Artifact
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.PLUGIN_NAME }}-macos-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}
path: ${{ github.workspace }}/plugin/release/${{ env.LIB_NAME }}-*.zip
linux_build:
name: 02 - Linux
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
arch: [x86_64]
portable: [true, false]
if: always()
needs: [clang_check]
outputs:
commitHash: ${{ steps.setup.outputs.commitHash }}
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: plugin
submodules: recursive
- name: Checkout obs-studio
uses: actions/checkout@v3
with:
repository: 'obsproject/obs-studio'
path: obs-studio
fetch-depth: 0
submodules: recursive
- name: Setup Environment
working-directory: ${{ github.workspace }}/plugin
id: setup
run: |
## SETUP ENVIRONMENT SCRIPT
echo "ccacheDate=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT
echo "commitHash=$(git rev-parse HEAD | cut -c1-9)" >> $GITHUB_OUTPUT
echo "$PWD/.github/scripts" >> $GITHUB_PATH
- name: Restore Compilation Cache
id: ccache-cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.ccache
key: linux-${{ matrix.arch }}-ccache-plugin-${{ steps.setup.outputs.ccacheDate }}
restore-keys: |
linux-${{ matrix.arch }}-ccache-plugin-
- name: Check for GitHub Labels
id: seekingTesters
if: ${{ github.event_name == 'pull_request' }}
run: |
## GITHUB LABEL SCRIPT
if [[ -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')" ]]; then
echo 'found=true' >> $GITHUB_OUTPUT
else
echo 'found=false' >> $GITHUB_OUTPUT
fi
- name: Build Dependencies
uses: ./plugin/.github/actions/build-dependencies
with:
workingDirectory: ${{ github.workspace }}/plugin
target: ${{ matrix.arch }}
config: RelWithDebInfo
- name: Build Plugin
uses: ./plugin/.github/actions/build-plugin
with:
workingDirectory: ${{ github.workspace }}/plugin
target: ${{ matrix.arch }}
config: RelWithDebInfo
portable: ${{ matrix.portable }}
- name: Run tests
uses: ./plugin/.github/actions/run-tests
with:
workingDirectory: ${{ github.workspace }}/plugin
target: ${{ matrix.arch }}
- name: Package Plugin
uses: ./plugin/.github/actions/package-plugin
with:
workingDirectory: ${{ github.workspace }}/plugin
target: ${{ matrix.arch }}
config: RelWithDebInfo
portable: ${{ matrix.portable }}
- name: Upload Package Artifact
if: ${{ matrix.portable }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.PLUGIN_NAME }}-linux-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}-portable
path: ${{ github.workspace }}/plugin/release/${{ env.LIB_NAME }}*-linux-${{ matrix.arch }}.*
- name: Upload Build Artifact
if: ${{ ! matrix.portable }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.PLUGIN_NAME }}-linux-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}
path: ${{ github.workspace }}/plugin/release/${{ env.LIB_NAME }}*-linux-${{ matrix.arch }}.*
windows_build:
name: 02 - Windows
runs-on: windows-2022
strategy:
fail-fast: true
matrix:
arch: [x64]
if: always()
needs: [clang_check]
outputs:
commitHash: ${{ steps.setup.outputs.commitHash }}
defaults:
run:
shell: pwsh
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: plugin
submodules: recursive
- name: Checkout obs-studio
uses: actions/checkout@v3
with:
repository: 'obsproject/obs-studio'
path: obs-studio
fetch-depth: 0
submodules: recursive
- name: Setup Environment
working-directory: ${{ github.workspace }}/plugin
id: setup
run: |
## SETUP ENVIRONMENT SCRIPT
$CcacheDate = (Get-Date -Format "yyyy-M-d")
"ccacheDate=${CcacheDate}" >> $env:GITHUB_OUTPUT
$CommitHash = (git rev-parse HEAD)[0..8] -join ''
"commitHash=${CommitHash}" >> $env:GITHUB_OUTPUT
- name: Restore Compilation Cache
id: ccache-cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.ccache
key: windows-${{ matrix.arch }}-ccache-plugin-${{ steps.setup.outputs.ccacheDate }}
restore-keys: |
windows-${{ matrix.arch }}-ccache-plugin-
- name: Check for GitHub Labels
id: seekingTesters
working-directory: ${{ github.workspace }}/plugin
if: ${{ github.event_name == 'pull_request' }}
run: |
## GITHUB LABEL SCRIPT
$LabelFound = try {
$Params = @{
Authentication = 'Bearer'
Token = (ConvertTo-SecureString '${{ secrets.GITHUB_TOKEN }}' -AsPlainText)
Uri = '${{ github.event.pull_request.url }}'
UseBasicParsing = $true
}
(Invoke-RestMethod @Params).labels.name.contains('Seeking Testers')
} catch {
$false
}
"found=$(([string]${LabelFound}).ToLower())" >> $env:GITHUB_OUTPUT
- name: Build Dependencies
uses: ./plugin/.github/actions/build-dependencies
with:
workingDirectory: ${{ github.workspace }}/plugin
target: ${{ matrix.arch }}
config: RelWithDebInfo
visualStudio: 'Visual Studio 17 2022'
- name: Build Plugin
uses: ./plugin/.github/actions/build-plugin
with:
workingDirectory: ${{ github.workspace }}/plugin
target: ${{ matrix.arch }}
config: RelWithDebInfo
visualStudio: 'Visual Studio 17 2022'
- name: Run tests
uses: ./plugin/.github/actions/run-tests
with:
workingDirectory: ${{ github.workspace }}/plugin
target: ${{ matrix.arch }}
- name: Package Plugin
uses: ./plugin/.github/actions/package-plugin
with:
workingDirectory: ${{ github.workspace }}/plugin
target: ${{ matrix.arch }}
config: RelWithDebInfo
- name: Upload Build Artifact
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.PLUGIN_NAME }}-windows-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}
path: ${{ github.workspace }}/plugin/release/${{ env.LIB_NAME }}-*.zip
- name: Package Plugin Installer
uses: ./plugin/.github/actions/package-plugin
with:
workingDirectory: ${{ github.workspace }}/plugin
target: ${{ matrix.arch }}
config: RelWithDebInfo
createInstaller: true
- name: Upload Installer Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.PLUGIN_NAME }}-windows-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}-installer
path: ${{ github.workspace }}/plugin/release/${{ env.LIB_NAME }}-*.exe
make-release:
name: 03 - Create and upload release
runs-on: ubuntu-22.04
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs: [macos_build, linux_build, windows_build]
defaults:
run:
shell: bash
steps:
- name: Get Metadata
id: metadata
run: |
## METADATA SCRIPT
echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Download build artifacts
uses: actions/download-artifact@v3
- name: Generate Checksums
run: |
## CHECKSUM GENERATION SCRIPT
shopt -s extglob
echo "### Checksums" > ${{ github.workspace }}/CHECKSUMS.txt
for file in ${{ github.workspace }}/**/@(*.pkg|*.exe|*.deb|*.zip); do
echo " ${file##*/}: $(sha256sum "${file}" | cut -d " " -f 1)" >> ${{ github.workspace }}/CHECKSUMS.txt
done
cat ${{ github.workspace }}/CHECKSUMS.txt
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
draft: true
prerelease: true
tag_name: ${{ steps.metadata.outputs.version }}
name: "${{ env.PLUGIN_NAME }} ${{ steps.metadata.outputs.version }}"
body_path: ${{ github.workspace }}/CHECKSUMS.txt
files: |
${{ github.workspace }}/**/*.zip
${{ github.workspace }}/**/*.exe
${{ github.workspace }}/**/*.deb
${{ github.workspace }}/**/*.pkg

View File

@ -1,27 +0,0 @@
name: Pull Request
run-name: ${{ github.event.pull_request.title }} pull request run 🚀
on:
workflow_dispatch:
pull_request:
paths-ignore:
- '**.md'
branches: [master, main]
types: [ opened, synchronize, reopened ]
permissions:
contents: read
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
check-format:
name: Check Formatting 🔍
uses: ./.github/workflows/check-format.yaml
permissions:
contents: read
build-project:
name: Build Project 🧱
uses: ./.github/workflows/build-project.yaml
secrets: inherit
permissions:
contents: read

View File

@ -1,122 +0,0 @@
name: Push to master
run-name: ${{ github.ref_name }} push run 🚀
on:
push:
branches:
- master
- main
- 'release/**'
tags:
- '*'
permissions:
contents: write
concurrency:
group: '${{ github.workflow }} @ ${{ github.ref }}'
cancel-in-progress: ${{ github.ref_type == 'tag' }}
jobs:
check-format:
name: Check Formatting 🔍
if: github.ref_name == 'master'
uses: ./.github/workflows/check-format.yaml
permissions:
contents: read
build-project:
name: Build Project 🧱
uses: ./.github/workflows/build-project.yaml
secrets: inherit
permissions:
contents: read
create-release:
name: Create Release 🛫
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
needs: build-project
defaults:
run:
shell: bash
steps:
- name: Check Release Tag ☑️
id: check
run: |
: Check Release Tag ☑️
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
shopt -s extglob
case "${GITHUB_REF_NAME}" in
+([0-9]).+([0-9]).+([0-9]) )
echo 'validTag=true' >> $GITHUB_OUTPUT
echo 'prerelease=false' >> $GITHUB_OUTPUT
echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
;;
+([0-9]).+([0-9]).+([0-9])-@(beta|rc)*([0-9]) )
echo 'validTag=true' >> $GITHUB_OUTPUT
echo 'prerelease=true' >> $GITHUB_OUTPUT
echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
;;
*) echo 'validTag=false' >> $GITHUB_OUTPUT ;;
esac
- name: Download Build Artifacts 📥
uses: actions/download-artifact@v4
if: fromJSON(steps.check.outputs.validTag)
id: download
- name: Rename Files 🏷️
if: fromJSON(steps.check.outputs.validTag)
run: |
: Rename Files 🏷️
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
shopt -s extglob
shopt -s nullglob
root_dir="$(pwd)"
commit_hash="${GITHUB_SHA:0:9}"
variants=(
'windows-x64;zip|exe'
'macos-universal;tar.xz|pkg'
'ubuntu-24.04-x86_64;tar.xz|deb|ddeb'
'sources;tar.xz'
)
for variant_data in "${variants[@]}"; do
IFS=';' read -r variant suffix <<< "${variant_data}"
candidates=(*-${variant}-${commit_hash}/@(*|*-dbgsym).@(${suffix}))
for candidate in "${candidates[@]}"; do
mv "${candidate}" "${root_dir}"
done
done
- name: Generate Checksums 🪪
if: fromJSON(steps.check.outputs.validTag)
run: |
: Generate Checksums 🪪
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
shopt -s extglob
echo "### Checksums" > ${{ github.workspace }}/CHECKSUMS.txt
for file in ${{ github.workspace }}/@(*.exe|*.deb|*.ddeb|*.pkg|*.tar.xz|*.zip); do
echo " ${file##*/}: $(sha256sum "${file}" | cut -d " " -f 1)" >> ${{ github.workspace }}/CHECKSUMS.txt
done
- name: Create Release 🛫
if: fromJSON(steps.check.outputs.validTag)
id: create_release
uses: softprops/action-gh-release@d4e8205d7e959a9107da6396278b2f1f07af0f9b
with:
draft: true
prerelease: ${{ fromJSON(steps.check.outputs.prerelease) }}
tag_name: ${{ steps.check.outputs.version }}
name: ${{ needs.build-project.outputs.pluginName }} ${{ steps.check.outputs.version }}
body_path: ${{ github.workspace }}/CHECKSUMS.txt
files: |
${{ github.workspace }}/*.exe
${{ github.workspace }}/*.zip
${{ github.workspace }}/*.pkg
${{ github.workspace }}/*.deb
${{ github.workspace }}/*.ddeb
${{ github.workspace }}/*.tar.xz

142
.gitignore vendored
View File

@ -1,41 +1,115 @@
# Exclude everything
/*
# Prerequisites #
#################
*.d
# Except for default project files
!/.github
!/build-aux
!/cmake
!/data
!/deps
!/scripting
!/forms
!/lib
!/module
!/plugins
!/tests
!.clang-format
!.cmake-format.json
!.gitattributes
!.gitignore
!.pre-commit-config.yaml
!BUILDING.md
!buildspec.json
!CMakeLists.txt
!CMakePresets.json
!LICENSE
!README.md
# Object files #
################
*.o
*.ko
*.obj
*.elf
*.slo
*.lo
*.obj
# Exclude .orig leftovers
*.orig
# Linker output #
#################
*.ilk
*.map
*.exp
# Exclude lock files
*.lock.json
# Precompiled Headers #
#######################
*.gch
*.pch
# Exclude macOS legacy resource forks
# Libraries #
#############
*.lib
*.a
*.la
*.lo
*.lai
# Shared objects (inc. Windows DLLs) #
######################################
*.dll
*.so
*.so.*
*.dylib
# Executables #
###############
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files #
###############
*.dSYM/
*.su
*.idb
*.pdb
# CMake temp files #
####################
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake_install
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
*.directory
*.generated.*
**/.Brewfile.lock.json
# Exclude CMake build number cache
/cmake/.CMakeBuildNumber
# backup text files generated by an editor #
############################################
**/*~
# Exclude python caches
/**/__pycache__
# Various IDE Files #
#####################
.classpath
.project
.settings
.idea
.metadata
.vscode
*.iml
*.ipr
*.sublime*
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
.history/
*.vsix
forms/advanced-scene-switcher.ui.autosave
# Directories #
###############
*~
.DS_Store
/build/
/build_*/
/release/
/installer/Output/

12
.gitmodules vendored
View File

@ -25,15 +25,3 @@
[submodule "deps/json"]
path = deps/json
url = https://github.com/nlohmann/json.git
[submodule "deps/libusb"]
path = deps/libusb
url = https://github.com/libusb/libusb.git
[submodule "deps/date"]
path = deps/date
url = https://github.com/HowardHinnant/date.git
[submodule "deps/jsoncons"]
path = deps/jsoncons
url = https://github.com/danielaparker/jsoncons.git
[submodule "deps/paho.mqtt.cpp"]
path = deps/paho.mqtt.cpp
url = https://github.com/eclipse-paho/paho.mqtt.cpp.git

View File

@ -1,24 +0,0 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
hooks:
- id: clang-format
args: [-fallback-style=none]
types_or: [c++, c]
exclude: |
(?x)^(
deps/.*|
tests/catch\.hpp|
.*\.mm
)$
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.2
hooks:
- id: ruff-format
types_or: [python]

View File

@ -4,28 +4,24 @@ You have the option to ...
- either add the plugin to the OBS source tree directly and build the plugin while building OBS itself. (**in tree**)
- or you can move the sources of this plugin outside of the OBS source tree and build it separately from OBS. (**out of tree**)
Both methods require [CMake](https://cmake.org/download/).
As both methods require you to have a working [OBS Studio development environment](https://obsproject.com/wiki/Building-OBS-Studio) and [CMake](https://cmake.org/download/) it is recommended to build the plugin in tree as it is easier to set up and will enable straightforward debugging.
The plugin can be compiled for OBS 31 and above, although using the latest version of OBS is recommended to support all features.
The plugin can be compiled for OBS 25 and above, although using the latest version of OBS is recommended to support all features.
## Compiling in tree (recommended for development)
This section assumes that you have a working [OBS Studio development environment](https://obsproject.com/wiki/Building-OBS-Studio).
Add the "SceneSwitcher" source directory to your obs-studio source directory under obs-studio/plugins:
Add the "SceneSwitcher" source directory to your obs-studio source directory under obs-studio/UI/frontend-plugins/:
```
cd obs-studio/plugins
cd obs-studio/UI/frontend-plugins/
git clone --recursive https://github.com/WarmUpTill/SceneSwitcher.git
```
Then modify the obs-studio/plugins/CMakeLists.txt and add an entry for the scene switcher:
Then modify the obs-studio/UI/frontend-plugins/CMakeLists.txt Example and add an entry for the scene switcher:
```
add_subdirectory(SceneSwitcher)
```
Now follow the [build instructions for obs-studio](https://obsproject.com/wiki/Building-OBS-Studio) for your particular platform.
### Dependencies for plugins
Note that on Linux systems it might be necessary to additionally install the following packages to fulfill the dependencies to `XTest`, `XScreensaver` and `OpenCV` - exact command may differ:
```
sudo apt-get install \
@ -35,60 +31,43 @@ sudo apt-get install \
libopencv-dev
```
If you have decided to build some dependencies of the plugin yourself (e.g. `OpenCV` for the video condition) you will have to pass the corresponding arguments to the cmake command used to configure OBS.
Here is an example of what the adjusted command might look like on a Windows machine:
```
cd obs-studio
cmake -DOpenCV_DIR="C:/Users/BuildUser/Documents/OBS/opencv/build/" -DLeptonica_DIR="C:/Users/BuildUser/Documents/OBS/leptonica/build" -DTesseract_DIR="C:/Users/BuildUser/Documents/OBS/tesseract/build/lib/cmake/tesseract" --preset windows-x64
```
## Compiling out of tree
First you will need to clone the plugin sources by running the following command:
```
git clone --recursive https://github.com/WarmUpTill/SceneSwitcher.git
```
Next you will need [CMake](https://cmake.org/download/) and run it with suitable arguments for your particular platform.
For example, on Windows you might want to run this command:
```
cd SceneSwitcher
cmake --preset windows-x64
```
Next, you can build the plugin and install the files into a folder named release using the following commands:
```
cmake --build build_x64 --preset windows-x64 --config RelWithDebInfo
cmake --install build_x64 --prefix release --config RelWithDebInfo
```
You can of course also build the plugin in an IDE depending on which generator you chose. (E.g. a Visual Studio solution on Windows)
### Dependencies for plugins
If you also want to include plugins which depend on external libraries you will have to adjust the cmake call in the configuration phase accordingly.
For example, to include the "Video" condition in your build you will have to supply the paths to `OpenCV`, `tesseract`, and `leptonica` binaries.
On a Window system the command might look something like this:
```
cd SceneSwitcher
cmake -DOpenCV_DIR="C:/Users/BuildUser/Documents/OBS/opencv/build/" -DLeptonica_DIR="C:/Users/BuildUser/Documents/OBS/leptonica/build" -DTesseract_DIR="C:/Users/BuildUser/Documents/OBS/tesseract/build/lib/cmake/tesseract" --preset windows-x64
```
You can rely on the CI scripts to build the dependencies for you, although it is not guaranteed that they will function in every environment:
You'll need [CMake](https://cmake.org/download/) and a working [OBS Studio development environment](https://obsproject.com/wiki/Building-OBS-Studio) installed on your computer.
The easiest way to set this up is to call the corresponding CI scripts, as they will automatically download all required dependencies and start build of the plugin:
| Platform | Command |
| ----------- | ----------- |
| Windows | `.\.github\scripts\Build-Deps-Windows.ps1` |
| Linux | `./.github/scripts/build-deps-linux.sh` |
| MacOS | `./.github/scripts/build-deps-macos.zsh` |
| Windows | `./.github/scripts/Build-Windows.ps1` |
| Linux | `./.github/scripts/build-linux.sh` |
| MacOS | `./.github/scripts/build-macos.zsh` |
Alternatively you can download the OBS dependencies from https://github.com/obsproject/obs-deps/releases and manually configure and start the build.
Start by creating a build directory:
```
mkdir build && cd build
```
Next configure the build.
```
cmake -DCMAKE_PREFIX_PATH=<path-to-obs-deps> -Dlibobs_DIR=<path-to-libobs-dir> -Dobs-frontend-api_DIR=<path-to-frontend-api-dir> ..
```
It might be necessary to provide additional variables depending on your build setup.
Finally, start the plugin build using your provided generator. (E.g. Ninja on Linux or a Visual Studio solution on Windows)
# Contributing
Contributions to the plugin are always welcome and if you need any assistance do not hesitate to reach out!
Contributions to the plugin are always welcome and if you need any assistance do not hesitate to reach out.
If you would like to expand upon the macro system by adding a new condition or action type have a look at the examples in `plugins/base`.
In general changes in the `lib/legacy` folder should be avoided, if possible.
If you would like to expand upon the macro system by adding a new condition or action type have a loot at the examples in `src/macro-core`.
In general changes in the `src/legacy` folder should be avoided.
## Macro condition
Macro conditions should inherit from the `MacroCondition` class and must implement the following functions:
@ -97,19 +76,19 @@ Macro conditions should inherit from the `MacroCondition` class and must impleme
class MacroConditionExample : public MacroCondition {
public:
MacroConditionExample(Macro *m) : MacroCondition(m) {}
// This function should perform the condition check
// This function should perfrom the condition check
bool CheckCondition();
// This function should store the required condition data to "data"
// This function should store the required condition data to "obj"
// For example called on OBS shutdown
bool Save(obs_data_t *data);
// This function should load the condition data from "data"
bool Save(obs_data_t *obj);
// This function should load the condition data from "obj"
// For example called on OBS startup
bool Load(obs_data_t *data);
bool Load(obs_data_t *obj);
// This function should return a unique id for this condition type
// The _id is defined below
std::string GetId() { return _id; };
// Helper function called when new conditions are created
// Will be used later when registering the new condition type
// Will be used later when regeistering the new condition type
static std::shared_ptr<MacroCondition> Create(Macro *m)
{
return std::make_shared<MacroConditionExample>(m);
@ -122,7 +101,7 @@ private:
static const std::string _id;
};
```
When defining the widget used to control the settings of the condition type, a static `Create()` method is required.
When defining the widget used to control the settings of the condition type, it is important to add a static `Create()` method.
It will be called whenever a new condition MacroConditionExample is created. (See `MacroConditionFactory::Register()`)
```
class MacroConditionExampleEdit : public QWidget {
@ -153,7 +132,7 @@ bool MacroConditionExample::_registered = MacroConditionFactory::Register(
MacroConditionExample::id, // Unique string identifying this condition type
{
MacroConditionExample::Create, // Function called to create the object performing the condition
MacroConditionExampleEdit::Create, // Function called to create the widget to configure the settings
MacroConditionExampleEdit::Create, // Function called to create the widget configure the condition
"AdvSceneSwitcher.condition.example", // User facing name of the condition type (will be translated)
true // Condition type supports duration modifiers (default true)
}
@ -169,18 +148,16 @@ The differences are highlighted in the comments below.
class MacroActionExample : public MacroAction {
public:
MacroActionExample(Macro *m) : MacroAction(m) {}
static std::shared_ptr<MacroAction> Create(Macro *m);
// Used to create a copy of the action (used for action queues)
std::shared_ptr<MacroAction> Copy() const;
// This function should perform the action
// This function should perfrom the action
// If false is returned the macro will aborted
bool PerformAction();
bool Save(obs_data_t *data);
bool Load(obs_data_t *data);
bool Save(obs_data_t *obj);
bool Load(obs_data_t *obj);
std::string GetId() { return _id; };
// Optional:
// Might be called when action is inserted to action queue
void ResolveVariablesToFixedValues();
static std::shared_ptr<MacroAction> Create(Macro *m)
{
return std::make_shared<MacroActionExample>(m);
}
private:
static bool _registered;
@ -211,11 +188,11 @@ MacroActionFactory::Register(
MacroActionExample::id, // Unique string identifying this action type
{
MacroActionExample::Create, // Function called to create the object performing the action
MacroActionExampleEdit::Create, // Function called to create the widget to configure the settings
MacroActionExampleEdit::Create, // Function called to create the widget configure the action
"AdvSceneSwitcher.action.example" // User facing name of the action type
}
);
```
## External dependencies
If your intention is to add macro functionality which depends on external libraries, which might not exist on all user environments, have a look at the folders in the `plugins/` directory, which are not named `base`.
For example, `plugins/video` will only be loaded if the `OpenCV` dependencies are met.
If your intention is to add macro functionality which depends on external libraries, which is likely not to exist on all user setups, try to follow the examples under `src/macro-external`.
These are basically plugins themselves that get attempted to be loaded on startup of the advanced scene switcher.

93
CI/checkLocale.py Normal file
View File

@ -0,0 +1,93 @@
#!/usr/bin/env python3
import os
import sys
import argparse
defaultLocaleFile = "en-US.ini"
class localeEntry:
locale = ""
placeholders = []
def __init__(self, locale, widgets) -> None:
self.locale = locale
self.placeholders = widgets
def getNonDefaultLocales(dir):
files = []
for filename in os.listdir(dir):
f = os.path.join(dir, filename)
if os.path.isfile(f) and not f.endswith(defaultLocaleFile):
files.append(f)
return files
def getAllLocaleEntriesWithWidgetPlaceholders(file):
localeEntries = []
with open(file, 'r', encoding='UTF-8') as f:
for line in f.readlines():
widgetPlaceholders = []
for word in line.split("{{"):
if not "}}" in word:
continue
word = "{{" + word[:word.rfind("}}")] + "}}"
widgetPlaceholders.append(word)
localeEntries.append(localeEntry(
line.split("=")[0], widgetPlaceholders))
return localeEntries
def getLocaleEntryFrom(entry, list):
for element in list:
if element.locale == entry.locale:
return element
return None
def checkWidgetPlacehodlers(file, expectedPlaceholders):
localeEntries = getAllLocaleEntriesWithWidgetPlaceholders(file)
result = True
for localeEntry in localeEntries:
expectedEntry = getLocaleEntryFrom(localeEntry, expectedPlaceholders)
if expectedEntry is None:
print(
"WARNING: Locale entry \"{}\" from \"{}\" not found in \"{}\"".format(localeEntry.locale, file, defaultLocaleFile))
continue
for p in localeEntry.placeholders:
if p not in expectedEntry.placeholders:
print("WARNING: Locale entry \"{}\" from \"{}\" does contain \"{}\" while \"{}\" does not".format(
localeEntry.locale, file, p, defaultLocaleFile))
for p in expectedEntry.placeholders:
if p not in localeEntry.placeholders:
result = False
print("ERROR: Locale entry \"{}\" from \"{}\" does not contain \"{}\"".format(
localeEntry.locale, file, p))
return result
def main():
parser = argparse.ArgumentParser(
description='Checks for inconsistencies regarding widget placeholders in the different locale files.')
parser.add_argument(
'-p', '--path', help='Path to locale folder', required=True)
args = parser.parse_args()
placeholders = getAllLocaleEntriesWithWidgetPlaceholders(
os.path.join(args.path, defaultLocaleFile))
nonDefaultLocales = getNonDefaultLocales(args.path)
result = True
for f in nonDefaultLocales:
if checkWidgetPlacehodlers(f, placeholders) == False:
result = False
if result == False:
sys.exit(1)
print("SUCCESS: No issues found!")
sys.exit(0)
if __name__ == "__main__":
main()

View File

@ -7,7 +7,7 @@ Build-Depends: cmake,
libcurl4-openssl-dev,
libobs-dev,
libxtst-dev,
qt6-base-dev,
qtbase5-dev,
libxss-dev,
libopencv-dev
Standards-Version: 4.6.0

View File

@ -3,7 +3,7 @@
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export QT_SELECT = qt6
export QT_SELECT = qt5
%:
dh $@

View File

@ -1,6 +1,16 @@
cmake_minimum_required(VERSION 3.21...3.26)
cmake_minimum_required(VERSION 3.16.3)
project(advanced-scene-switcher VERSION 1.0.0)
set(LIB_NAME "${PROJECT_NAME}-lib")
add_library(${PROJECT_NAME} MODULE)
add_library(${LIB_NAME} SHARED)
set(PLUGIN_AUTHOR "WarmUpTill")
set(MACOS_BUNDLEID "com.warmuptill.${PROJECT_NAME}")
set(LINUX_MAINTAINER_EMAIL "noone@nothing.com")
set(MACOS_PACKAGE_UUID "3F0D2A6A-2583-11ED-861D-0242AC120002")
set(MACOS_INSTALLER_UUID "B7F15A6E-2583-11ED-861D-0242AC120002")
set(WINDOWS_INSTALLER_UUID "A4ADDF26-4426-4D2E-B26A-C7C878DA8FC9")
message(STATUS "CMAKE_PROJECT_NAME is ${CMAKE_PROJECT_NAME}")
if(${CMAKE_PROJECT_NAME} STREQUAL "obs-studio")
@ -12,341 +22,354 @@ else()
message(STATUS "${PROJECT_NAME} configured for out-of-tree build")
endif()
if(BUILD_OUT_OF_TREE)
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake"
NO_POLICY_SCOPE)
include(compilerconfig)
include(defaults)
include(helpers)
endif()
# OBS 31 no longer defines find_qt so check if we need to include it for in-tree
# builds
if(NOT COMMAND find_qt)
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/helpers_common.cmake")
endif()
set(LIB_NAME "${PROJECT_NAME}-lib")
add_library(${PROJECT_NAME} MODULE)
add_library(${LIB_NAME} SHARED)
include(cmake/common/get_git_revision_description.cmake)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
git_describe(GIT_TAG)
# Helper for OpenSSL
if(OS_WINDOWS)
include(cmake/windows/wingetssl.cmake)
endif()
if(${GIT_TAG} STREQUAL "GIT-NOTFOUND")
set(GIT_TAG ${PROJECT_VERSION})
endif()
message(STATUS "${PROJECT_NAME} version: ${GIT_TAG}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/version.cpp.in"
"${CMAKE_CURRENT_BINARY_DIR}/lib/version.cpp" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.cpp.in"
"${CMAKE_CURRENT_BINARY_DIR}/src/version.cpp" @ONLY)
# --- Set target sources ---
# Module sources
target_sources(${PROJECT_NAME} PRIVATE module/advanced-scene-switcher-module.c)
target_sources(${PROJECT_NAME} PRIVATE src/advanced-scene-switcher-module.c)
# Generic sources
target_sources(
${LIB_NAME}
PRIVATE lib/advanced-scene-switcher.cpp
lib/advanced-scene-switcher.hpp
lib/general.cpp
lib/platform-funcs.hpp
lib/switcher-data.cpp
lib/switcher-data.hpp
lib/version.cpp
lib/version.h)
PRIVATE src/advanced-scene-switcher.cpp
src/advanced-scene-switcher.hpp
src/general.cpp
src/hotkey.cpp
src/hotkey.hpp
src/platform-funcs.hpp
src/status-control.cpp
src/status-control.hpp
src/switcher-data.cpp
src/switcher-data.hpp
src/version.cpp
src/version.h)
# Legacy function sources
target_sources(
${LIB_NAME}
PRIVATE lib/legacy/scene-group.cpp
lib/legacy/scene-group.hpp
lib/legacy/switch-audio.cpp
lib/legacy/switch-audio.hpp
lib/legacy/switch-executable.cpp
lib/legacy/switch-executable.hpp
lib/legacy/switch-file.cpp
lib/legacy/switch-file.hpp
lib/legacy/switch-generic.cpp
lib/legacy/switch-generic.hpp
lib/legacy/switch-idle.cpp
lib/legacy/switch-idle.hpp
lib/legacy/switch-media.cpp
lib/legacy/switch-media.hpp
lib/legacy/switch-pause.cpp
lib/legacy/switch-pause.hpp
lib/legacy/switch-random.cpp
lib/legacy/switch-random.hpp
lib/legacy/switch-screen-region.cpp
lib/legacy/switch-screen-region.hpp
lib/legacy/switch-sequence.cpp
lib/legacy/switch-sequence.hpp
lib/legacy/switch-time.cpp
lib/legacy/switch-time.hpp
lib/legacy/switch-transitions.cpp
lib/legacy/switch-transitions.hpp
lib/legacy/switch-video.cpp
lib/legacy/switch-video.hpp
lib/legacy/switch-window.cpp
lib/legacy/switch-window.hpp)
PRIVATE src/legacy/scene-group.cpp
src/legacy/scene-group.hpp
src/legacy/scene-trigger.cpp
src/legacy/scene-trigger.hpp
src/legacy/switch-audio.cpp
src/legacy/switch-audio.hpp
src/legacy/switch-executable.cpp
src/legacy/switch-executable.hpp
src/legacy/switch-file.cpp
src/legacy/switch-file.hpp
src/legacy/switch-generic.cpp
src/legacy/switch-generic.hpp
src/legacy/switch-idle.cpp
src/legacy/switch-idle.hpp
src/legacy/switch-media.cpp
src/legacy/switch-media.hpp
src/legacy/switch-network.cpp
src/legacy/switch-network.hpp
src/legacy/switch-pause.cpp
src/legacy/switch-pause.hpp
src/legacy/switch-random.cpp
src/legacy/switch-random.hpp
src/legacy/switch-screen-region.cpp
src/legacy/switch-screen-region.hpp
src/legacy/switch-sequence.cpp
src/legacy/switch-sequence.hpp
src/legacy/switch-time.cpp
src/legacy/switch-time.hpp
src/legacy/switch-transitions.cpp
src/legacy/switch-transitions.hpp
src/legacy/switch-video.cpp
src/legacy/switch-video.hpp
src/legacy/switch-window.cpp
src/legacy/switch-window.hpp)
# Maro sources
target_sources(
${LIB_NAME}
PRIVATE lib/macro/macro-action-edit.cpp
lib/macro/macro-action-edit.hpp
lib/macro/macro-action-factory.cpp
lib/macro/macro-action-factory.hpp
lib/macro/macro-action-macro.cpp
lib/macro/macro-action-macro.hpp
lib/macro/macro-action-queue.cpp
lib/macro/macro-action-queue.hpp
lib/macro/macro-action-variable.cpp
lib/macro/macro-action-variable.hpp
lib/macro/macro-action.cpp
lib/macro/macro-action.hpp
lib/macro/macro-condition-edit.cpp
lib/macro/macro-condition-edit.hpp
lib/macro/macro-condition-factory.cpp
lib/macro/macro-condition-factory.hpp
lib/macro/macro-condition-macro.cpp
lib/macro/macro-condition-macro.hpp
lib/macro/macro-condition-queue.cpp
lib/macro/macro-condition-queue.hpp
lib/macro/macro-condition-tempvar.cpp
lib/macro/macro-condition-tempvar.hpp
lib/macro/macro-condition-variable.cpp
lib/macro/macro-condition-variable.hpp
lib/macro/macro-condition.cpp
lib/macro/macro-condition.hpp
lib/macro/macro-dock.cpp
lib/macro/macro-dock.hpp
lib/macro/macro-dock-settings.hpp
lib/macro/macro-dock-settings.cpp
lib/macro/macro-dock-window.cpp
lib/macro/macro-dock-window.hpp
lib/macro/macro-edit.cpp
lib/macro/macro-edit.hpp
lib/macro/macro-export-import-dialog.cpp
lib/macro/macro-export-import-dialog.hpp
lib/macro/macro-helpers.cpp
lib/macro/macro-helpers.hpp
lib/macro/macro-input.cpp
lib/macro/macro-input.hpp
lib/macro/macro-list.cpp
lib/macro/macro-list.hpp
lib/macro/macro-ref.cpp
lib/macro/macro-ref.hpp
lib/macro/macro-run-button.cpp
lib/macro/macro-run-button.hpp
lib/macro/macro-search.cpp
lib/macro/macro-search.hpp
lib/macro/macro-segment-copy-paste.cpp
lib/macro/macro-segment-copy-paste.hpp
lib/macro/macro-segment-list.cpp
lib/macro/macro-segment-list.hpp
lib/macro/macro-segment-selection.cpp
lib/macro/macro-segment-selection.hpp
lib/macro/macro-segment-unknown.hpp
lib/macro/macro-segment.cpp
lib/macro/macro-segment.hpp
lib/macro/macro-selection.cpp
lib/macro/macro-selection.hpp
lib/macro/macro-settings.cpp
lib/macro/macro-settings.hpp
lib/macro/macro-signals.cpp
lib/macro/macro-signals.hpp
lib/macro/macro-tab.cpp
lib/macro/macro-tree.cpp
lib/macro/macro-tree.hpp
lib/macro/macro-websocket-trigger.cpp
lib/macro/macro.cpp
lib/macro/macro.hpp)
PRIVATE src/macro-core/macro-action-audio.cpp
src/macro-core/macro-action-audio.hpp
src/macro-core/macro-action-clipboard.cpp
src/macro-core/macro-action-clipboard.hpp
src/macro-core/macro-action-edit.cpp
src/macro-core/macro-action-edit.hpp
src/macro-core/macro-action-file.cpp
src/macro-core/macro-action-file.hpp
src/macro-core/macro-action-filter.cpp
src/macro-core/macro-action-filter.hpp
src/macro-core/macro-action-hotkey.cpp
src/macro-core/macro-action-hotkey.hpp
src/macro-core/macro-action-http.cpp
src/macro-core/macro-action-http.hpp
src/macro-core/macro-action-macro.cpp
src/macro-core/macro-action-macro.hpp
src/macro-core/macro-action-media.cpp
src/macro-core/macro-action-media.hpp
src/macro-core/macro-action-osc.cpp
src/macro-core/macro-action-osc.hpp
src/macro-core/macro-action-plugin-state.cpp
src/macro-core/macro-action-plugin-state.hpp
src/macro-core/macro-action-profile.cpp
src/macro-core/macro-action-profile.hpp
src/macro-core/macro-action-projector.cpp
src/macro-core/macro-action-projector.hpp
src/macro-core/macro-action-random.cpp
src/macro-core/macro-action-random.hpp
src/macro-core/macro-action-recording.cpp
src/macro-core/macro-action-recording.hpp
src/macro-core/macro-action-replay-buffer.cpp
src/macro-core/macro-action-replay-buffer.hpp
src/macro-core/macro-action-run.cpp
src/macro-core/macro-action-run.hpp
src/macro-core/macro-action-scene-collection.cpp
src/macro-core/macro-action-scene-collection.hpp
src/macro-core/macro-action-scene-lock.cpp
src/macro-core/macro-action-scene-lock.hpp
src/macro-core/macro-action-scene-order.cpp
src/macro-core/macro-action-scene-order.hpp
src/macro-core/macro-action-scene-switch.cpp
src/macro-core/macro-action-scene-switch.hpp
src/macro-core/macro-action-scene-transform.cpp
src/macro-core/macro-action-scene-transform.hpp
src/macro-core/macro-action-scene-visibility.cpp
src/macro-core/macro-action-scene-visibility.hpp
src/macro-core/macro-action-screenshot.cpp
src/macro-core/macro-action-screenshot.hpp
src/macro-core/macro-action-sequence.cpp
src/macro-core/macro-action-sequence.hpp
src/macro-core/macro-action-source.cpp
src/macro-core/macro-action-source.hpp
src/macro-core/macro-action-streaming.cpp
src/macro-core/macro-action-streaming.hpp
src/macro-core/macro-action-studio-mode.cpp
src/macro-core/macro-action-studio-mode.hpp
src/macro-core/macro-action-systray.cpp
src/macro-core/macro-action-systray.hpp
src/macro-core/macro-action-timer.cpp
src/macro-core/macro-action-timer.hpp
src/macro-core/macro-action-transition.cpp
src/macro-core/macro-action-transition.hpp
src/macro-core/macro-action-variable.cpp
src/macro-core/macro-action-variable.hpp
src/macro-core/macro-action-virtual-cam.cpp
src/macro-core/macro-action-virtual-cam.hpp
src/macro-core/macro-action-wait.cpp
src/macro-core/macro-action-wait.hpp
src/macro-core/macro-action-websocket.cpp
src/macro-core/macro-action-websocket.hpp
src/macro-core/macro-action.cpp
src/macro-core/macro-action.hpp
src/macro-core/macro-condition-audio.cpp
src/macro-core/macro-condition-audio.hpp
src/macro-core/macro-condition-cursor.cpp
src/macro-core/macro-condition-cursor.hpp
src/macro-core/macro-condition-date.cpp
src/macro-core/macro-condition-date.hpp
src/macro-core/macro-condition-display.cpp
src/macro-core/macro-condition-display.hpp
src/macro-core/macro-condition-edit.cpp
src/macro-core/macro-condition-edit.hpp
src/macro-core/macro-condition-file.cpp
src/macro-core/macro-condition-file.hpp
src/macro-core/macro-condition-filter.cpp
src/macro-core/macro-condition-filter.hpp
src/macro-core/macro-condition-hotkey.cpp
src/macro-core/macro-condition-hotkey.hpp
src/macro-core/macro-condition-idle.cpp
src/macro-core/macro-condition-idle.hpp
src/macro-core/macro-condition-macro.cpp
src/macro-core/macro-condition-macro.hpp
src/macro-core/macro-condition-media.cpp
src/macro-core/macro-condition-media.hpp
src/macro-core/macro-condition-obs-stats.cpp
src/macro-core/macro-condition-obs-stats.hpp
src/macro-core/macro-condition-plugin-state.cpp
src/macro-core/macro-condition-plugin-state.hpp
src/macro-core/macro-condition-process.cpp
src/macro-core/macro-condition-process.hpp
src/macro-core/macro-condition-profile.cpp
src/macro-core/macro-condition-profile.hpp
src/macro-core/macro-condition-recording.cpp
src/macro-core/macro-condition-recording.hpp
src/macro-core/macro-condition-replay-buffer.cpp
src/macro-core/macro-condition-replay-buffer.hpp
src/macro-core/macro-condition-run.cpp
src/macro-core/macro-condition-run.hpp
src/macro-core/macro-condition-scene-order.cpp
src/macro-core/macro-condition-scene-order.hpp
src/macro-core/macro-condition-scene-transform.cpp
src/macro-core/macro-condition-scene-transform.hpp
src/macro-core/macro-condition-scene-visibility.cpp
src/macro-core/macro-condition-scene-visibility.hpp
src/macro-core/macro-condition-slideshow.cpp
src/macro-core/macro-condition-slideshow.hpp
src/macro-core/macro-condition-scene.cpp
src/macro-core/macro-condition-scene.hpp
src/macro-core/macro-condition-source.cpp
src/macro-core/macro-condition-source.hpp
src/macro-core/macro-condition-streaming.cpp
src/macro-core/macro-condition-streaming.hpp
src/macro-core/macro-condition-studio-mode.cpp
src/macro-core/macro-condition-studio-mode.hpp
src/macro-core/macro-condition-tempvar.cpp
src/macro-core/macro-condition-tempvar.hpp
src/macro-core/macro-condition-timer.cpp
src/macro-core/macro-condition-timer.hpp
src/macro-core/macro-condition-transition.cpp
src/macro-core/macro-condition-transition.hpp
src/macro-core/macro-condition-variable.cpp
src/macro-core/macro-condition-variable.hpp
src/macro-core/macro-condition-virtual-cam.cpp
src/macro-core/macro-condition-virtual-cam.hpp
src/macro-core/macro-condition-websocket.cpp
src/macro-core/macro-condition-websocket.hpp
src/macro-core/macro-condition-window.cpp
src/macro-core/macro-condition-window.hpp
src/macro-core/macro-condition.cpp
src/macro-core/macro-condition.hpp
src/macro-core/macro-dock.cpp
src/macro-core/macro-dock.hpp
src/macro-core/macro-properties.cpp
src/macro-core/macro-properties.hpp
src/macro-core/macro-ref.cpp
src/macro-core/macro-ref.hpp
src/macro-core/macro-segment-list.cpp
src/macro-core/macro-segment-list.hpp
src/macro-core/macro-segment.cpp
src/macro-core/macro-segment.hpp
src/macro-core/macro-selection.cpp
src/macro-core/macro-selection.hpp
src/macro-core/macro-tab.cpp
src/macro-core/macro-tree.cpp
src/macro-core/macro-tree.hpp
src/macro-core/macro.cpp
src/macro-core/macro.hpp)
# Utility function sources
target_sources(
${LIB_NAME}
PRIVATE lib/queue/action-queue.cpp
lib/queue/action-queue.hpp
lib/queue/action-queue-tab.cpp
lib/queue/action-queue-tab.hpp
lib/utils/auto-update-tooltip-label.cpp
lib/utils/auto-update-tooltip-label.hpp
lib/utils/backup.cpp
lib/utils/backup.hpp
lib/utils/canvas-helpers.cpp
lib/utils/canvas-helpers.hpp
lib/utils/condition-logic.cpp
lib/utils/condition-logic.hpp
lib/utils/crash-handler.cpp
lib/utils/crash-handler.hpp
lib/utils/curl-helper.cpp
lib/utils/curl-helper.hpp
lib/utils/cursor-shape-changer.cpp
lib/utils/cursor-shape-changer.hpp
lib/utils/double-slider.cpp
lib/utils/double-slider.hpp
lib/utils/duration-control.cpp
lib/utils/duration-control.hpp
lib/utils/duration-modifier.cpp
lib/utils/duration-modifier.hpp
lib/utils/duration.cpp
lib/utils/duration.hpp
lib/utils/export-symbol-helper.hpp
lib/utils/file-selection.cpp
lib/utils/file-selection.hpp
lib/utils/filter-combo-box.cpp
lib/utils/filter-combo-box.hpp
lib/utils/first-run-wizard.cpp
lib/utils/first-run-wizard.hpp
lib/utils/help-icon.hpp
lib/utils/help-icon.cpp
lib/utils/item-selection-helpers.cpp
lib/utils/item-selection-helpers.hpp
lib/utils/json-helpers.cpp
lib/utils/json-helpers.hpp
lib/utils/layout-helpers.cpp
lib/utils/layout-helpers.hpp
lib/utils/list-controls.cpp
lib/utils/list-controls.hpp
lib/utils/list-editor.cpp
lib/utils/list-editor.hpp
lib/utils/log-helper.cpp
lib/utils/log-helper.hpp
lib/utils/math-helpers.cpp
lib/utils/math-helpers.hpp
lib/utils/message-buffer.hpp
lib/utils/message-dispatcher.hpp
lib/utils/mouse-wheel-guard.cpp
lib/utils/mouse-wheel-guard.hpp
lib/utils/name-dialog.cpp
lib/utils/name-dialog.hpp
lib/utils/non-modal-dialog.cpp
lib/utils/non-modal-dialog.hpp
lib/utils/obs-module-helper.cpp
lib/utils/obs-module-helper.hpp
lib/utils/path-helpers.cpp
lib/utils/path-helpers.hpp
lib/utils/plugin-state-helpers.cpp
lib/utils/plugin-state-helpers.hpp
lib/utils/priority-helper.cpp
lib/utils/priority-helper.hpp
lib/utils/regex-config.cpp
lib/utils/regex-config.hpp
lib/utils/resizable-widget.cpp
lib/utils/resizable-widget.hpp
lib/utils/resizing-text-edit.cpp
lib/utils/resizing-text-edit.hpp
lib/utils/resource-table.cpp
lib/utils/resource-table.hpp
lib/utils/scene-selection.cpp
lib/utils/scene-selection.hpp
lib/utils/scene-switch-helpers.cpp
lib/utils/scene-switch-helpers.hpp
lib/utils/screenshot-helper.cpp
lib/utils/screenshot-helper.hpp
lib/utils/section.cpp
lib/utils/section.hpp
lib/utils/selection-helpers.cpp
lib/utils/selection-helpers.hpp
lib/utils/single-char-selection.cpp
lib/utils/single-char-selection.hpp
lib/utils/slider-spinbox.cpp
lib/utils/slider-spinbox.hpp
lib/utils/source-helpers.cpp
lib/utils/source-helpers.hpp
lib/utils/source-selection.cpp
lib/utils/source-selection.hpp
lib/utils/splitter-helpers.cpp
lib/utils/splitter-helpers.hpp
lib/utils/status-control.cpp
lib/utils/status-control.hpp
lib/utils/string-list.cpp
lib/utils/string-list.hpp
lib/utils/switch-button.cpp
lib/utils/switch-button.hpp
lib/utils/sync-helpers.cpp
lib/utils/sync-helpers.hpp
lib/utils/tab-helpers.cpp
lib/utils/tab-helpers.hpp
lib/utils/temp-variable.cpp
lib/utils/temp-variable.hpp
lib/utils/time-helpers.cpp
lib/utils/time-helpers.hpp
lib/utils/ui-helpers.cpp
lib/utils/ui-helpers.hpp
lib/utils/utility.cpp
lib/utils/utility.hpp
lib/utils/volume-control.cpp
lib/utils/volume-control.hpp
lib/utils/websocket-api.cpp
lib/utils/websocket-api.hpp
lib/variables/variable-line-edit.cpp
lib/variables/variable-line-edit.hpp
lib/variables/variable-number.hpp
lib/variables/variable-number.tpp
lib/variables/variable-spinbox.cpp
lib/variables/variable-spinbox.hpp
lib/variables/variable-string.cpp
lib/variables/variable-string.hpp
lib/variables/variable-tab.cpp
lib/variables/variable-tab.hpp
lib/variables/variable-text-edit.cpp
lib/variables/variable-text-edit.hpp
lib/variables/variable.cpp
lib/variables/variable.hpp)
PRIVATE src/utils/connection-manager.cpp
src/utils/connection-manager.hpp
src/utils/curl-helper.cpp
src/utils/curl-helper.hpp
src/utils/duration.cpp
src/utils/duration.hpp
src/utils/duration-control.cpp
src/utils/duration-control.hpp
src/utils/export-symbol-helper.hpp
src/utils/item-selection-helpers.cpp
src/utils/item-selection-helpers.hpp
src/utils/log-helper.hpp
src/utils/file-selection.cpp
src/utils/file-selection.hpp
src/utils/filter-combo-box.cpp
src/utils/filter-combo-box.hpp
src/utils/filter-selection.cpp
src/utils/filter-selection.hpp
src/utils/macro-export-import-dialog.cpp
src/utils/macro-export-import-dialog.hpp
src/utils/macro-list.cpp
src/utils/macro-list.hpp
src/utils/macro-run-button.cpp
src/utils/macro-run-button.hpp
src/utils/macro-segment-selection.cpp
src/utils/macro-segment-selection.hpp
src/utils/math-helpers.cpp
src/utils/math-helpers.hpp
src/utils/mouse-wheel-guard.cpp
src/utils/mouse-wheel-guard.hpp
src/utils/name-dialog.cpp
src/utils/name-dialog.hpp
src/utils/non-modal-dialog.cpp
src/utils/non-modal-dialog.hpp
src/utils/obs-dock.hpp
src/utils/obs-module-helper.cpp
src/utils/obs-module-helper.hpp
src/utils/osc-helpers.cpp
src/utils/osc-helpers.hpp
src/utils/plugin-state-helper.cpp
src/utils/plugin-state-helper.hpp
src/utils/priority-helper.cpp
src/utils/priority-helper.hpp
src/utils/process-config.cpp
src/utils/process-config.hpp
src/utils/regex-config.cpp
src/utils/regex-config.hpp
src/utils/resizing-text-edit.cpp
src/utils/resizing-text-edit.hpp
src/utils/scene-item-selection.cpp
src/utils/scene-item-selection.hpp
src/utils/scene-selection.cpp
src/utils/scene-selection.hpp
src/utils/scene-switch-helpers.cpp
src/utils/scene-switch-helpers.hpp
src/utils/screenshot-helper.cpp
src/utils/screenshot-helper.hpp
src/utils/section.cpp
src/utils/section.hpp
src/utils/slider-spinbox.cpp
src/utils/slider-spinbox.hpp
src/utils/source-selection.cpp
src/utils/source-selection.hpp
src/utils/source-setting.cpp
src/utils/source-setting.hpp
src/utils/string-list.cpp
src/utils/string-list.hpp
src/utils/striped-frame.cpp
src/utils/striped-frame.hpp
src/utils/switch-button.cpp
src/utils/switch-button.hpp
src/utils/sync-helper.cpp
src/utils/sync-helper.hpp
src/utils/temp-variable.cpp
src/utils/temp-variable.hpp
src/utils/transition-selection.cpp
src/utils/transition-selection.hpp
src/utils/utility.cpp
src/utils/utility.hpp
src/utils/variable.cpp
src/utils/variable.hpp
src/utils/variable-line-edit.cpp
src/utils/variable-line-edit.hpp
src/utils/variable-number.tpp
src/utils/variable-number.hpp
src/utils/variable-spinbox.cpp
src/utils/variable-spinbox.hpp
src/utils/variable-string.cpp
src/utils/variable-string.hpp
src/utils/variable-text-edit.cpp
src/utils/variable-text-edit.hpp
src/utils/volume-control.cpp
src/utils/volume-control.hpp
src/utils/websocket-helpers.cpp
src/utils/websocket-helpers.hpp)
# --- End of section ---
# Subfolder for advanced scene switcher plugins
set(ADVSS_PLUGIN_FOLDER "advanced-scene-switcher-plugins")
target_compile_definitions(
${LIB_NAME} PRIVATE ADVSS_PLUGIN_FOLDER=\"${ADVSS_PLUGIN_FOLDER}\")
include(cmake/common/advss_helpers.cmake)
if(BUILD_OUT_OF_TREE)
include(cmake/ObsPluginHelpers.cmake)
endif()
include(cmake/AdvSSHelpers.cmake)
setup_obs_lib_dependency(${LIB_NAME})
setup_obs_lib_dependency(${PROJECT_NAME})
find_package(Qt6 REQUIRED COMPONENTS Widgets Core)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Widgets)
target_link_libraries(${LIB_NAME} PRIVATE Qt6::Core Qt6::Widgets)
# Ignore QCheckBox::stateChanged deprecation warning until minimum supported Qt
# version is at least Qt 6.7, which introduces QCheckBox::checkStateChanged
if(Qt6_VERSION VERSION_GREATER "6.0.0")
target_compile_definitions(${LIB_NAME} PRIVATE QT_NO_DEPRECATED_WARNINGS)
endif()
target_compile_options(
${PROJECT_NAME}
PRIVATE
$<$<C_COMPILER_ID:Clang,AppleClang>:-Wno-quoted-include-in-framework-header
-Wno-comma>)
set_target_properties(
${PROJECT_NAME}
PROPERTIES AUTOMOC ON
AUTOUIC ON
AUTORCC ON)
target_link_libraries(${PROJECT_NAME} PUBLIC ${LIB_NAME})
find_qt(COMPONENTS Widgets Core)
target_link_libraries(${LIB_NAME} PUBLIC Qt::Core Qt::Widgets)
# --- Platform-independent build settings ---
target_include_directories(
${LIB_NAME}
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/legacy"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/macro"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/queue"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/utils"
"${CMAKE_CURRENT_SOURCE_DIR}/lib/variables"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src"
"${CMAKE_CURRENT_SOURCE_DIR}/src/legacy"
"${CMAKE_CURRENT_SOURCE_DIR}/src/macro-core"
"${CMAKE_CURRENT_SOURCE_DIR}/src/utils"
"${CMAKE_CURRENT_BINARY_DIR}/forms")
set_target_properties(
@ -355,81 +378,73 @@ set_target_properties(
AUTOUIC ON
AUTORCC ON
AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/forms")
set_target_properties(${LIB_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)
target_compile_features(${LIB_NAME} PUBLIC cxx_std_17)
add_definitions(-DASIO_STANDALONE)
target_include_directories(
${LIB_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/deps/obs-websocket/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps/exprtk")
${LIB_NAME}
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/deps/asio/asio/include"
"${CMAKE_CURRENT_SOURCE_DIR}/deps/websocketpp"
"${CMAKE_CURRENT_SOURCE_DIR}/deps/obs-websocket/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps/exprtk")
if(NOT nlohmann_json_DIR
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/json/CMakeLists.txt")
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/json/CMakeLists.txt")
add_subdirectory(deps/json)
else()
find_package(nlohmann_json REQUIRED)
endif()
target_link_libraries(${LIB_NAME} PUBLIC nlohmann_json::nlohmann_json)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/jsoncons/CMakeLists.txt")
# Don't build jsoncons unit tests as they are causing compilation issues and
# won't be executed either way
if(OS_MACOS)
cmake_policy(SET CMP0077 NEW)
endif()
set(JSONCONS_BUILD_TESTS
OFF
CACHE BOOL "" FORCE)
add_subdirectory(deps/jsoncons EXCLUDE_FROM_ALL)
target_link_libraries(${LIB_NAME} PRIVATE jsoncons)
target_compile_definitions(${LIB_NAME} PRIVATE JSONPATH_SUPPORT=1)
endif()
find_package(CURL QUIET)
find_package(Libcurl QUIET)
if(CURL_FOUND)
if(NOT DEFINED CURL_INCLUDE_DIRS AND TARGET CURL::libcurl)
get_target_property(CURL_INCLUDE_DIR CURL::libcurl
INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(${LIB_NAME} PUBLIC "${CURL_INCLUDE_DIR}")
else()
target_include_directories(${LIB_NAME} PUBLIC "${CURL_INCLUDE_DIRS}")
endif()
elseif(Libcurl_FOUND)
target_include_directories(${LIB_NAME} PUBLIC "${LIBCURL_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "Couldn't find CURL or Libcurl - abort")
endif()
target_compile_definitions(${LIB_NAME} PRIVATE ADVSS_EXPORT_SYMBOLS=1)
# --- End of section ---
# --- Windows-specific build settings and tasks ---
if(OS_WINDOWS)
configure_file(cmake/bundle/windows/installer-Windows.iss.in
${CMAKE_CURRENT_BINARY_DIR}/installer-Windows.generated.iss)
target_compile_definitions(${LIB_NAME} PRIVATE UNICODE _UNICODE)
if(MSVC)
target_compile_options(${LIB_NAME} PUBLIC /MP /d2FH4- /wd4267 /wd4267
/bigobj)
# Workaround for MSVC incompatibility in CI environment
add_compile_definitions(${target_name} _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
endif()
target_sources(${LIB_NAME} PRIVATE lib/win/advanced-scene-switcher-win.cpp)
target_sources(${LIB_NAME} PRIVATE src/win/advanced-scene-switcher-win.cpp)
add_definitions(-D_WEBSOCKETPP_CPP11_STL_)
set_property(TARGET ${LIB_NAME} PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS true)
# --- End of section ---
# -- macOS specific build settings and tasks --
elseif(OS_MACOS)
configure_file(cmake/bundle/macos/installer-macos.pkgproj.in
${CMAKE_CURRENT_BINARY_DIR}/installer-macos.generated.pkgproj)
set(MACOSX_PLUGIN_GUI_IDENTIFIER "${MACOS_BUNDLEID}")
set(MACOSX_PLUGIN_BUNDLE_VERSION "${PROJECT_VERSION}")
set(MACOSX_PLUGIN_SHORT_VERSION_STRING "1")
target_compile_options(
${LIB_NAME} PRIVATE -Wall -Wextra -Werror-implicit-function-declaration
-stdlib=libc++ -fvisibility=default)
set_target_properties(${LIB_NAME} PROPERTIES PREFIX "" SUFFIX ".so")
find_library(COCOA Cocoa)
target_include_directories(${LIB_NAME} PRIVATE ${COCOA})
target_link_libraries(${LIB_NAME} PRIVATE ${COCOA})
target_sources(${LIB_NAME} PRIVATE lib/osx/advanced-scene-switcher-osx.mm)
find_package(CURL)
find_package(Libcurl)
if(CURL_FOUND)
target_include_directories(${LIB_NAME} PRIVATE "${CURL_INCLUDE_DIRS}")
elseif(Libcurl_FOUND)
target_include_directories(${LIB_NAME} PRIVATE "${LIBCURL_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "Couldn't find CURL or Libcurl - abort")
endif()
target_sources(${LIB_NAME} PRIVATE src/osx/advanced-scene-switcher-osx.mm)
set_source_files_properties(advanced-scene-switcher-osx.mm
PROPERTIES COMPILE_FLAGS "-fobjc-arc")
# --- End of section ---
@ -437,13 +452,14 @@ elseif(OS_MACOS)
# --- Linux-specific build settings and tasks ---
else()
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
target_compile_options(${LIB_NAME} PRIVATE -Wall -Wextra)
set_target_properties(${LIB_NAME} PROPERTIES PREFIX "")
set_target_properties(${LIB_NAME} PROPERTIES SOVERSION 1)
find_package(Qt6 REQUIRED COMPONENTS DBus)
find_package(X11 REQUIRED COMPONENTS Xss)
target_include_directories(${LIB_NAME} PRIVATE "${X11_INCLUDE_DIR}"
"${X11_Xss_INCLUDE_PATH}")
find_package(X11 REQUIRED COMPONENTS Xtst Xss)
target_include_directories(
${LIB_NAME} PRIVATE "${X11_INCLUDE_DIR}" "${X11_Xtst_INCLUDE_PATH}"
"${X11_Xss_INCLUDE_PATH}")
target_link_libraries(${LIB_NAME} PRIVATE ${X11_LIBRARIES})
find_path(PROCPS_INCLUDE_DIR NAMES proc/procps.h)
@ -455,30 +471,10 @@ else()
set(PROCESS_CONDITION_SUPPORTED 1)
endif()
if(PROCPS2_INCLUDE_DIR)
find_package(PkgConfig REQUIRED)
pkg_check_modules(libproc2 REQUIRED IMPORTED_TARGET libproc2)
message(STATUS "${PROJECT_NAME} using libproc2")
set(PROC_INCLUDE_DIR "${PROCPS2_INCLUDE_DIR}")
target_compile_definitions(${LIB_NAME} PRIVATE PROCPS2_AVAILABLE)
set(PROCESS_CONDITION_SUPPORTED 1)
# Check if PIDS_VAL takes 4 arguments (old API, pre-4.0.5) or 3 (new API)
include(CheckCSourceCompiles)
set(CMAKE_REQUIRED_INCLUDES "${PROCPS2_INCLUDE_DIR}")
set(CMAKE_REQUIRED_LIBRARIES proc2)
check_c_source_compiles(
"
#include <libproc2/pids.h>
int main(void) {
struct pids_stack *s = 0;
struct pids_info *i = 0;
(void)PIDS_VAL(0, str, s, i);
return 0;
}
"
PROCPS2_PIDS_VAL_TAKES_INFO)
if(PROCPS2_PIDS_VAL_TAKES_INFO)
target_compile_definitions(${LIB_NAME} PRIVATE PROCPS2_USE_INFO)
endif()
endif()
if(NOT DEFINED PROCESS_CONDITION_SUPPORTED)
message(
@ -487,27 +483,21 @@ else()
)
endif()
target_include_directories(${LIB_NAME} PRIVATE "${PROC_INCLUDE_DIR}")
target_sources(${LIB_NAME} PRIVATE lib/linux/advanced-scene-switcher-nix.cpp
lib/linux/kwin-helpers.cpp)
# Don't include irrelevant folders into sources archive
list(APPEND CPACK_SOURCE_IGNORE_FILES "\\.deps/.*")
find_package(CURL)
find_package(Libcurl)
if(CURL_FOUND)
target_include_directories(${LIB_NAME} PRIVATE "${CURL_INCLUDE_DIRS}")
elseif(Libcurl_FOUND)
target_include_directories(${LIB_NAME} PRIVATE "${LIBCURL_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "Couldn't find CURL or Libcurl - abort")
endif()
target_sources(${LIB_NAME} PRIVATE src/linux/advanced-scene-switcher-nix.cpp)
endif()
if(NOT OS_WINDOWS)
target_compile_options(
${LIB_NAME}
PUBLIC -Wno-error=unused-parameter -Wno-error=conversion -Wno-error=shadow
-Wno-error=float-conversion -Wno-error=enum-conversion)
endif()
# --- End of section ---
add_subdirectory(plugins)
add_subdirectory(tests)
# --- Install ---
if(DEB_INSTALL)
file(GLOB ASS_TRANSLATION_FILES "data/locale/*.ini")
if(NOT LIB_OUT_DIR)
@ -525,11 +515,11 @@ if(DEB_INSTALL)
install(DIRECTORY data/res
DESTINATION ${CMAKE_INSTALL_PREFIX}/${DATA_OUT_DIR})
else()
setup_plugin_target(${PROJECT_NAME})
install_advss_lib(${LIB_NAME})
if(BUILD_OUT_OF_TREE)
set_target_properties_plugin(${PROJECT_NAME} PROPERTIES OUTPUT_NAME
${_name})
else()
set_target_properties_obs(${PROJECT_NAME} PROPERTIES PREFIX "")
endif()
endif()
# --- End of section ---
add_subdirectory(src/macro-external)
add_subdirectory(tests)

View File

@ -1,190 +0,0 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 22,
"patch": 0
},
"configurePresets": [
{
"name": "template",
"hidden": true,
"cacheVariables": {
"ENABLE_FRONTEND_API": true,
"ENABLE_QT": true
}
},
{
"name": "macos",
"displayName": "macOS Universal",
"description": "Build for macOS 11.0+ (Universal binary)",
"inherits": ["template"],
"binaryDir": "${sourceDir}/build_macos",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"generator": "Xcode",
"warnings": {"dev": true, "deprecated": true},
"cacheVariables": {
"QT_VERSION": "6",
"CMAKE_OSX_DEPLOYMENT_TARGET": "11.0",
"CODESIGN_IDENTITY": "$penv{CODESIGN_IDENT}",
"CODESIGN_TEAM": "$penv{CODESIGN_TEAM}"
}
},
{
"name": "macos-ci",
"inherits": ["macos"],
"displayName": "macOS Universal CI build",
"description": "Build for macOS 11.0+ (Universal binary) for CI",
"generator": "Xcode",
"cacheVariables": {
"CMAKE_COMPILE_WARNING_AS_ERROR": true
}
},
{
"name": "windows-x64",
"displayName": "Windows x64",
"description": "Build for Windows x64",
"inherits": ["template"],
"binaryDir": "${sourceDir}/build_x64",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"warnings": {"dev": true, "deprecated": true},
"cacheVariables": {
"QT_VERSION": "6",
"CMAKE_SYSTEM_VERSION": "10.0.18363.657"
}
},
{
"name": "windows-ci-x64",
"inherits": ["windows-x64"],
"displayName": "Windows x64 CI build",
"description": "Build for Windows x64 on CI",
"cacheVariables": {
"CMAKE_COMPILE_WARNING_AS_ERROR": true
}
},
{
"name": "linux-x86_64",
"displayName": "Linux x86_64",
"description": "Build for Linux x86_64",
"inherits": ["template"],
"binaryDir": "${sourceDir}/build_x86_64",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"generator": "Ninja",
"warnings": {"dev": true, "deprecated": true},
"cacheVariables": {
"QT_VERSION": "6",
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "linux-ci-x86_64",
"inherits": ["linux-x86_64"],
"displayName": "Linux x86_64 CI build",
"description": "Build for Linux x86_64 on CI",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_COMPILE_WARNING_AS_ERROR": true
}
},
{
"name": "linux-aarch64",
"displayName": "Linux aarch64",
"description": "Build for Linux aarch64",
"inherits": ["template"],
"binaryDir": "${sourceDir}/build_aarch64",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"generator": "Ninja",
"warnings": {"dev": true, "deprecated": true},
"cacheVariables": {
"QT_VERSION": "6",
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "linux-ci-aarch64",
"inherits": ["linux-aarch64"],
"displayName": "Linux aarch64 CI build",
"description": "Build for Linux aarch64 on CI",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_COMPILE_WARNING_AS_ERROR": true
}
}
],
"buildPresets": [
{
"name": "macos",
"configurePreset": "macos",
"displayName": "macOS Universal",
"description": "macOS build for Universal architectures",
"configuration": "Release"
},
{
"name": "macos-ci",
"configurePreset": "macos-ci",
"displayName": "macOS Universal CI",
"description": "macOS CI build for Universal architectures",
"configuration": "RelWithDebInfo"
},
{
"name": "windows-x64",
"configurePreset": "windows-x64",
"displayName": "Windows x64",
"description": "Windows build for x64",
"configuration": "RelWithDebInfo"
},
{
"name": "windows-ci-x64",
"configurePreset": "windows-ci-x64",
"displayName": "Windows x64 CI",
"description": "Windows CI build for x64 (RelWithDebInfo configuration)",
"configuration": "RelWithDebInfo"
},
{
"name": "linux-x86_64",
"configurePreset": "linux-x86_64",
"displayName": "Linux x86_64",
"description": "Linux build for x86_64",
"configuration": "RelWithDebInfo"
},
{
"name": "linux-ci-x86_64",
"configurePreset": "linux-ci-x86_64",
"displayName": "Linux x86_64 CI",
"description": "Linux CI build for x86_64",
"configuration": "RelWithDebInfo"
},
{
"name": "linux-aarch64",
"configurePreset": "linux-aarch64",
"displayName": "Linux aarch64",
"description": "Linux build for aarch64",
"configuration": "RelWithDebInfo"
},
{
"name": "linux-ci-aarch64",
"configurePreset": "linux-ci-aarch64",
"displayName": "Linux aarch64 CI",
"description": "Linux CI build for aarch64",
"configuration": "RelWithDebInfo"
}
]
}

View File

@ -1,5 +1,7 @@
An automation plugin for OBS Studio.
More information can be found in the [OBS forums](https://obsproject.com/forum/resources/automatic-scene-switching.395/) or the plugin's [wiki](https://github.com/WarmUpTill/SceneSwitcher/wiki).
# SceneSwitcher
An automation plugin for OBS Studio.
More information can be found on https://obsproject.com/forum/resources/automatic-scene-switching.395/.
## Downloads
@ -9,21 +11,27 @@ Binaries for Windows, MacOS, and Linux are available in the [Releases](https://g
For the **Windows** and **MacOS** platforms, it is recommended to run the provided installers.
On Linux the plugin is available via the **Flatpak** package manager for users who installed OBS via Flatpak:
For **Linux** the **Snap** package manager offers an OBS Studio installation which is bundled with the plugin:
```
sudo snap install obs-studio
```
The plugin is also available via the **Flatpak** package manager for users who installed OBS via Flatpak:
```
flatpak install com.obsproject.Studio.Plugin.SceneSwitcher
```
The **Snap** package manager offers an OBS Studio installation which is bundled with the plugin:
Also note that the Linux version of this plugin has the following dependencies to `XTest`, `XScreensaver` and optionally `OpenCV`.
If `apt` is supported on your system they can be installed using:
```
sudo snap install obs-studio
sudo apt-get install \
libxtst-dev \
libxss-dev \
libprocps-dev \
libopencv-dev
```
More information can be found [here](https://github.com/WarmUpTill/SceneSwitcher/wiki/Installation).
## Contributing
- If you wish to contribute code to the project, have a look at this [section](BUILDING.md) describing how to compile the plugin.
- You can add custom conditions and actions at runtime using the API described [here](https://github.com/WarmUpTill/SceneSwitcher/wiki/Scripting).
- You can optionally use [pre-commit](https://pre-commit.com) to automatically handle formatting.
- If you wish to contribute translations, feel free to submit pull requests for the corresponding files under `data/locale`.

View File

@ -1,3 +0,0 @@
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
if (( _loglevel > 2 )) print -PR -e -- "${CI:+::debug::}%F{220}DEBUG: ${@}%f"

View File

@ -1,3 +0,0 @@
local icon=' ✖︎ '
print -u2 -PR "${CI:+::error::}%F{1} ${icon} %f ${@}"

View File

@ -1,16 +0,0 @@
autoload -Uz log_info
if (( ! ${+_log_group} )) typeset -g _log_group=0
if (( ${+CI} )) {
if (( _log_group )) {
print "::endgroup::"
typeset -g _log_group=0
}
if (( # )) {
print "::group::${@}"
typeset -g _log_group=1
}
} else {
if (( # )) log_info ${@}
}

View File

@ -1,7 +0,0 @@
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
if (( _loglevel > 0 )) {
local icon=' =>'
print -PR "%F{4} ${(r:5:)icon}%f %B${@}%b"
}

View File

@ -1,7 +0,0 @@
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
if (( _loglevel > 0 )) {
local icon=''
print -PR " ${(r:5:)icon} ${@}"
}

View File

@ -1,7 +0,0 @@
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
if (( _loglevel > 0 )) {
local icon=' >'
print -PR "%F{2} ${(r:5:)icon}%f ${@}"
}

View File

@ -1,7 +0,0 @@
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
if (( _loglevel > 0 )) {
local icon=' =>'
print -PR "${CI:+::warning::}%F{3} ${(r:5:)icon} ${@}%f"
}

View File

@ -1,17 +0,0 @@
autoload -Uz log_debug log_error
local -r _usage="Usage: %B${0}%b <loglevel>
Set log level, following levels are supported: 0 (quiet), 1 (normal), 2 (verbose), 3 (debug)"
if (( ! # )); then
log_error 'Called without arguments.'
log_output ${_usage}
return 2
elif (( ${1} >= 4 )); then
log_error 'Called with loglevel > 3.'
log_output ${_usage}
fi
typeset -g -i -r _loglevel=${1}
log_debug "Log level set to '${1}'"

View File

@ -1,197 +0,0 @@
#!/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 "%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
invoke_formatter() {
if (( # < 1 )) {
log_error "Usage invoke_formatter [formatter_name]"
exit 2
}
case ${1} {
clang)
if (( ${+commands[clang-format-16]} )) {
local formatter=clang-format-16
} elif (( ${+commands[clang-format]} )) {
local formatter=clang-format
local -a formatter_version=($(clang-format --version))
if ! is-at-least 16.0.5 ${formatter_version[-1]}; then
log_error "clang-format is not version 16.0.5 or above (found ${formatter_version[-1]}."
exit 2
fi
if ! is-at-least ${formatter_version[-1]} 16.0.5; then
log_error "clang-format is more recent than version 16.0.5 (found ${formatter_version[-1]})."
exit 2
fi
} else {
log_error "No viable clang-format version found (required 16.0.5)"
exit 2
}
local -a source_files=()
for folder ("lib" "module" "plugins" "tests") {
source_files+=(${folder}/**/*.(c|cpp|h|hpp)(.N))
}
for file (${source_files}) {
if [[ $file == *"catch.hpp" ]]; then
source_files=("${source_files[@]/$file}")
fi
}
local -a format_args=(-style=file -fallback-style=none)
if (( _loglevel > 2 )) format_args+=(--verbose)
;;
cmake)
local formatter=cmake-format
if (( ${+commands[cmake-format]} )) {
local cmake_format_version=$(cmake-format --version)
if ! is-at-least 0.6.13 ${cmake_format_version}; then
log_error "cmake-format is not version 0.6.13 or above (found ${cmake_format_version})."
exit 2
fi
} else {
log_error "No viable cmake-format version found (required 0.6.13)"
exit 2
}
local -a source_files=(**/(CMakeLists.txt|*.cmake)(.N))
source_files=(${source_files:#(build_*)/*})
local -a format_args=()
if (( _loglevel > 2 )) format_args+=(--log-level debug)
;;
swift)
local formatter=swift-format
if (( ${+commands[swift-format]} )) {
local swift_format_version=$(swift-format --version)
if ! is-at-least 508.0.0 ${swift_format_version}; then
log_error "swift-format is not version 508.0.0 or above (found ${swift_format_version})."
exit 2
fi
} else {
log_error "No viable swift-format version found (required 508.0.0)"
exit 2
}
local -a source_files=(**/*.swift(.N))
local -a format_args=()
;;
*) log_error "Invalid formatter specified: ${1}. Valid options are clang-format, cmake-format, and swift-format."; exit 2 ;;
}
local file
local -i num_failures=0
if (( check_only )) {
for file (${source_files}) {
if (( _loglevel > 1 )) log_info "Checking format of ${file}..."
if ! "${formatter}" ${format_args} "${file}" | diff -q "${file}" - &> /dev/null; then
log_error "${file} requires formatting changes."
if (( fail_on_error == 2 )) return 2;
num_failures=$(( num_failures + 1 ))
else
if (( _loglevel > 1 )) log_status "${file} requires no formatting changes."
fi
}
if (( fail_on_error && num_failures )) return 2;
} elif (( ${#source_files} )) {
format_args+=(-i)
"${formatter}" ${format_args} ${source_files}
}
}
run_format() {
if (( ! ${+SCRIPT_HOME} )) typeset -g SCRIPT_HOME=${ZSH_ARGZERO:A:h}
if (( ! ${+FORMATTER_NAME} )) typeset -g FORMATTER_NAME=${${(s:-:)ZSH_ARGZERO:t:r}[2]}
typeset -g host_os=${${(L)$(uname -s)}//darwin/macos}
local -i fail_on_error=0
local -i check_only=0
local -i verbosity=1
local -r _version='1.0.0'
fpath=("${SCRIPT_HOME}/.functions" ${fpath})
autoload -Uz log_info log_error log_output set_loglevel log_status log_warning
local -r _usage="
Usage: %B${functrace[1]%:*}%b <option>
%BOptions%b:
%F{yellow} Formatting options%f
-----------------------------------------------------------------------------
%B-c | --check%b Check only, no actual formatting takes place
%F{yellow} Output options%f
-----------------------------------------------------------------------------
%B-v | --verbose%b Verbose (more detailed output)
%B--fail-[never|error] Fail script never/on formatting change - default: %B%F{green}never%f%b
%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"
local -a args
while (( # )) {
case ${1} {
--)
shift
args+=($@)
break
;;
-c|--check) check_only=1; shift ;;
-v|--verbose) (( _verbosity += 1 )); shift ;;
-h|--help) log_output ${_usage}; exit 0 ;;
-V|--version) print -Pr "${_version}"; exit 0 ;;
--debug) verbosity=3; shift ;;
--fail-never)
fail_on_error=0
shift
;;
--fail-error)
fail_on_error=1
shift
;;
--fail-fast)
fail_on_error=2
shift
;;
*) log_error "Unknown option: %B${1}%b"; log_output ${_usage}; exit 2 ;;
}
}
set -- ${(@)args}
set_loglevel ${verbosity}
invoke_formatter ${FORMATTER_NAME}
}
run_format ${@}

View File

@ -1,168 +0,0 @@
#!/usr/bin/env python3
import argparse
import os
import re
import sys
defaultLocaleFile = "en-US.ini"
commentChars = ";#"
class localeEntry:
locale = ""
widgetPlaceholders = []
qStringArgs = []
lineNum = -1
def __init__(self, locale, widgetPlaceholders, qStringArgs, lineNum) -> None:
self.locale = locale
self.widgetPlaceholders = widgetPlaceholders
self.qStringArgs = qStringArgs
self.lineNum = lineNum
def isCommentLine(line):
for char in commentChars:
if line.startswith(char):
return True
return False
def getNonDefaultLocales(dir):
files = []
for filename in os.listdir(dir):
f = os.path.join(dir, filename)
if os.path.isfile(f) and not f.endswith(defaultLocaleFile):
files.append(f)
return files
def getAllLocaleEntries(file):
localeEntries = []
with open(file, "r", encoding="UTF-8") as f:
for lineNum, line in enumerate(f):
widgetPlaceholders = []
qStringArgs = []
if isCommentLine(line):
continue
for word in line.split("{{"):
if not "}}" in word:
continue
placeholder = "{{" + word[: word.rfind("}}")] + "}}"
widgetPlaceholders.append(placeholder)
for match in re.finditer(r"%\d+", line):
qStringArgs.append(match.group(0))
localeEntries.append(
localeEntry(
line.split("=")[0], widgetPlaceholders, qStringArgs, lineNum + 1
)
)
return localeEntries
def getLocaleEntryFrom(entry, list):
for element in list:
if element.locale == entry.locale:
return element
return None
def checkLocaleEntries(file, expectedLocaleEntries):
localeEntries = getAllLocaleEntries(file)
result = True
for localeEntry in localeEntries:
expectedLocaleEntry = getLocaleEntryFrom(localeEntry, expectedLocaleEntries)
if expectedLocaleEntry is None:
result = False
print(
'ERROR: Locale entry "{}" from "{}:{}" not found in "{}"'.format(
localeEntry.locale, file, localeEntry.lineNum, defaultLocaleFile
)
)
continue
for placeholder in localeEntry.widgetPlaceholders:
if placeholder not in expectedLocaleEntry.widgetPlaceholders:
result = False
print(
'ERROR: Locale entry "{}" from "{}:{}" does contain "{}" widget placeholder while "{}:{}" does not'.format(
localeEntry.locale,
file,
localeEntry.lineNum,
placeholder,
defaultLocaleFile,
expectedLocaleEntry.lineNum,
)
)
for placeholder in expectedLocaleEntry.widgetPlaceholders:
if placeholder not in localeEntry.widgetPlaceholders:
result = False
print(
'ERROR: Locale entry "{}" from "{}:{}" does not contain "{}" widget placeholder'.format(
localeEntry.locale, file, localeEntry.lineNum, placeholder
)
)
for arg in localeEntry.qStringArgs:
if arg not in expectedLocaleEntry.qStringArgs:
result = False
print(
'ERROR: Locale entry "{}" from "{}:{}" does contain "{}" QString arg while "{}:{}" does not'.format(
localeEntry.locale,
file,
localeEntry.lineNum,
arg,
defaultLocaleFile,
expectedLocaleEntry.lineNum,
)
)
for arg in expectedLocaleEntry.qStringArgs:
if arg not in localeEntry.qStringArgs:
result = False
print(
'ERROR: Locale entry "{}" from "{}:{}" does not contain "{}" QString arg'.format(
localeEntry.locale, file, localeEntry.lineNum, arg
)
)
return result
def main():
parser = argparse.ArgumentParser(
description="Checks for inconsistencies regarding widget placeholders in the different locale files."
)
parser.add_argument("-p", "--path", help="Path to locale folder", required=True)
args = parser.parse_args()
defaultLocaleEntries = getAllLocaleEntries(
os.path.join(args.path, defaultLocaleFile)
)
nonDefaultLocales = getNonDefaultLocales(args.path)
result = True
for file in nonDefaultLocales:
if checkLocaleEntries(file, defaultLocaleEntries) == False:
result = False
if result == False:
sys.exit(1)
print("SUCCESS: No issues found!")
sys.exit(0)
if __name__ == "__main__":
main()

View File

@ -1,126 +0,0 @@
#!/usr/bin/env bash
# Usage: demote_deps.sh <in.deb> [Recommends|Suggests] [regex]
# Example: demote_deps.sh build/advanced-scene-switcher_1.31.0_amd64.deb Recommends 'opencv'
set -euo pipefail
if [[ $# -lt 1 ]]; then
echo "Usage: $0 <in.deb> [Recommends|Suggests] [regex]" >&2
exit 1
fi
IN_DEB="$1"
DEST_FIELD="${2:-Recommends}" # Recommends or Suggests
MATCH_REGEX="${3:-opencv}" # regex to match packages to demote
echo "Demoting dependencies matching '${MATCH_REGEX}' to ${DEST_FIELD}"
TMPDIR="$(mktemp -d)"
trap 'rm -rf "$TMPDIR"' EXIT
dpkg-deb -R "$IN_DEB" "$TMPDIR"
CONTROL="$TMPDIR/DEBIAN/control"
# Read a field (single line value), handling continuation lines starting with a space.
get_field() {
local key="$1"
awk -v key="$key" '
BEGIN { val=""; collecting=0 }
$0 ~ "^" key ":" {
collecting=1
sub("^" key ":[[:space:]]*", "", $0)
val=$0
next
}
collecting==1 {
if ($0 ~ "^[[:space:]]") {
sub("^[[:space:]]+", "", $0)
val = val " " $0
next
} else {
collecting=0
}
}
END { print val }
' "$CONTROL"
}
# Split a comma-separated list into lines, trimming whitespace
split_csv() {
tr ',' '\n' | sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//' | sed '/^$/d'
}
# Join with ", "
join_csv() {
awk 'BEGIN{first=1}{ if(!first) printf(", "); printf("%s",$0); first=0 } END{print ""}'
}
# Deduplicate while preserving order
dedup() {
awk '!seen[$0]++'
}
DEPENDS_VAL="$(get_field Depends)"
EXIST_DEST_VAL="$(get_field "$DEST_FIELD")"
# Separate opencv-matching vs the rest (preserve tokens exactly)
mapfile -t DEPENDS_ARR < <(printf "%s\n" "$DEPENDS_VAL" | split_csv)
declare -a MOVED=()
declare -a KEPT=()
for item in "${DEPENDS_ARR[@]}"; do
# Skip empty just in case
[[ -z "$item" ]] && continue
if [[ "$item" =~ $MATCH_REGEX ]]; then
MOVED+=("$item")
else
KEPT+=("$item")
fi
done
# Merge with existing dest field
if [[ -n "$EXIST_DEST_VAL" ]]; then
mapfile -t EXIST_DEST_ARR < <(printf "%s\n" "$EXIST_DEST_VAL" | split_csv)
MOVED+=("${EXIST_DEST_ARR[@]}")
fi
# De-duplicate
mapfile -t MOVED < <(printf "%s\n" "${MOVED[@]:-}" | sed '/^$/d' | dedup)
mapfile -t KEPT < <(printf "%s\n" "${KEPT[@]:-}" | sed '/^$/d' | dedup)
# Rebuild values
NEW_DEPENDS="$(printf "%s\n" "${KEPT[@]:-}" | join_csv || true)"
NEW_DEST="$(printf "%s\n" "${MOVED[@]:-}" | join_csv || true)"
# Write a cleaned control (remove existing Depends/Recommends/Suggests incl. continuations)
awk '
BEGIN { skip=0 }
{
if ($0 ~ "^(Depends|Recommends|Suggests):") { skip=1; next }
if (skip==1) {
if ($0 ~ "^[[:space:]]") { next } else { skip=0 }
}
print
}
' "$CONTROL" > "$CONTROL.clean"
# Append the rebuilt fields
{
cat "$CONTROL.clean"
if [[ -n "$NEW_DEPENDS" ]]; then
echo "Depends: $NEW_DEPENDS"
fi
if [[ -n "$NEW_DEST" ]]; then
echo "$DEST_FIELD: $NEW_DEST"
fi
} > "$CONTROL.new"
# Clean up empty lines
sed -i '/^[[:space:]]*$/d' "$CONTROL.new"
mv "$CONTROL.new" "$CONTROL"
rm -f "$CONTROL.clean"
# Repack
rm -f "${IN_DEB}"
OUT_DEB="${IN_DEB}"
dpkg-deb -b "$TMPDIR" "$OUT_DEB" >/dev/null
echo "$OUT_DEB"

View File

@ -1 +0,0 @@
.run-format.zsh

View File

@ -1 +0,0 @@
.run-format.zsh

View File

@ -1 +0,0 @@
.run-format.zsh

View File

@ -1,48 +1,83 @@
{
"dependencies": {
"obs-studio": {
"version": "31.1.1",
"baseUrl": "https://github.com/obsproject/obs-studio/archive/refs/tags",
"label": "OBS sources",
"hashes": {
"macos": "39751f067bacc13d44b116c5138491b5f1391f91516d3d590d874edd21292291",
"windows-x64": "2c8427c10b55ac6d68008df2e9a3e82f4647aaad18f105e30d4713c2de678ccf"
}
"version": "28.0.1",
"repository": "https://github.com/obsproject/obs-studio.git",
"branch": "master",
"hash": "e8dc70d0eef4503378d6ac300e680215eb5c9379"
},
"prebuilt": {
"version": "2025-07-11",
"version": "2022-08-02",
"baseUrl": "https://github.com/obsproject/obs-deps/releases/download",
"label": "Pre-Built obs-deps",
"label": "Pre-built obs-deps",
"hashes": {
"macos": "495687e63383d1a287684b6e2e9bfe246bb8f156fe265926afb1a325af1edd2a",
"windows-x64": "c8c642c1070dc31ce9a0f1e4cef5bb992f4bff4882255788b5da12129e85caa7"
"macos-x86_64": "7637e52305e6fc53014b5aabd583f1a4490b1d97450420e977cae9a336a29525",
"macos-arm64": "755e0fa69b17a3ae444e1befa9d91d77e3cafe628fbd1c6333686091826595cd",
"macos-universal": "de057e73e6fe0825664c258ca2dd6798c41ae580bf4d896e1647676a4941934a",
"windows-x64": "2192d8ce780c4281b807cd457994963669e5202659ecd92f19b54c3e7d0c1915",
"windows-x86": "9f8582ab5891b000869d6484ea591add9fbac9f1c91b56c7b85fdfd56a261c1b"
}
},
"qt5": {
"version": "2022-08-02",
"baseUrl": "https://github.com/obsproject/obs-deps/releases/download",
"label": "Pre-built Qt5",
"hashes": {
"macos-x86_64": "3d0381a52b0e4d49967936c4357f79ac711f43564329304a6db5c90edadd2697",
"macos-arm64": "f4b32548c0530f121956bf0a9a70c36ecbbfca81073d39c396a1759baf2a05c3",
"macos-universal": "9a6cf3b9a6c9efee6ba10df649202e8075e99f3c54ae88dc9a36dbc9d7471c1e",
"windows-x64": "6488a33a474f750d5a4a268a5e20c78bb40799d99136a1b7ce3365a843cb2fd7",
"windows-x86": "a916e09b0a874036801deab2c8a7ec14fdf5d268aa5511eac5bf40727e0c4e33"
},
"pdb-hashes": {
"windows-x64": "e0e5070143fcad9311a68ce5685d8ba8f34f581ed6942b7a92d360f94ca1ba11",
"windows-x86": "36642d1052aa461964f46c17610477b0d9b9defbe2d745ccaacb85f805c1bec2"
}
},
"qt6": {
"version": "2025-07-11",
"version": "2022-08-02",
"baseUrl": "https://github.com/obsproject/obs-deps/releases/download",
"label": "Pre-Built Qt6",
"label": "Pre-built Qt6",
"hashes": {
"macos": "d3f5f04b6ea486e032530bdf0187cbda9a54e0a49621a4c8ba984c5023998867",
"windows-x64": "0e76bf0555dd5382838850b748d3dcfab44a1e1058441309ab54e1a65b156d0a"
"macos-x86_64": "a83f72a11023b03b6cb2dc365f0a66ad9df31163bbb4fe2df32d601856a9fad3",
"macos-arm64": "2f30af90c049670a5660656adbb440668aa1b0567f75a5f29e1def9108928403",
"macos-universal": "252e6684f43ab9c6f262c73af739e2296ce391b998da2c4ee04c254aaa07db18",
"windows-x64": "e5509b54196a3f935250cc4b9c54160c8e588fd0f92bc078a2a64f9d9e2e4e93",
"windows-x86": "24fc03bef153a0e027c1479e42eb08097a4ea1d70a4710825be0783d0626cb0d"
},
"debugSymbols": {
"windows-x64": "11b7be92cf66a273299b8f3515c07a5cfb61614b59a4e67f7fc5ecba5e2bdf21"
"pdb-hashes": {
"windows-x64": "60e5b1d2bc4d7c431bc05f14e3b1e85e088788c372fa85f58717cd6c49555a46",
"windows-x86": "f34d1a89fc85d92913bd6c7f75ec5c28471d74db708c98161100bc8b75f8fc63"
}
}
},
"platformConfig": {
"macos": {
"bundleId": "com.warmuptill.advanced-scene-switcher"
"macos-x86_64": {
"qtVersion": 6,
"deploymentTarget": "10.15"
},
"macos-arm64": {
"qtVersion": 6,
"deploymentTarget": "11.0"
},
"macos-universal": {
"qtVersion": 6,
"deploymentTarget": "10.15"
},
"windows-x64": {
"qtVersion": 6,
"visualStudio": "Visual Studio 17 2022",
"platformSDK": "10.0.20348.0"
},
"windows-x86": {
"qtVersion": 6,
"visualStudio": "Visual Studio 17 2022",
"platformSDK": "10.0.20348.0"
},
"linux-x86_64": {
"qtVersion": 6
}
},
"name": "advanced-scene-switcher",
"displayName": "Advanced Scene Switcher",
"version": "1.0.0",
"author": "WarmUpTill",
"website": "https://github.com/WarmUpTill/SceneSwitcher",
"email": "noone@nothing.com",
"uuids": {
"windowsApp": "A4ADDF26-4426-4D2E-B26A-C7C878DA8FC9"
}
"version": "1.0.0"
}

View File

@ -1,18 +1,18 @@
# --- Helper functions ---#
if(BUILD_OUT_OF_TREE)
if(OS_WINDOWS)
set(OBS_PLUGIN_DESTINATION "obs-plugins/64bit")
else()
set(OBS_PLUGIN_DESTINATION "${CMAKE_INSTALL_LIBDIR}/obs-plugins")
endif()
endif()
# Subfolder for advanced scene switcher plugins
set(_PLUGIN_FOLDER "adv-ss-plugins")
# --- MACOS section ---
if(OS_MACOS)
set(ADVSS_BUNDLE_DIR "advanced-scene-switcher.plugin")
set(ADVSS_BUNDLE_DIR "${CMAKE_INSTALL_PREFIX}/advanced-scene-switcher.plugin")
set(ADVSS_BUNDLE_MODULE_DIR "${ADVSS_BUNDLE_DIR}/Contents/MacOS")
set(ADVSS_BUNDLE_PLUGIN_DIR ${ADVSS_BUNDLE_MODULE_DIR}/${ADVSS_PLUGIN_FOLDER})
set(ADVSS_BUNDLE_PLUGIN_DIR ${ADVSS_BUNDLE_MODULE_DIR}/${_PLUGIN_FOLDER})
function(resign_advss target)
set(_COMMAND "codesign --force --deep --sign - ${ADVSS_BUNDLE_DIR}")
install(CODE "execute_process(COMMAND /bin/sh -c \"${_COMMAND}\")")
endfunction()
function(install_advss_lib_helper target where)
install(
@ -20,19 +20,17 @@ if(OS_MACOS)
RUNTIME DESTINATION "${where}" COMPONENT advss_plugins
LIBRARY DESTINATION "${where}" COMPONENT advss_plugins
FRAMEWORK DESTINATION "${where}" COMPONENT advss_plugins)
resign_advss(${target})
endfunction()
function(install_advss_lib target)
install_advss_lib_helper(${target} "${ADVSS_BUNDLE_MODULE_DIR}")
# Tell the advanced scene switcher plugin where to find the lib
string(JSON _name GET ${buildspec} name)
add_custom_command(
TARGET ${_name}
POST_BUILD
COMMAND
${CMAKE_INSTALL_NAME_TOOL} -change @rpath/$<TARGET_FILE_NAME:${target}>
@loader_path/$<TARGET_FILE_NAME:${target}> $<TARGET_FILE:${_name}>)
set(_COMMAND
"${CMAKE_INSTALL_NAME_TOOL} \\
-change @rpath/advanced-scene-switcher-lib.so @loader_path/advanced-scene-switcher-lib.so \\
\\\"${ADVSS_BUNDLE_MODULE_DIR}/advanced-scene-switcher\\\"")
install(CODE "execute_process(COMMAND /bin/sh -c \"${_COMMAND}\")"
COMPONENT obs_plugins)
endfunction()
function(install_advss_plugin target)
@ -55,38 +53,14 @@ if(OS_MACOS)
${dep}_Runtime
NAMELINK_COMPONENT
${dep}_Development)
resign_advss(${target})
endfunction()
function(install_advss_plugin_dependency_file target dep)
get_filename_component(_FILENAME ${dep} NAME)
string(REGEX REPLACE "\\.[^.]*$" "" _FILENAMENOEXT ${_FILENAME})
set(_DEP_NAME "${target}-${_FILENAMENOEXT}")
install(
FILES "${dep}"
DESTINATION "${ADVSS_BUNDLE_PLUGIN_DIR}"
COMPONENT ${_DEP_NAME}_Runtime
DESTINATION "${ADVSS_BUNDLE_PLUGIN_DIR}"
COMPONENT ${_DEP_NAME}_Runtime
NAMELINK_COMPONENT ${_DEP_NAME}_Development)
install(
FILES "${dep}"
DESTINATION "${ADVSS_BUNDLE_PLUGIN_DIR}"
COMPONENT obs_${_DEP_NAME}
EXCLUDE_FROM_ALL
DESTINATION "${ADVSS_BUNDLE_PLUGIN_DIR}"
COMPONENT obs_${_DEP_NAME}
EXCLUDE_FROM_ALL)
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND
"${CMAKE_COMMAND}" --install ${CMAKE_CURRENT_BINARY_DIR} --config
$<CONFIG> --prefix ${CMAKE_INSTALL_PREFIX} --component obs_${_DEP_NAME}
COMMENT "Installing ${_DEP_NAME} to OBS rundir\n"
VERBATIM)
function(install_advss_plugin_dependency_file ${target} dep)
target_sources(advanced-scene-switcher PRIVATE ${dep})
set_source_files_properties(${dep} PROPERTIES MACOSX_PACKAGE_LOCATION
${ADVSS_BUNDLE_PLUGIN_DIR})
resign_advss(${target})
endfunction()
# --- End of section ---
@ -103,10 +77,11 @@ else()
else()
install(
TARGETS ${what}
RUNTIME DESTINATION "${where}" COMPONENT ${what}_Runtime
LIBRARY DESTINATION "${where}"
COMPONENT ${what}_Runtime
NAMELINK_COMPONENT ${what}_Development
RUNTIME DESTINATION "${where}")
NAMELINK_COMPONENT ${what}_Development)
install(
FILES $<TARGET_FILE:${what}>
DESTINATION $<CONFIG>/${where}
@ -127,33 +102,30 @@ else()
COMPONENT ${what}_rundir
OPTIONAL EXCLUDE_FROM_ALL)
endif()
if(OBS_OUTPUT_DIR)
add_custom_command(
TARGET ${what}
POST_BUILD
COMMAND
"${CMAKE_COMMAND}" -DCMAKE_INSTALL_PREFIX=${OBS_OUTPUT_DIR}
-DCMAKE_INSTALL_COMPONENT=${what}_rundir
-DCMAKE_INSTALL_CONFIG_NAME=$<CONFIG> -P
${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake
COMMENT
"Installing ${what} to plugin rundir ${OBS_OUTPUT_DIR}/${where}\n"
VERBATIM)
endif()
add_custom_command(
TARGET ${what}
POST_BUILD
COMMAND
"${CMAKE_COMMAND}" -DCMAKE_INSTALL_PREFIX=${OBS_OUTPUT_DIR}
-DCMAKE_INSTALL_COMPONENT=${what}_rundir
-DCMAKE_INSTALL_CONFIG_NAME=$<CONFIG> -P
${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake
COMMENT "Installing ${what} to plugin rundir ${OBS_OUTPUT_DIR}/${where}\n"
VERBATIM)
endfunction()
function(install_advss_lib target)
plugin_install_helper("${target}" "${OBS_PLUGIN_DESTINATION}" "")
if(NOT OS_WINDOWS)
if(OS_POSIX)
set_target_properties(${target} PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
endfunction()
function(install_advss_plugin target)
plugin_install_helper(
"${target}" "${OBS_PLUGIN_DESTINATION}/${ADVSS_PLUGIN_FOLDER}"
"${ADVSS_PLUGIN_FOLDER}")
if(NOT OS_WINDOWS)
"${target}" "${OBS_PLUGIN_DESTINATION}/${_PLUGIN_FOLDER}"
"${_PLUGIN_FOLDER}")
if(OS_POSIX)
set_target_properties(${target} PROPERTIES INSTALL_RPATH
"$ORIGIN:$ORIGIN/..")
endif()
@ -166,12 +138,12 @@ else()
${dep}
RUNTIME
DESTINATION
"${OBS_PLUGIN_DESTINATION}/${ADVSS_PLUGIN_FOLDER}"
"${OBS_PLUGIN_DESTINATION}/${_PLUGIN_FOLDER}"
COMPONENT
${dep}_Runtime
LIBRARY
DESTINATION
"${OBS_PLUGIN_DESTINATION}/${ADVSS_PLUGIN_FOLDER}"
"${OBS_PLUGIN_DESTINATION}/${_PLUGIN_FOLDER}"
COMPONENT
${dep}_Runtime
NAMELINK_COMPONENT
@ -182,13 +154,13 @@ else()
${dep}
RUNTIME
DESTINATION
"${OBS_PLUGIN_DESTINATION}/${ADVSS_PLUGIN_FOLDER}"
"${OBS_PLUGIN_DESTINATION}/${_PLUGIN_FOLDER}"
COMPONENT
obs_${dep}
EXCLUDE_FROM_ALL
LIBRARY
DESTINATION
"${OBS_PLUGIN_DESTINATION}/${ADVSS_PLUGIN_FOLDER}"
"${OBS_PLUGIN_DESTINATION}/${_PLUGIN_FOLDER}"
COMPONENT
obs_${dep}
EXCLUDE_FROM_ALL)
@ -211,18 +183,18 @@ else()
install(
FILES "${dep}"
DESTINATION "${OBS_PLUGIN_DESTINATION}/${ADVSS_PLUGIN_FOLDER}"
DESTINATION "${OBS_PLUGIN_DESTINATION}/${_PLUGIN_FOLDER}"
COMPONENT ${_DEP_NAME}_Runtime
DESTINATION "${OBS_PLUGIN_DESTINATION}/${ADVSS_PLUGIN_FOLDER}"
DESTINATION "${OBS_PLUGIN_DESTINATION}/${_PLUGIN_FOLDER}"
COMPONENT ${_DEP_NAME}_Runtime
NAMELINK_COMPONENT ${_DEP_NAME}_Development)
install(
FILES "${dep}"
DESTINATION "${OBS_PLUGIN_DESTINATION}/${ADVSS_PLUGIN_FOLDER}"
DESTINATION "${OBS_PLUGIN_DESTINATION}/${_PLUGIN_FOLDER}"
COMPONENT obs_${_DEP_NAME}
EXCLUDE_FROM_ALL
DESTINATION "${OBS_PLUGIN_DESTINATION}/${ADVSS_PLUGIN_FOLDER}"
DESTINATION "${OBS_PLUGIN_DESTINATION}/${_PLUGIN_FOLDER}"
COMPONENT obs_${_DEP_NAME}
EXCLUDE_FROM_ALL)
@ -283,14 +255,8 @@ endfunction()
function(setup_advss_plugin target)
setup_obs_lib_dependency(${target})
find_package(Qt6 REQUIRED COMPONENTS Widgets Core)
target_link_libraries(${target} PRIVATE Qt6::Core Qt6::Widgets)
# Ignore QCheckBox::stateChanged deprecation warning until minimum supported
# Qt version is at least Qt 6.7, which introduces QCheckBox::checkStateChanged
if(Qt6_VERSION VERSION_GREATER "6.7.0")
target_compile_definitions(${target} PRIVATE QT_NO_DEPRECATED_WARNINGS)
endif()
find_qt(COMPONENTS Widgets Core)
target_link_libraries(${target} PRIVATE Qt::Core Qt::Widgets)
set_target_properties(
${target}
@ -298,19 +264,15 @@ function(setup_advss_plugin target)
AUTOUIC ON
AUTORCC ON)
target_compile_features(${target} PUBLIC cxx_std_17)
set_target_properties(${target} PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_link_libraries(${target} PRIVATE advanced-scene-switcher-lib)
get_target_property(ADVSS_SOURCE_DIR advanced-scene-switcher-lib SOURCE_DIR)
get_target_property(ADVSS_BINARY_DIR advanced-scene-switcher-lib BINARY_DIR)
if(OS_MACOS)
set(_COMMAND
"${CMAKE_INSTALL_NAME_TOOL} -add_rpath @loader_path \\\"$<TARGET_FILE:${target}>\\\""
)
install(CODE "execute_process(COMMAND /bin/sh -c \"${_COMMAND}\")")
set(_INSTALL_RPATH "@loader_path" "@loader_path/..")
set_target_properties(${target} PROPERTIES INSTALL_RPATH
"${_INSTALL_RPATH}")
endif()
# Set up include directories for headers generated by Qt
@ -328,9 +290,9 @@ function(setup_advss_plugin target)
# General includes
target_include_directories(
${target}
PRIVATE "${ADVSS_SOURCE_DIR}/lib" "${ADVSS_SOURCE_DIR}/lib/legacy"
"${ADVSS_SOURCE_DIR}/lib/macro" "${ADVSS_SOURCE_DIR}/lib/utils"
"${ADVSS_SOURCE_DIR}/lib/variables" "${ADVSS_SOURCE_DIR}/forms")
PRIVATE "${ADVSS_SOURCE_DIR}/src" "${ADVSS_SOURCE_DIR}/src/legacy"
"${ADVSS_SOURCE_DIR}/src/macro-core"
"${ADVSS_SOURCE_DIR}/src/utils" "${ADVSS_SOURCE_DIR}/forms")
endfunction()
function(install_advss_plugin_dependency)
@ -338,6 +300,7 @@ function(install_advss_plugin_dependency)
if(NOT PARSED_ARGS_TARGET)
message(FATAL_ERROR "You must provide a target")
endif()
set(_PLUGIN_FOLDER "adv-ss-plugins")
foreach(_DEPENDENCY ${PARSED_ARGS_DEPENDENCIES})
if(EXISTS ${_DEPENDENCY})
install_advss_plugin_dependency_file(${PARSED_ARGS_TARGET} ${_DEPENDENCY})

View File

@ -64,7 +64,7 @@ function(_git_find_closest_git_dir _start_dir _git_dir_var)
while(NOT EXISTS "${git_dir}")
# .git dir not found, search parent directories
set(git_previous_parent "${cur_dir}")
get_filename_component(cur_dir "${cur_dir}" DIRECTORY)
get_filename_component(cur_dir ${cur_dir} DIRECTORY)
if(cur_dir STREQUAL git_previous_parent)
# We have reached the root directory, we are not in git
set(${_git_dir_var}
@ -148,7 +148,7 @@ function(get_git_head_revision _refspecvar _hashvar)
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${HEAD_SOURCE_FILE}" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/get_git_revision_description.cmake.in"
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake" @ONLY)
include("${GIT_DATA}/grabRef.cmake")

Some files were not shown because too many files have changed in this diff Show More