mirror of
https://github.com/royshil/obs-localvocal.git
synced 2026-01-09 12:28:05 -05:00
Initial commit
This commit is contained in:
108
.clang-format
Normal file
108
.clang-format
Normal file
@@ -0,0 +1,108 @@
|
||||
# please use clang-format version 8 or later
|
||||
|
||||
Standard: Cpp11
|
||||
AccessModifierOffset: -8
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
#AllowAllArgumentsOnNextLine: false # requires clang-format 9
|
||||
#AllowAllConstructorInitializersOnNextLine: false # requires clang-format 9
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
#AllowShortLambdasOnASingleLine: Inline # requires clang-format 9
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakStringLiterals: false # apparently unpredictable
|
||||
ColumnLimit: 80
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
FixNamespaceComments: false
|
||||
ForEachMacros:
|
||||
- 'json_object_foreach'
|
||||
- 'json_object_foreach_safe'
|
||||
- 'json_array_foreach'
|
||||
- 'HASH_ITER'
|
||||
IncludeBlocks: Preserve
|
||||
IndentCaseLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 8
|
||||
IndentWrappedFunctionNames: false
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
#ObjCBinPackProtocolList: Auto # requires clang-format 7
|
||||
ObjCBlockIndentWidth: 8
|
||||
ObjCSpaceAfterProperty: true
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
|
||||
PenaltyBreakAssignment: 10
|
||||
PenaltyBreakBeforeFirstCallParameter: 30
|
||||
PenaltyBreakComment: 10
|
||||
PenaltyBreakFirstLessLess: 0
|
||||
PenaltyBreakString: 10
|
||||
PenaltyExcessCharacter: 100
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
|
||||
PointerAlignment: Right
|
||||
ReflowComments: false
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: false
|
||||
SpaceAfterCStyleCast: false
|
||||
#SpaceAfterLogicalNot: false # requires clang-format 9
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
#SpaceBeforeCtorInitializerColon: true # requires clang-format 7
|
||||
#SpaceBeforeInheritanceColon: true # requires clang-format 7
|
||||
SpaceBeforeParens: ControlStatements
|
||||
#SpaceBeforeRangeBasedForLoopColon: true # requires clang-format 7
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
#StatementMacros: # requires clang-format 8
|
||||
# - 'Q_OBJECT'
|
||||
TabWidth: 8
|
||||
#TypenameMacros: # requires clang-format 9
|
||||
# - 'DARRAY'
|
||||
UseTab: ForContinuationAndIndentation
|
||||
---
|
||||
Language: ObjC
|
||||
40
.cmake-format.json
Normal file
40
.cmake-format.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"format": {
|
||||
"line_width": 120,
|
||||
"tab_size": 2,
|
||||
"enable_sort": true,
|
||||
"autosort": true
|
||||
},
|
||||
"additional_commands": {
|
||||
"find_qt": {
|
||||
"flags": [],
|
||||
"kwargs": {
|
||||
"COMPONENTS": "+",
|
||||
"COMPONENTS_WIN": "+",
|
||||
"COMPONENTS_MACOS": "+",
|
||||
"COMPONENTS_LINUX": "+"
|
||||
}
|
||||
},
|
||||
"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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
106
.github/actions/build-plugin/action.yaml
vendored
Normal file
106
.github/actions/build-plugin/action.yaml
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
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 }})
|
||||
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 }}'
|
||||
}
|
||||
|
||||
.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
|
||||
112
.github/actions/package-plugin/action.yaml
vendored
Normal file
112
.github/actions/package-plugin/action.yaml
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
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: ''
|
||||
codesignUser:
|
||||
description: 'Apple ID username for notarization (macOS only)'
|
||||
required: false
|
||||
default: ''
|
||||
codesignPass:
|
||||
description: 'Apple ID password for notarization (macOS only)'
|
||||
required: false
|
||||
default: ''
|
||||
package:
|
||||
description: 'Create Windows or macOS installation package'
|
||||
required: false
|
||||
default: 'false'
|
||||
workingDirectory:
|
||||
description: 'Working directory for packaging'
|
||||
required: false
|
||||
default: ${{ github.workspace }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Run macOS Packaging
|
||||
if: runner.os == 'macOS'
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
working-directory: ${{ inputs.workingDirectory }}
|
||||
env:
|
||||
CODESIGN_IDENT: ${{ inputs.codesignIdent }}
|
||||
CODESIGN_IDENT_INSTALLER: ${{ inputs.installerIdent }}
|
||||
CODESIGN_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
|
||||
61
.github/actions/run-clang-format/action.yaml
vendored
Normal file
61
.github/actions/run-clang-format/action.yaml
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
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@13/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-13
|
||||
brew install --quiet obsproject/tools/clang-format@13
|
||||
echo ::endgroup::
|
||||
|
||||
echo ::group::Run clang-format-13
|
||||
./build-aux/run-clang-format --fail-${{ inputs.failCondition }} --check
|
||||
echo ::endgroup::
|
||||
}
|
||||
59
.github/actions/run-cmake-format/action.yaml
vendored
Normal file
59
.github/actions/run-cmake-format/action.yaml
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
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::
|
||||
}
|
||||
154
.github/actions/setup-macos-codesigning/action.yaml
vendored
Normal file
154
.github/actions/setup-macos-codesigning/action.yaml
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
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} | sha1sum | 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
|
||||
}
|
||||
6
.github/scripts/.Aptfile
vendored
Normal file
6
.github/scripts/.Aptfile
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
package 'cmake'
|
||||
package 'ccache'
|
||||
package 'git'
|
||||
package 'jq'
|
||||
package 'ninja-build', bin: 'ninja'
|
||||
package 'pkg-config'
|
||||
6
.github/scripts/.Brewfile
vendored
Normal file
6
.github/scripts/.Brewfile
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
brew "ccache"
|
||||
brew "coreutils"
|
||||
brew "cmake"
|
||||
brew "git"
|
||||
brew "jq"
|
||||
brew "xcbeautify"
|
||||
2
.github/scripts/.Wingetfile
vendored
Normal file
2
.github/scripts/.Wingetfile
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
package 'cmake', path: 'Cmake\bin', bin: 'cmake'
|
||||
package 'innosetup', path: 'Inno Setup 6', bin: 'iscc'
|
||||
292
.github/scripts/.build.zsh
vendored
Executable file
292
.github/scripts/.build.zsh
vendored
Executable file
@@ -0,0 +1,292 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
builtin emulate -L zsh
|
||||
setopt EXTENDED_GLOB
|
||||
setopt PUSHD_SILENT
|
||||
setopt ERR_EXIT
|
||||
setopt ERR_RETURN
|
||||
setopt NO_UNSET
|
||||
setopt PIPE_FAIL
|
||||
setopt NO_AUTO_PUSHD
|
||||
setopt NO_PUSHD_IGNORE_DUPS
|
||||
setopt FUNCTION_ARGZERO
|
||||
|
||||
## Enable for script debugging
|
||||
# setopt WARN_CREATE_GLOBAL
|
||||
# setopt WARN_NESTED_VAR
|
||||
# setopt XTRACE
|
||||
|
||||
autoload -Uz is-at-least && if ! is-at-least 5.2; then
|
||||
print -u2 -PR "${CI:+::error::}%F{1}${funcstack[1]##*/}:%f Running on Zsh version %B${ZSH_VERSION}%b, but Zsh %B5.2%b is the minimum supported version. Upgrade Zsh to fix this issue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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 "
|
||||
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 project_root=${SCRIPT_HOME:A:h:h}
|
||||
local buildspec_file=${project_root}/buildspec.json
|
||||
|
||||
fpath=("${SCRIPT_HOME}/utils.zsh" ${fpath})
|
||||
autoload -Uz log_group log_info log_error log_output set_loglevel check_${host_os} setup_ccache
|
||||
|
||||
if [[ ! -r ${buildspec_file} ]] {
|
||||
log_error \
|
||||
'No buildspec.json found. Please create a build specification for your project.'
|
||||
return 2
|
||||
}
|
||||
|
||||
typeset -g -a skips=()
|
||||
local -i verbosity=1
|
||||
local -r _version='2.0.0'
|
||||
local -r -a _valid_targets=(
|
||||
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 ]] {
|
||||
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>]
|
||||
|
||||
%BOptions%b:
|
||||
|
||||
%F{yellow} Build configuration options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-t | --target%b Specify target
|
||||
%B-c | --config%b Build configuration
|
||||
%B--skip-[all|build|deps]%b Skip all|building|checking for dependencies
|
||||
|
||||
%F{yellow} Output options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-q | --quiet%b Quiet (error output only)
|
||||
%B-v | --verbose%b Verbose (more detailed output)
|
||||
%B--debug%b Debug (very detailed and added output)
|
||||
|
||||
%F{yellow} General options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-h | --help%b Print this usage help
|
||||
%B-V | --version%b Print script version information
|
||||
${_usage_host:-}"
|
||||
|
||||
local -a args
|
||||
while (( # )) {
|
||||
case ${1} {
|
||||
-t|--target|-c|--config|--generator)
|
||||
if (( # == 1 )) || [[ ${2:0:1} == '-' ]] {
|
||||
log_error "Missing value for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
;;
|
||||
}
|
||||
case ${1} {
|
||||
--)
|
||||
shift
|
||||
args+=($@)
|
||||
break
|
||||
;;
|
||||
-t|--target)
|
||||
if (( ! ${_valid_targets[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
target=${2}
|
||||
shift 2
|
||||
;;
|
||||
-c|--config)
|
||||
if (( ! ${_valid_configs[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
config=${2}
|
||||
shift 2
|
||||
;;
|
||||
-s|--codesign) codesign=1; shift ;;
|
||||
-q|--quiet) (( verbosity -= 1 )) || true; shift ;;
|
||||
-v|--verbose) (( verbosity += 1 )); shift ;;
|
||||
-h|--help) log_output ${_usage}; exit 0 ;;
|
||||
-V|--version) print -Pr "${_version}"; exit 0 ;;
|
||||
--debug) verbosity=3; shift ;;
|
||||
--generator)
|
||||
if [[ ${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}
|
||||
}
|
||||
shift 2
|
||||
;;
|
||||
--print-config) print_config=1; skips+=(deps); shift ;;
|
||||
--skip-*)
|
||||
local -r _skip="${${(s:-:)1}[-1]}"
|
||||
local -r -a _check=(all build deps)
|
||||
(( ${_check[(Ie)${_skip}]} )) || log_warning "Invalid skip mode %B${_skip}%b supplied"
|
||||
typeset -g -a skips=(${skips} ${_skip})
|
||||
shift
|
||||
;;
|
||||
*) log_error "Unknown option: %B${1}%b"; log_output ${_usage}; exit 2 ;;
|
||||
}
|
||||
}
|
||||
|
||||
: "${target:="${host_os}-${CPUTYPE}"}"
|
||||
|
||||
set -- ${(@)args}
|
||||
set_loglevel ${verbosity}
|
||||
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
|
||||
check_${host_os}
|
||||
setup_ccache
|
||||
}
|
||||
|
||||
if [[ ${host_os} == linux ]] {
|
||||
autoload -Uz setup_linux && setup_linux
|
||||
}
|
||||
|
||||
local product_name
|
||||
local product_version
|
||||
read -r product_name product_version <<< \
|
||||
"$(jq -r '. | {name, version} | join(" ")' ${buildspec_file})"
|
||||
|
||||
pushd ${project_root}
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)build]}) )) {
|
||||
log_group "Configuring ${product_name}..."
|
||||
|
||||
local -a cmake_args=()
|
||||
local -a cmake_build_args=(--build)
|
||||
local -a cmake_install_args=(--install)
|
||||
|
||||
case ${_loglevel} {
|
||||
0) cmake_args+=(-Wno_deprecated -Wno-dev --log-level=ERROR) ;;
|
||||
1) ;;
|
||||
2) cmake_build_args+=(--verbose) ;;
|
||||
*) cmake_args+=(--debug-output) ;;
|
||||
}
|
||||
|
||||
local -r _preset="${target%%-*}${CI:+-ci}"
|
||||
case ${target} {
|
||||
macos-*)
|
||||
if (( ${+CI} )) typeset -gx NSUnbufferedIO=YES
|
||||
|
||||
cmake_args+=(
|
||||
--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}
|
||||
|
||||
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_group "Installing ${product_name}..."
|
||||
if (( _loglevel > 1 )) cmake_install_args+=(--verbose)
|
||||
cmake ${cmake_install_args}
|
||||
popd
|
||||
log_group
|
||||
}
|
||||
|
||||
build ${@}
|
||||
274
.github/scripts/.package.zsh
vendored
Executable file
274
.github/scripts/.package.zsh
vendored
Executable file
@@ -0,0 +1,274 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
builtin emulate -L zsh
|
||||
setopt EXTENDED_GLOB
|
||||
setopt PUSHD_SILENT
|
||||
setopt ERR_EXIT
|
||||
setopt ERR_RETURN
|
||||
setopt NO_UNSET
|
||||
setopt PIPE_FAIL
|
||||
setopt NO_AUTO_PUSHD
|
||||
setopt NO_PUSHD_IGNORE_DUPS
|
||||
setopt FUNCTION_ARGZERO
|
||||
|
||||
## Enable for script debugging
|
||||
# setopt WARN_CREATE_GLOBAL
|
||||
# setopt WARN_NESTED_VAR
|
||||
# setopt XTRACE
|
||||
|
||||
autoload -Uz is-at-least && if ! is-at-least 5.2; then
|
||||
print -u2 -PR "${CI:+::error::}%F{1}${funcstack[1]##*/}:%f Running on Zsh version %B${ZSH_VERSION}%b, but Zsh %B5.2%b is the minimum supported version. Upgrade Zsh to fix this issue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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 "
|
||||
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 project_root=${SCRIPT_HOME:A:h:h}
|
||||
local buildspec_file=${project_root}/buildspec.json
|
||||
|
||||
fpath=("${SCRIPT_HOME}/utils.zsh" ${fpath})
|
||||
autoload -Uz set_loglevel log_info log_group 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 -r -a _valid_targets=(
|
||||
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>]
|
||||
|
||||
%BOptions%b:
|
||||
|
||||
%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
|
||||
|
||||
%F{yellow} Output options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-q | --quiet%b Quiet (error output only)
|
||||
%B-v | --verbose%b Verbose (more detailed output)
|
||||
%B--debug%b Debug (very detailed and added output)
|
||||
|
||||
%F{yellow} General options%f
|
||||
-----------------------------------------------------------------------------
|
||||
%B-h | --help%b Print this usage help
|
||||
%B-V | --version%b Print script version information
|
||||
${_usage_host:-}"
|
||||
|
||||
local -a args
|
||||
while (( # )) {
|
||||
case ${1} {
|
||||
-t|--target|-c|--config)
|
||||
if (( # == 1 )) || [[ ${2:0:1} == '-' ]] {
|
||||
log_error "Missing value for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
;;
|
||||
}
|
||||
case ${1} {
|
||||
--)
|
||||
shift
|
||||
args+=($@)
|
||||
break
|
||||
;;
|
||||
-t|--target)
|
||||
if (( ! ${_valid_targets[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
target=${2}
|
||||
shift 2
|
||||
;;
|
||||
-c|--config)
|
||||
if (( !${_valid_configs[(Ie)${2}]} )) {
|
||||
log_error "Invalid value %B${2}%b for option %B${1}%b"
|
||||
log_output ${_usage}
|
||||
exit 2
|
||||
}
|
||||
config=${2}
|
||||
shift 2
|
||||
;;
|
||||
-s|--codesign) 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 ;;
|
||||
-h|--help) log_output ${_usage}; exit 0 ;;
|
||||
-V|--version) print -Pr "${_version}"; exit 0 ;;
|
||||
--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}
|
||||
|
||||
if (( ! skip_deps )) {
|
||||
check_${host_os}
|
||||
}
|
||||
|
||||
local product_name
|
||||
local product_version
|
||||
read -r product_name product_version <<< \
|
||||
"$(jq -r '. | {name, version} | join(" ")' ${buildspec_file})"
|
||||
|
||||
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"
|
||||
|
||||
if [[ ! -d ${project_root}/release/${config}/${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 (( package )) {
|
||||
if [[ ! -f ${project_root}/build_macos/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
|
||||
}
|
||||
|
||||
check_packages
|
||||
|
||||
log_group "Packaging ${product_name}..."
|
||||
pushd ${project_root}
|
||||
packagesbuild \
|
||||
--build-folder ${project_root}/release/${config} \
|
||||
${project_root}/build_macos/installer-macos.generated.pkgproj
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
popd
|
||||
} else {
|
||||
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
|
||||
|
||||
if (( package )) {
|
||||
log_group "Packaging ${product_name}..."
|
||||
pushd ${project_root}
|
||||
cmake --build build_${target##*-} --config ${config} -t package ${cmake_args}
|
||||
popd
|
||||
} else {
|
||||
log_group "Archiving ${product_name}..."
|
||||
local output_name="${product_name}-${product_version}-${target##*-}-linux-gnu"
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
package ${@}
|
||||
105
.github/scripts/Build-Windows.ps1
vendored
Normal file
105
.github/scripts/Build-Windows.ps1
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[ValidateSet('x64')]
|
||||
[string] $Target = 'x64',
|
||||
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
|
||||
[string] $Configuration = 'RelWithDebInfo',
|
||||
[switch] $SkipAll,
|
||||
[switch] $SkipBuild,
|
||||
[switch] $SkipDeps
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
if ( $DebugPreference -eq 'Continue' ) {
|
||||
$VerbosePreference = '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
|
||||
}
|
||||
|
||||
function Build {
|
||||
trap {
|
||||
Pop-Location -Stack BuildTemp -ErrorAction 'SilentlyContinue'
|
||||
Write-Error $_
|
||||
Log-Group
|
||||
exit 2
|
||||
}
|
||||
|
||||
$ScriptHome = $PSScriptRoot
|
||||
$ProjectRoot = Resolve-Path -Path "$PSScriptRoot/../.."
|
||||
$BuildSpecFile = "${ProjectRoot}/buildspec.json"
|
||||
|
||||
$UtilityFunctions = Get-ChildItem -Path $PSScriptRoot/utils.pwsh/*.ps1 -Recurse
|
||||
|
||||
foreach($Utility in $UtilityFunctions) {
|
||||
Write-Debug "Loading $($Utility.FullName)"
|
||||
. $Utility.FullName
|
||||
}
|
||||
|
||||
$BuildSpec = Get-Content -Path ${BuildSpecFile} -Raw | ConvertFrom-Json
|
||||
$ProductName = $BuildSpec.name
|
||||
$ProductVersion = $BuildSpec.version
|
||||
|
||||
if ( ! $SkipDeps ) {
|
||||
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
|
||||
}
|
||||
|
||||
Push-Location -Stack BuildTemp
|
||||
if ( ! ( ( $SkipAll ) -or ( $SkipBuild ) ) ) {
|
||||
Ensure-Location $ProjectRoot
|
||||
|
||||
$CmakeArgs = @()
|
||||
$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
|
||||
|
||||
Log-Group "Building ${ProductName}..."
|
||||
Invoke-External cmake @CmakeBuildArgs
|
||||
}
|
||||
Log-Group "Install ${ProductName}..."
|
||||
Invoke-External cmake @CmakeInstallArgs
|
||||
|
||||
Pop-Location -Stack BuildTemp
|
||||
Log-Group
|
||||
}
|
||||
|
||||
Build
|
||||
96
.github/scripts/Package-Windows.ps1
vendored
Normal file
96
.github/scripts/Package-Windows.ps1
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[ValidateSet('x64')]
|
||||
[string] $Target = 'x64',
|
||||
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
|
||||
[string] $Configuration = 'RelWithDebInfo',
|
||||
[switch] $BuildInstaller,
|
||||
[switch] $SkipDeps
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
if ( $DebugPreference -eq 'Continue' ) {
|
||||
$VerbosePreference = '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'
|
||||
exit 2
|
||||
}
|
||||
|
||||
function Package {
|
||||
trap {
|
||||
Pop-Location -Stack BuildTemp -ErrorAction 'SilentlyContinue'
|
||||
Write-Error $_
|
||||
Log-Group
|
||||
exit 2
|
||||
}
|
||||
|
||||
$ScriptHome = $PSScriptRoot
|
||||
$ProjectRoot = Resolve-Path -Path "$PSScriptRoot/../.."
|
||||
$BuildSpecFile = "${ProjectRoot}/buildspec.json"
|
||||
|
||||
$UtilityFunctions = Get-ChildItem -Path $PSScriptRoot/utils.pwsh/*.ps1 -Recurse
|
||||
|
||||
foreach( $Utility in $UtilityFunctions ) {
|
||||
Write-Debug "Loading $($Utility.FullName)"
|
||||
. $Utility.FullName
|
||||
}
|
||||
|
||||
$BuildSpec = Get-Content -Path ${BuildSpecFile} -Raw | ConvertFrom-Json
|
||||
$ProductName = $BuildSpec.name
|
||||
$ProductVersion = $BuildSpec.version
|
||||
|
||||
$OutputName = "${ProductName}-${ProductVersion}-windows-${Target}"
|
||||
|
||||
if ( ! $SkipDeps ) {
|
||||
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
|
||||
}
|
||||
|
||||
$RemoveArgs = @{
|
||||
ErrorAction = 'SilentlyContinue'
|
||||
Path = @(
|
||||
"${ProjectRoot}/release/${ProductName}-*-windows-*.zip"
|
||||
"${ProjectRoot}/release/${ProductName}-*-windows-*.exe"
|
||||
)
|
||||
}
|
||||
|
||||
Remove-Item @RemoveArgs
|
||||
|
||||
if ( ( $BuildInstaller ) ) {
|
||||
Log-Group "Packaging ${ProductName}..."
|
||||
$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.'
|
||||
}
|
||||
|
||||
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
|
||||
Pop-Location -Stack BuildTemp
|
||||
} else {
|
||||
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
|
||||
}
|
||||
|
||||
Package
|
||||
1
.github/scripts/build-linux
vendored
Symbolic link
1
.github/scripts/build-linux
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
.build.zsh
|
||||
1
.github/scripts/build-macos
vendored
Symbolic link
1
.github/scripts/build-macos
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
.build.zsh
|
||||
1
.github/scripts/package-linux
vendored
Symbolic link
1
.github/scripts/package-linux
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
.package.zsh
|
||||
1
.github/scripts/package-macos
vendored
Symbolic link
1
.github/scripts/package-macos
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
.package.zsh
|
||||
29
.github/scripts/utils.pwsh/Ensure-Location.ps1
vendored
Normal file
29
.github/scripts/utils.pwsh/Ensure-Location.ps1
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
function Ensure-Location {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Ensures current location to be set to specified directory.
|
||||
.DESCRIPTION
|
||||
If specified directory exists, switch to it. Otherwise create it,
|
||||
then switch.
|
||||
.EXAMPLE
|
||||
Ensure-Location "My-Directory"
|
||||
Ensure-Location -Path "Path-To-My-Directory"
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string] $Path
|
||||
)
|
||||
|
||||
if ( ! ( Test-Path $Path ) ) {
|
||||
$_Params = @{
|
||||
ItemType = "Directory"
|
||||
Path = ${Path}
|
||||
ErrorAction = "SilentlyContinue"
|
||||
}
|
||||
|
||||
New-Item @_Params | Set-Location
|
||||
} else {
|
||||
Set-Location -Path ${Path}
|
||||
}
|
||||
}
|
||||
70
.github/scripts/utils.pwsh/Expand-ArchiveExt.ps1
vendored
Normal file
70
.github/scripts/utils.pwsh/Expand-ArchiveExt.ps1
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
function Expand-ArchiveExt {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Expands archive files.
|
||||
.DESCRIPTION
|
||||
Allows extraction of zip, 7z, gz, and xz archives.
|
||||
Requires tar and 7-zip to be available on the system.
|
||||
Archives ending with .zip but created using LZMA compression are
|
||||
expanded using 7-zip as a fallback.
|
||||
.EXAMPLE
|
||||
Expand-ArchiveExt -Path <Path-To-Your-Archive>
|
||||
Expand-ArchiveExt -Path <Path-To-Your-Archive> -DestinationPath <Expansion-Path>
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string] $Path,
|
||||
[string] $DestinationPath = [System.IO.Path]::GetFileNameWithoutExtension($Path),
|
||||
[switch] $Force
|
||||
)
|
||||
|
||||
switch ( [System.IO.Path]::GetExtension($Path) ) {
|
||||
.zip {
|
||||
try {
|
||||
Expand-Archive -Path $Path -DestinationPath $DestinationPath -Force:$Force
|
||||
} catch {
|
||||
if ( Get-Command 7z ) {
|
||||
Invoke-External 7z x -y $Path "-o${DestinationPath}"
|
||||
} else {
|
||||
throw "Fallback utility 7-zip not found. Please install 7-zip first."
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
{ ( $_ -eq ".7z" ) -or ( $_ -eq ".exe" ) } {
|
||||
if ( Get-Command 7z ) {
|
||||
Invoke-External 7z x -y $Path "-o${DestinationPath}"
|
||||
} else {
|
||||
throw "Extraction utility 7-zip not found. Please install 7-zip first."
|
||||
}
|
||||
break
|
||||
}
|
||||
.gz {
|
||||
try {
|
||||
Invoke-External tar -x -o $DestinationPath -f $Path
|
||||
} catch {
|
||||
if ( Get-Command 7z ) {
|
||||
Invoke-External 7z x -y $Path "-o${DestinationPath}"
|
||||
} else {
|
||||
throw "Fallback utility 7-zip not found. Please install 7-zip first."
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
.xz {
|
||||
try {
|
||||
Invoke-External tar -x -o $DestinationPath -f $Path
|
||||
} catch {
|
||||
if ( Get-Command 7z ) {
|
||||
Invoke-External 7z x -y $Path "-o${DestinationPath}"
|
||||
} else {
|
||||
throw "Fallback utility 7-zip not found. Please install 7-zip first."
|
||||
}
|
||||
}
|
||||
}
|
||||
default {
|
||||
throw "Unsupported archive extension provided."
|
||||
}
|
||||
}
|
||||
}
|
||||
70
.github/scripts/utils.pwsh/Install-BuildDependencies.ps1
vendored
Normal file
70
.github/scripts/utils.pwsh/Install-BuildDependencies.ps1
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
function Install-BuildDependencies {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs required build dependencies.
|
||||
.DESCRIPTION
|
||||
Additional packages might be needed for successful builds. This module contains additional
|
||||
dependencies available for installation via winget and, if possible, adds their locations
|
||||
to the environment path for future invocation.
|
||||
.EXAMPLE
|
||||
Install-BuildDependencies
|
||||
#>
|
||||
|
||||
param(
|
||||
[string] $WingetFile = "$PSScriptRoot/.Wingetfile"
|
||||
)
|
||||
|
||||
if ( ! ( Test-Path function:Log-Warning ) ) {
|
||||
. $PSScriptRoot/Logger.ps1
|
||||
}
|
||||
|
||||
$Prefixes = @{
|
||||
'x64' = ${Env:ProgramFiles}
|
||||
'x86' = ${Env:ProgramFiles(x86)}
|
||||
'arm64' = ${Env:ProgramFiles(arm)}
|
||||
}
|
||||
|
||||
$Paths = $Env:Path -split [System.IO.Path]::PathSeparator
|
||||
|
||||
$WingetOptions = @('install', '--accept-package-agreements', '--accept-source-agreements')
|
||||
|
||||
if ( $script:Quiet ) {
|
||||
$WingetOptions += '--silent'
|
||||
}
|
||||
|
||||
Log-Group 'Check Windows build requirements'
|
||||
Get-Content $WingetFile | ForEach-Object {
|
||||
$_, $Package, $_, $Path, $_, $Binary, $_, $Version = $_ -replace ',','' -split " +(?=(?:[^\']*\'[^\']*\')*[^\']*$)" -replace "'",''
|
||||
|
||||
$Prefixes.GetEnumerator() | ForEach-Object {
|
||||
$Prefix = $_.value
|
||||
$FullPath = "${Prefix}\${Path}"
|
||||
if ( ( Test-Path $FullPath ) -and ! ( $Paths -contains $FullPath ) ) {
|
||||
$Paths = @($FullPath) + $Paths
|
||||
$Env:Path = $Paths -join [System.IO.Path]::PathSeparator
|
||||
}
|
||||
}
|
||||
|
||||
Log-Debug "Checking for command ${Binary}"
|
||||
$Found = Get-Command -ErrorAction SilentlyContinue $Binary
|
||||
|
||||
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})
|
||||
}
|
||||
|
||||
try {
|
||||
$Params = $WingetOptions + $Package
|
||||
|
||||
winget @Params
|
||||
} catch {
|
||||
throw "Error while installing winget package ${Package}: $_"
|
||||
}
|
||||
}
|
||||
}
|
||||
Log-Group
|
||||
}
|
||||
40
.github/scripts/utils.pwsh/Invoke-External.ps1
vendored
Normal file
40
.github/scripts/utils.pwsh/Invoke-External.ps1
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
function Invoke-External {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Invokes a non-PowerShell command.
|
||||
.DESCRIPTION
|
||||
Runs a non-PowerShell command, and captures its return code.
|
||||
Throws an exception if the command returns non-zero.
|
||||
.EXAMPLE
|
||||
Invoke-External 7z x $MyArchive
|
||||
#>
|
||||
|
||||
if ( $args.Count -eq 0 ) {
|
||||
throw 'Invoke-External called without arguments.'
|
||||
}
|
||||
|
||||
if ( ! ( Test-Path function:Log-Information ) ) {
|
||||
. $PSScriptRoot/Logger.ps1
|
||||
}
|
||||
|
||||
$Command = $args[0]
|
||||
$CommandArgs = @()
|
||||
|
||||
if ( $args.Count -gt 1) {
|
||||
$CommandArgs = $args[1..($args.Count - 1)]
|
||||
}
|
||||
|
||||
$_EAP = $ErrorActionPreference
|
||||
$ErrorActionPreference = "Continue"
|
||||
|
||||
Log-Debug "Invoke-External: ${Command} ${CommandArgs}"
|
||||
|
||||
& $command $commandArgs
|
||||
$Result = $LASTEXITCODE
|
||||
|
||||
$ErrorActionPreference = $_EAP
|
||||
|
||||
if ( $Result -ne 0 ) {
|
||||
throw "${Command} ${CommandArgs} exited with non-zero code ${Result}."
|
||||
}
|
||||
}
|
||||
149
.github/scripts/utils.pwsh/Logger.ps1
vendored
Normal file
149
.github/scripts/utils.pwsh/Logger.ps1
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
function Log-Debug {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
foreach($m in $Message) {
|
||||
Write-Debug "$(if ( $env:CI -ne $null ) { '::debug::' })$m"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Verbose {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
foreach($m in $Message) {
|
||||
Write-Verbose $m
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Warning {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
foreach($m in $Message) {
|
||||
Write-Warning "$(if ( $env:CI -ne $null ) { '::warning::' })$m"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Error {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
foreach($m in $Message) {
|
||||
Write-Error "$(if ( $env:CI -ne $null ) { '::error::' })$m"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Information {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
if ( ! ( $script:Quiet ) ) {
|
||||
$StageName = $( if ( $script:StageName -ne $null ) { $script:StageName } else { '' })
|
||||
$Icon = ' =>'
|
||||
|
||||
foreach($m in $Message) {
|
||||
Write-Host -NoNewLine -ForegroundColor Blue " ${StageName} $($Icon.PadRight(5)) "
|
||||
Write-Host "${m}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Group {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(ValueFromPipeline)]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
if ( $Env:CI -ne $null ) {
|
||||
if ( $script:LogGroup ) {
|
||||
Write-Output '::endgroup::'
|
||||
$script:LogGroup = $false
|
||||
}
|
||||
|
||||
if ( $Message.count -ge 1 ) {
|
||||
Write-Output "::group::$($Message -join ' ')"
|
||||
$script:LogGroup = $true
|
||||
}
|
||||
} else {
|
||||
if ( $Message.count -ge 1 ) {
|
||||
Log-Information $Message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Status {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
if ( ! ( $script:Quiet ) ) {
|
||||
$StageName = $( if ( $StageName -ne $null ) { $StageName } else { '' })
|
||||
$Icon = ' >'
|
||||
|
||||
foreach($m in $Message) {
|
||||
Write-Host -NoNewLine -ForegroundColor Green " ${StageName} $($Icon.PadRight(5)) "
|
||||
Write-Host "${m}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Log-Output {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory,ValueFromPipeline)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]] $Message
|
||||
)
|
||||
|
||||
Process {
|
||||
if ( ! ( $script:Quiet ) ) {
|
||||
$StageName = $( if ( $script:StageName -ne $null ) { $script:StageName } else { '' })
|
||||
$Icon = ''
|
||||
|
||||
foreach($m in $Message) {
|
||||
Write-Output " ${StageName} $($Icon.PadRight(5)) ${m}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$Columns = (Get-Host).UI.RawUI.WindowSize.Width - 5
|
||||
61
.github/scripts/utils.zsh/check_linux
vendored
Normal file
61
.github/scripts/utils.zsh/check_linux
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
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
|
||||
}
|
||||
|
||||
log_debug 'Checking for apt-get...'
|
||||
if (( ! ${+commands[apt-get]} )) {
|
||||
log_error 'No apt-get command found. Please install apt'
|
||||
return 2
|
||||
} else {
|
||||
log_debug "Apt-get located at ${commands[apt-get]}"
|
||||
}
|
||||
|
||||
local -a dependencies=("${(fA)$(<${SCRIPT_HOME}/.Aptfile)}")
|
||||
local -a install_list
|
||||
local binary
|
||||
|
||||
sudo apt-get update -qq
|
||||
|
||||
for dependency (${dependencies}) {
|
||||
local -a tokens=(${=dependency//(,|:|\')/})
|
||||
|
||||
if [[ ! ${tokens[1]} == 'package' ]] continue
|
||||
|
||||
if [[ ${#tokens} -gt 2 && ${tokens[3]} == 'bin' ]] {
|
||||
binary=${tokens[4]}
|
||||
} else {
|
||||
binary=${tokens[2]}
|
||||
}
|
||||
|
||||
if (( ! ${+commands[${binary}]} )) install_list+=(${tokens[2]})
|
||||
}
|
||||
|
||||
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}
|
||||
}
|
||||
|
||||
rehash
|
||||
log_group
|
||||
22
.github/scripts/utils.zsh/check_macos
vendored
Normal file
22
.github/scripts/utils.zsh/check_macos
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
autoload -Uz is-at-least log_group 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
|
||||
log_error "Minimum required macOS version is 11.0, but running on macOS ${macos_version}"
|
||||
return 2
|
||||
else
|
||||
log_status "macOS ${macos_version} is recent"
|
||||
fi
|
||||
|
||||
log_info 'Checking for Homebrew...'
|
||||
if (( ! ${+commands[brew]} )) {
|
||||
log_error 'No Homebrew command found. Please install Homebrew (https://brew.sh)'
|
||||
return 2
|
||||
}
|
||||
|
||||
brew bundle --file ${SCRIPT_HOME}/.Brewfile
|
||||
rehash
|
||||
log_group
|
||||
62
.github/scripts/utils.zsh/check_packages
vendored
Normal file
62
.github/scripts/utils.zsh/check_packages
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
if (( ! ${+commands[packagesbuild]} )) {
|
||||
autoload -Uz log_group 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+=(--show-error --silent)
|
||||
} else {
|
||||
curl_opts+=(--progress-bar)
|
||||
}
|
||||
curl_opts+=(--location -O)
|
||||
|
||||
log_group 'Installing Packages.app...'
|
||||
|
||||
local version
|
||||
local base_url
|
||||
local hash
|
||||
IFS=';' read -r version base_url hash <<< \
|
||||
"$(jq -r '.tools.packages | {version, baseUrl, hash} | join(";")' buildspec.json)"
|
||||
|
||||
mkdir -p ${project_root}/.deps && pushd ${project_root}/.deps
|
||||
curl ${curl_opts} "${base_url}/Packages.dmg"
|
||||
|
||||
local checksum="$(sha256sum Packages.dmg | cut -d " " -f 1)"
|
||||
|
||||
if [[ ${hash} != ${checksum} ]] {
|
||||
log_error "Checksum mismatch of Packages.dmg download.
|
||||
Expected : ${hash}
|
||||
Actual : ${checksum}"
|
||||
return 2
|
||||
}
|
||||
|
||||
hdiutil attach -readonly -noverify -noautoopen -plist Packages.dmg > .result.plist
|
||||
local -i num_entities=$(( $(plutil -extract system-entities raw -- .result.plist) - 1 ))
|
||||
local keys
|
||||
local mount_point
|
||||
for i ({0..${num_entities}}) {
|
||||
keys=($(plutil -extract system-entities.${i} raw -- .result.plist))
|
||||
if [[ ${keys} == *mount-point* ]] {
|
||||
mount_point=$(plutil -extract system-entities.${i}.mount-point raw -- .result.plist)
|
||||
break
|
||||
}
|
||||
}
|
||||
rm .result.plist
|
||||
|
||||
log_status 'Installing Packages.app requires elevated privileges!'
|
||||
|
||||
sudo installer -pkg ${mount_point}/packages/Packages.pkg -target / && rehash
|
||||
hdiutil detach ${mount_point} &> /dev/null && log_status 'Packages.dmg image unmounted.'
|
||||
popd
|
||||
|
||||
log_group
|
||||
}
|
||||
3
.github/scripts/utils.zsh/log_debug
vendored
Normal file
3
.github/scripts/utils.zsh/log_debug
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 2 )) print -PR -e -- "${CI:+::debug::}%F{220}DEBUG: ${@}%f"
|
||||
3
.github/scripts/utils.zsh/log_error
vendored
Normal file
3
.github/scripts/utils.zsh/log_error
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
local icon=' ✖︎ '
|
||||
|
||||
print -u2 -PR "${CI:+::error::}%F{1} ${icon} %f ${@}"
|
||||
16
.github/scripts/utils.zsh/log_group
vendored
Normal file
16
.github/scripts/utils.zsh/log_group
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
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 ${@}
|
||||
}
|
||||
7
.github/scripts/utils.zsh/log_info
vendored
Normal file
7
.github/scripts/utils.zsh/log_info
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 0 )) {
|
||||
local icon=' =>'
|
||||
|
||||
print -PR "%F{4} ${(r:5:)icon}%f %B${@}%b"
|
||||
}
|
||||
7
.github/scripts/utils.zsh/log_output
vendored
Normal file
7
.github/scripts/utils.zsh/log_output
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 0 )) {
|
||||
local icon=''
|
||||
|
||||
print -PR " ${(r:5:)icon} ${@}"
|
||||
}
|
||||
7
.github/scripts/utils.zsh/log_status
vendored
Normal file
7
.github/scripts/utils.zsh/log_status
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 0 )) {
|
||||
local icon=' >'
|
||||
|
||||
print -PR "%F{2} ${(r:5:)icon}%f ${@}"
|
||||
}
|
||||
5
.github/scripts/utils.zsh/log_warning
vendored
Normal file
5
.github/scripts/utils.zsh/log_warning
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
if (( _loglevel > 0 )) {
|
||||
local icon=' =>'
|
||||
|
||||
print -PR "${CI:+::warning::}%F{3} ${(r:5:)icon} ${@}%f"
|
||||
}
|
||||
1
.github/scripts/utils.zsh/mkcd
vendored
Normal file
1
.github/scripts/utils.zsh/mkcd
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[[ -n ${1} ]] && mkdir -p ${1} && builtin cd ${1}
|
||||
9
.github/scripts/utils.zsh/read_codesign
vendored
Normal file
9
.github/scripts/utils.zsh/read_codesign
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
autoload -Uz log_info
|
||||
|
||||
if (( ! ${+CODESIGN_IDENT} )) {
|
||||
typeset -g CODESIGN_IDENT
|
||||
log_info 'Setting up Apple Developer ID for application codesigning...'
|
||||
read CODESIGN_IDENT'?Apple Developer Application ID: '
|
||||
}
|
||||
|
||||
typeset -g CODESIGN_TEAM=$(print "${CODESIGN_IDENT}" | /usr/bin/sed -En 's/.+\((.+)\)/\1/p')
|
||||
7
.github/scripts/utils.zsh/read_codesign_installer
vendored
Normal file
7
.github/scripts/utils.zsh/read_codesign_installer
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
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...'
|
||||
read CODESIGN_IDENT_INSTALLER'?Apple Developer Installer ID: '
|
||||
}
|
||||
38
.github/scripts/utils.zsh/read_codesign_pass
vendored
Normal file
38
.github/scripts/utils.zsh/read_codesign_pass
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
##############################################################################
|
||||
# Apple Developer credentials necessary:
|
||||
#
|
||||
# + Signing for distribution and notarization require an active Apple
|
||||
# Developer membership
|
||||
# + An Apple Development identity is needed for code signing
|
||||
# (i.e. 'Apple Development: YOUR APPLE ID (PROVIDER)')
|
||||
# + Your Apple developer ID is needed for notarization
|
||||
# + 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.
|
||||
##############################################################################
|
||||
|
||||
autoload -Uz read_codesign read_codesign_user log_info log_warning
|
||||
|
||||
if (( ! ${+CODESIGN_IDENT} )) {
|
||||
read_codesign
|
||||
}
|
||||
|
||||
if (( ! ${+CODESIGN_IDENT_USER} )) {
|
||||
read_codesign_user
|
||||
}
|
||||
|
||||
log_info 'Setting up password for notarization keychain...'
|
||||
if (( ! ${+CODESIGN_IDENT_PASS} )) {
|
||||
read -s CODESIGN_IDENT_PASS'?Apple Developer ID password: '
|
||||
}
|
||||
|
||||
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}"
|
||||
|
||||
7
.github/scripts/utils.zsh/read_codesign_team
vendored
Normal file
7
.github/scripts/utils.zsh/read_codesign_team
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
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): '
|
||||
}
|
||||
7
.github/scripts/utils.zsh/read_codesign_user
vendored
Normal file
7
.github/scripts/utils.zsh/read_codesign_user
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
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: '
|
||||
}
|
||||
17
.github/scripts/utils.zsh/set_loglevel
vendored
Normal file
17
.github/scripts/utils.zsh/set_loglevel
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
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}'"
|
||||
42
.github/scripts/utils.zsh/setup_ccache
vendored
Normal file
42
.github/scripts/utils.zsh/setup_ccache
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
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=run_second_cpp=true
|
||||
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 -z > /dev/null
|
||||
}
|
||||
} else {
|
||||
log_warning "No ccache found on the system"
|
||||
}
|
||||
65
.github/scripts/utils.zsh/setup_linux
vendored
Normal file
65
.github/scripts/utils.zsh/setup_linux
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
autoload -Uz log_error log_status log_info mkcd
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
pushd ${project_root}
|
||||
|
||||
typeset -g QT_VERSION
|
||||
|
||||
local -a apt_args=(
|
||||
${CI:+-y}
|
||||
--no-install-recommends
|
||||
)
|
||||
if (( _loglevel == 0 )) apt_args+=(--quiet)
|
||||
|
||||
if (( ! (${skips[(Ie)all]} + ${skips[(Ie)deps]}) )) {
|
||||
log_group 'Installing obs-studio 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} \
|
||||
build-essential \
|
||||
libgles2-mesa-dev \
|
||||
obs-studio
|
||||
|
||||
local -a _qt_packages=()
|
||||
|
||||
if (( QT_VERSION == 5 )) {
|
||||
_qt_packages+=(
|
||||
qtbase5-dev${suffix}
|
||||
libqt5svg5-dev${suffix}
|
||||
qtbase5-private-dev${suffix}
|
||||
libqt5x11extras5-dev${suffix}
|
||||
)
|
||||
} else {
|
||||
_qt_packages+=(
|
||||
qt6-base-dev${suffix}
|
||||
libqt6svg6-dev${suffix}
|
||||
qt6-base-private-dev${suffix}
|
||||
)
|
||||
}
|
||||
|
||||
sudo apt-get install ${apt_args} ${_qt_packages}
|
||||
log_group
|
||||
}
|
||||
262
.github/workflows/build-project.yaml
vendored
Normal file
262
.github/workflows/build-project.yaml
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
name: Build Project
|
||||
on:
|
||||
workflow_call:
|
||||
jobs:
|
||||
check-event:
|
||||
name: Check GitHub Event Data 📡
|
||||
runs-on: ubuntu-22.04
|
||||
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 }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
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:false' 'config:RelWithDebInfo')
|
||||
if gh pr view --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:true'
|
||||
config_data[3]='config:Release'
|
||||
fi
|
||||
;;
|
||||
workflow_dispatch)
|
||||
config_data=('codesign:true' 'notarize:false' 'package:false' '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
|
||||
|
||||
macos-build:
|
||||
name: Build for macOS 🍏
|
||||
runs-on: macos-13
|
||||
needs: check-event
|
||||
defaults:
|
||||
run:
|
||||
shell: zsh --no-rcs --errexit --pipefail {0}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
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'
|
||||
typeset -a to_remove=()
|
||||
|
||||
if (( #to_remove > 0 )) 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)"
|
||||
|
||||
print "pluginName=${product_name}" >> $GITHUB_OUTPUT
|
||||
print "pluginVersion=${product_version}" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v3
|
||||
id: ccache-cache
|
||||
with:
|
||||
path: ${{ github.workspace }}/.ccache
|
||||
key: ${{ runner.os }}-ccache-${{ needs.check-event.outputs.config }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-ccache-
|
||||
|
||||
- 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 }}
|
||||
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@v3
|
||||
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 }}-${{ steps.setup.outputs.pluginVersion }}-macos-universal.*
|
||||
|
||||
- name: Upload Debug Symbol Artifacts 🪲
|
||||
uses: actions/upload-artifact@v3
|
||||
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 }}-${{ steps.setup.outputs.pluginVersion }}-macos-universal-dSYMs.*
|
||||
|
||||
ubuntu-build:
|
||||
name: Build for Ubuntu 🐧
|
||||
runs-on: ubuntu-22.04
|
||||
needs: check-event
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set Up Environment 🔧
|
||||
id: setup
|
||||
run: |
|
||||
: Set Up Environment 🔧
|
||||
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
|
||||
|
||||
read -r product_name product_version <<< \
|
||||
"$(jq -r '. | {name, version} | join(" ")' buildspec.json)"
|
||||
|
||||
echo "pluginName=${product_name}" >> $GITHUB_OUTPUT
|
||||
echo "pluginVersion=${product_version}" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v3
|
||||
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 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: 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@v3
|
||||
with:
|
||||
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-sources-${{ needs.check-event.outputs.commitHash }}
|
||||
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-source.*
|
||||
|
||||
- name: Upload Artifacts 📡
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-ubuntu-22.04-x86_64-${{ needs.check-event.outputs.commitHash }}
|
||||
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-x86_64*.*
|
||||
|
||||
- name: Upload debug symbol artifacts 🪲
|
||||
uses: actions/upload-artifact@v3
|
||||
if: ${{ fromJSON(needs.check-event.outputs.package) }}
|
||||
with:
|
||||
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-ubuntu-22.04-x86_64-${{ needs.check-event.outputs.commitHash }}-dbgsym
|
||||
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-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@v3
|
||||
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
|
||||
$ProductVersion = $BuildSpec.version
|
||||
|
||||
"pluginName=${ProductName}" >> $env:GITHUB_OUTPUT
|
||||
"pluginVersion=${ProductVersion}" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Build Plugin 🧱
|
||||
uses: ./.github/actions/build-plugin
|
||||
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@v3
|
||||
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 }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64*.*
|
||||
27
.github/workflows/check-format.yaml
vendored
Normal file
27
.github/workflows/check-format.yaml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Check Code Formatting 🛠️
|
||||
on:
|
||||
workflow_call:
|
||||
jobs:
|
||||
clang-format:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
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-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: cmake-format check 🎛️
|
||||
id: cmake-format
|
||||
uses: ./.github/actions/run-cmake-format
|
||||
with:
|
||||
failCondition: error
|
||||
18
.github/workflows/dispatch.yaml
vendored
Normal file
18
.github/workflows/dispatch.yaml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
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
|
||||
27
.github/workflows/pr-pull.yaml
vendored
Normal file
27
.github/workflows/pr-pull.yaml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
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, labeled, unlabeled ]
|
||||
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
|
||||
122
.github/workflows/push.yaml
vendored
Normal file
122
.github/workflows/push.yaml
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
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-22.04
|
||||
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@v3
|
||||
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-22.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: OBS Studio ${{ 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
|
||||
26
.gitignore
vendored
Normal file
26
.gitignore
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# Exclude everything
|
||||
/*
|
||||
|
||||
# Except for default project files
|
||||
!/.github
|
||||
!/build-aux
|
||||
!/cmake
|
||||
!/data
|
||||
!/src
|
||||
!.clang-format
|
||||
!.cmake-format.json
|
||||
!.gitignore
|
||||
!buildspec.json
|
||||
!CMakeLists.txt
|
||||
!CMakePresets.json
|
||||
!LICENSE
|
||||
!README.md
|
||||
|
||||
# Exclude lock files
|
||||
*.lock.json
|
||||
|
||||
# Exclude macOS legacy resource forks
|
||||
.DS_Store
|
||||
|
||||
# Exclude CMake build number cache
|
||||
/cmake/.CMakeBuildNumber
|
||||
39
CMakeLists.txt
Normal file
39
CMakeLists.txt
Normal file
@@ -0,0 +1,39 @@
|
||||
cmake_minimum_required(VERSION 3.16...3.26)
|
||||
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake" NO_POLICY_SCOPE)
|
||||
|
||||
project(${_name} VERSION ${_version})
|
||||
|
||||
option(ENABLE_FRONTEND_API "Use obs-frontend-api for UI functionality" OFF)
|
||||
option(ENABLE_QT "Use Qt functionality" OFF)
|
||||
|
||||
include(compilerconfig)
|
||||
include(defaults)
|
||||
include(helpers)
|
||||
|
||||
add_library(${CMAKE_PROJECT_NAME} MODULE)
|
||||
|
||||
find_package(libobs REQUIRED)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE OBS::libobs)
|
||||
|
||||
if(ENABLE_FRONTEND_API)
|
||||
find_package(obs-frontend-api REQUIRED)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE OBS::obs-frontend-api)
|
||||
endif()
|
||||
|
||||
if(ENABLE_QT)
|
||||
find_qt(COMPONENTS Widgets Core)
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Qt::Core Qt::Widgets)
|
||||
target_compile_options(
|
||||
${CMAKE_PROJECT_NAME} PRIVATE $<$<C_COMPILER_ID:Clang,AppleClang>:-Wno-quoted-include-in-framework-header
|
||||
-Wno-comma>)
|
||||
set_target_properties(
|
||||
${CMAKE_PROJECT_NAME}
|
||||
PROPERTIES AUTOMOC ON
|
||||
AUTOUIC ON
|
||||
AUTORCC ON)
|
||||
endif()
|
||||
|
||||
target_sources(${CMAKE_PROJECT_NAME} PRIVATE src/plugin-main.c)
|
||||
|
||||
set_target_properties_plugin(${CMAKE_PROJECT_NAME} PROPERTIES OUTPUT_NAME ${_name})
|
||||
186
CMakePresets.json
Normal file
186
CMakePresets.json
Normal file
@@ -0,0 +1,186 @@
|
||||
{
|
||||
"version": 3,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 22,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "macos",
|
||||
"displayName": "macOS Universal",
|
||||
"description": "Build for macOS 11.0+ (Universal binary)",
|
||||
"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}",
|
||||
"ENABLE_FRONTEND_API": false,
|
||||
"ENABLE_QT": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"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",
|
||||
"ENABLE_FRONTEND_API": false,
|
||||
"ENABLE_QT": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"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",
|
||||
"ENABLE_FRONTEND_API": false,
|
||||
"ENABLE_QT": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"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",
|
||||
"ENABLE_FRONTEND_API": false,
|
||||
"ENABLE_QT": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
339
LICENSE
Normal file
339
LICENSE
Normal file
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{description}
|
||||
Copyright (C) {year} {fullname}
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
{signature of Ty Coon}, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
172
README.md
Normal file
172
README.md
Normal file
@@ -0,0 +1,172 @@
|
||||
# OBS Plugin Template
|
||||
|
||||
## Introduction
|
||||
|
||||
The plugin template is meant to be used as a starting point for OBS Studio plugin development. It includes:
|
||||
|
||||
* Boilerplate plugin source code
|
||||
* A CMake project file
|
||||
* GitHub Actions workflows and repository actions
|
||||
|
||||
## Set Up
|
||||
|
||||
The plugin project is set up using the included `buildspec.json` file. The following fields should be customized for an actual plugin:
|
||||
|
||||
* `name`: The plugin name
|
||||
* `version`: The plugin version
|
||||
* `author`: Actual name or nickname of the plugin's author
|
||||
* `website`: URL of a website associated with the plugin
|
||||
* `email`: Contact email address associated with the plugin
|
||||
* `uuids`
|
||||
* `macosPackage`: Unique (**!**) identifier for the macOS plugin package
|
||||
* `macosInstaller`: Unique (**!**) identifier for the macOS plugin installer
|
||||
* `windowsApp`: Unique (**!**) identifier for the Windows plugin installer
|
||||
|
||||
These values are read and processed automatically by the CMake build scripts, so no further adjustments in other files are needed.
|
||||
|
||||
### Platform Configuration
|
||||
|
||||
Platform-specific settings are set up in the `platformConfig` section of the buildspec file:
|
||||
|
||||
* `bundleId`: macOS bundle identifier for the plugin. Should be unique and follow reverse domain name notation.
|
||||
|
||||
### Set Up Build Dependencies
|
||||
|
||||
Just like OBS Studio itself, plugins need to be built using dependencies available either via the `obs-deps` repository (Windows and macOS) or via a distribution's package system (Linux).
|
||||
|
||||
#### Choose An OBS Studio Version
|
||||
|
||||
By default the plugin template specifies the most current official OBS Studio version in the `buildspec.json` file, which makes most sense for plugins at the start of development. As far as updating the targeted OBS Studio version is concerned, a few things need to be considered:
|
||||
|
||||
* Plugins targeting _older_ versions of OBS Studio should _generally_ also work in newer versions, with the exception of breaking changes to specific APIs which would also be explicitly called out in release notes
|
||||
* Plugins targeting the _latest_ version of OBS Studio might not work in older versions because the internal data structures used by `libobs` might not be compatible
|
||||
* Users are encouraged to always update to the most recent version of OBS Studio available within a reasonable time after release - plugin authors have to choose for themselves if they'd rather keep up with OBS Studio releases or stay with an older version as their baseline (which might of course preclude the plugin from using functionality introduced in a newer version)
|
||||
|
||||
On Linux, the version used for development might be decided by the specific version available via a distribution's package management system, so OBS Studio compatibility for plugins might be determined by those versions instead.
|
||||
|
||||
#### Windows and macOS
|
||||
|
||||
Windows and macOS dependency downloads are configured in the `buildspec.json` file:
|
||||
|
||||
* `dependencies`:
|
||||
* `obs-studio`: Version of OBS Studio to build plugin with (needed for `libobs` and `obs-frontend-api`)
|
||||
* `prebuilt`: Prebuilt OBS Studio dependencies
|
||||
* `qt6`: Prebuilt version of Qt6 as used by OBS Studio
|
||||
* `tools`: Contains additional build tools used by CI
|
||||
|
||||
The values should be kept in sync with OBS Studio releases and the `buildspec.json` file in use by the main project to ensure that the plugin is developed and built in sync with its target environment.
|
||||
|
||||
To update a dependency, change the `version` and associated `hashes` entries to match the new version. The used hash algorithm is `sha256`.
|
||||
|
||||
#### Linux
|
||||
|
||||
Linux dependencies need to be resolved using the package management tools appropriate for the local distribution. As an example, building on Ubuntu requires the following packages to be installed:
|
||||
|
||||
* Build System Dependencies:
|
||||
* `cmake`
|
||||
* `ninja-build`
|
||||
* `pkg-config`
|
||||
* Build Dependencies:
|
||||
* `build-essential`
|
||||
* `libobs-dev`
|
||||
* Qt6 Dependencies:
|
||||
* `qt6-base-dev`
|
||||
* `libqt6svg6-dev`
|
||||
* `qt6-base-private-dev`
|
||||
|
||||
## Build System Configuration
|
||||
|
||||
To create a build configuration, `cmake` needs to be installed on the system. The plugin template supports CMake presets using the `CMakePresets.json` file and ships with default presets:
|
||||
|
||||
* `macos`
|
||||
* Universal architecture (supports Intel-based CPUs as Apple Silicon)
|
||||
* Defaults to Qt version `6`
|
||||
* Defaults to macOS deployment target `11.0`
|
||||
* `macos-ci`
|
||||
* Inherits from `macos`
|
||||
* Enables compile warnings as error
|
||||
* `windows-x64`
|
||||
* Windows 64-bit architecture
|
||||
* Defaults to Qt version `6`
|
||||
* Defaults to Visual Studio 17 2022
|
||||
* Defaults to Windows SDK version `10.0.18363.657`
|
||||
* `windows-ci-x64`
|
||||
* Inherits from `windows-x64`
|
||||
* Enables compile warnings as error
|
||||
* `linux-x86_64`
|
||||
* Linux x86_64 architecture
|
||||
* Defaults to Qt version `6`
|
||||
* Defaults to Ninja as build tool
|
||||
* Defaults to `RelWithDebInfo` build configuration
|
||||
* `linux-ci-x86_64`
|
||||
* Inherits from `linux-x86_64`
|
||||
* Enables compile warnings as error
|
||||
* `linux-aarch64`
|
||||
* Provided as an experimental preview feature
|
||||
* Linux aarch64 (ARM64) architecture
|
||||
* Defaults to Qt version `6`
|
||||
* Defaults to Ninja as build tool
|
||||
* Defaults to `RelWithDebInfo` build configuration
|
||||
* `linux-ci-aarch64`
|
||||
* Inherits from `linux-aarch64`
|
||||
* Enables compile warnings as error
|
||||
|
||||
Presets can be either specified on the command line (`cmake --preset <PRESET>`) or via the associated select field in the CMake Windows GUI. Only presets appropriate for the current build host are available for selection.
|
||||
|
||||
Additional build system options are available to developers:
|
||||
|
||||
* `ENABLE_CCACHE`: Enables support for compilation speed-ups via ccache (enabled by default on macOS and Linux)
|
||||
* `ENABLE_FRONTEND_API`: Adds OBS Frontend API support for interactions with OBS Studio frontend functionality (disabled by default)
|
||||
* `ENABLE_QT`: Adds Qt6 support for custom user interface elements (disabled by default)
|
||||
* `CODESIGN_IDENTITY`: Name of the Apple Developer certificate that should be used for code signing
|
||||
* `CODESIGN_TEAM`: Apple Developer team ID that should be used for code signing
|
||||
|
||||
## GitHub Actions & CI
|
||||
|
||||
Default GitHub Actions workflows are available for the following repository actions:
|
||||
|
||||
* `push`: Run for commits or tags pushed to `master` or `main` branches.
|
||||
* `pr-pull`: Run when a Pull Request has been pushed or synchronized.
|
||||
* `dispatch`: Run when triggered by the workflow dispatch in GitHub's user interface.
|
||||
* `build-project`: Builds the actual project and is triggered by other workflows.
|
||||
* `check-format`: Checks CMake and plugin source code formatting and is triggered by other workflows.
|
||||
|
||||
The workflows make use of GitHub repository actions (contained in `.github/actions`) and build scripts (contained in `.github/scripts`) which are not needed for local development, but might need to be adjusted if additional/different steps are required to build the plugin.
|
||||
|
||||
### Retrieving build artifacts
|
||||
|
||||
Successful builds on GitHub Actions will produce build artifacts that can be downloaded for testing. These artifacts are commonly simple archives and will not contain package installers or installation programs.
|
||||
|
||||
### Building a Release
|
||||
|
||||
To create a release, an appropriately named tag needs to be pushed to the `main`/`master` branch using semantic versioning (e.g., `12.3.4`, `23.4.5-beta2`). A draft release will be created on the associated repository with generated installer packages or installation programs attached as release artifacts.
|
||||
|
||||
## Signing and Notarizing on macOS
|
||||
|
||||
Plugins released for macOS should be codesigned and notarized with a valid Apple Developer ID for best user experience. To set this up, the private and personal key of a **paid Apple Developer ID** need to be downloaded from the Apple Developer portal:
|
||||
|
||||
* On your Apple Developer dashboard, go to "Certificates, IDs & Profiles" and create two signing certificates:
|
||||
* One of the "Developer ID Application" type. It will be used to sign the plugin's binaries
|
||||
* One of the "Developer ID Installer" type. It will be used to sign the plugin's installer
|
||||
|
||||
The developer certificate will usually carry a name similar in form to
|
||||
|
||||
`Developer ID Application: <FIRSTNAME> <LASTNAME> (<LETTERS_AND_NUMBERS>)`
|
||||
|
||||
This entire string should be specified as `CODESIGN_IDENTITY`, the `LETTERS_AND_NUMBERS` part as `CODESIGN_TEAM` to CMake to set up codesigning properly.
|
||||
|
||||
### GitHub Actions Set Up
|
||||
|
||||
To use code signing on GitHub Actions, the certificate and associated information need to be set up as _repository secrets_ in the GitHub repository's settings.
|
||||
|
||||
* First, the locally stored developer certificate needs to be exported from the macOS keychain:
|
||||
* Using the Keychain app on macOS, export these your certificates (Application and Installer) public _and_ private keys into a single .p12 file **protected with a strong password**
|
||||
* Encode the .p12 file into its base64 representation by running `base64 <NAME_OF_YOUR_P12_FILE>`
|
||||
* Next, the certificate data and the password used to export it need to be set up as repository secrets:
|
||||
* `MACOS_SIGNING_APPLICATION_IDENTITY`: Name of the "Developer ID Application" signing certificate
|
||||
* `MACOS_SIGNING_INSTALLER_IDENTITY`: Name of "Developer ID Installer" signing certificate
|
||||
* `MACOS_SIGNING_CERT`: The base64 encoded `.p12` file
|
||||
* `MACOS_SIGNING_CERT_PASSWORD`: Password used to generate the .p12 certificate
|
||||
* To also enable notarization on GitHub Action runners, the following repository secrets are required:
|
||||
* `MACOS_NOTARIZATION_USERNAME`: Your Apple Developer account's _Apple ID_
|
||||
* `MACOS_NOTARIZATION_PASSWORD`: Your Apple Developer account's _generated app password_
|
||||
3
build-aux/.functions/log_debug
Normal file
3
build-aux/.functions/log_debug
Normal file
@@ -0,0 +1,3 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 2 )) print -PR -e -- "${CI:+::debug::}%F{220}DEBUG: ${@}%f"
|
||||
3
build-aux/.functions/log_error
Normal file
3
build-aux/.functions/log_error
Normal file
@@ -0,0 +1,3 @@
|
||||
local icon=' ✖︎ '
|
||||
|
||||
print -u2 -PR "${CI:+::error::}%F{1} ${icon} %f ${@}"
|
||||
16
build-aux/.functions/log_group
Normal file
16
build-aux/.functions/log_group
Normal file
@@ -0,0 +1,16 @@
|
||||
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 ${@}
|
||||
}
|
||||
7
build-aux/.functions/log_info
Normal file
7
build-aux/.functions/log_info
Normal file
@@ -0,0 +1,7 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 0 )) {
|
||||
local icon=' =>'
|
||||
|
||||
print -PR "%F{4} ${(r:5:)icon}%f %B${@}%b"
|
||||
}
|
||||
7
build-aux/.functions/log_output
Normal file
7
build-aux/.functions/log_output
Normal file
@@ -0,0 +1,7 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 0 )) {
|
||||
local icon=''
|
||||
|
||||
print -PR " ${(r:5:)icon} ${@}"
|
||||
}
|
||||
7
build-aux/.functions/log_status
Normal file
7
build-aux/.functions/log_status
Normal file
@@ -0,0 +1,7 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 0 )) {
|
||||
local icon=' >'
|
||||
|
||||
print -PR "%F{2} ${(r:5:)icon}%f ${@}"
|
||||
}
|
||||
7
build-aux/.functions/log_warning
Normal file
7
build-aux/.functions/log_warning
Normal file
@@ -0,0 +1,7 @@
|
||||
if (( ! ${+_loglevel} )) typeset -g _loglevel=1
|
||||
|
||||
if (( _loglevel > 0 )) {
|
||||
local icon=' =>'
|
||||
|
||||
print -PR "${CI:+::warning::}%F{3} ${(r:5:)icon} ${@}%f"
|
||||
}
|
||||
17
build-aux/.functions/set_loglevel
Normal file
17
build-aux/.functions/set_loglevel
Normal file
@@ -0,0 +1,17 @@
|
||||
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}'"
|
||||
188
build-aux/.run-format.zsh
Executable file
188
build-aux/.run-format.zsh
Executable file
@@ -0,0 +1,188 @@
|
||||
#!/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-13]} )) {
|
||||
local formatter=clang-format-13
|
||||
} elif (( ${+commands[clang-format]} )) {
|
||||
local formatter=clang-format
|
||||
local -a formatter_version=($(clang-format --version))
|
||||
|
||||
if ! is-at-least 13.0.1 ${formatter_version[-1]}; then
|
||||
log_error "clang-format is not version 13.0.1 or above (found ${formatter_version[-1]}."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if ! is-at-least ${formatter_version[-1]} 13.0.1; then
|
||||
log_error "clang-format is more recent than version 13.0.1 (found ${formatter_version[-1]})."
|
||||
exit 2
|
||||
fi
|
||||
} else {
|
||||
log_error "No viable clang-format version found (required 13.0.1)"
|
||||
exit 2
|
||||
}
|
||||
|
||||
local -a source_files=(src/**/*.(c|cpp|h|hpp|m|mm)(.N))
|
||||
|
||||
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 ${@}
|
||||
1
build-aux/run-clang-format
Symbolic link
1
build-aux/run-clang-format
Symbolic link
@@ -0,0 +1 @@
|
||||
.run-format.zsh
|
||||
1
build-aux/run-cmake-format
Symbolic link
1
build-aux/run-cmake-format
Symbolic link
@@ -0,0 +1 @@
|
||||
.run-format.zsh
|
||||
1
build-aux/run-swift-format
Symbolic link
1
build-aux/run-swift-format
Symbolic link
@@ -0,0 +1 @@
|
||||
.run-format.zsh
|
||||
57
buildspec.json
Normal file
57
buildspec.json
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"obs-studio": {
|
||||
"version": "29.1.2",
|
||||
"baseUrl": "https://github.com/obsproject/obs-studio/archive/refs/tags",
|
||||
"label": "OBS sources",
|
||||
"hashes": {
|
||||
"macos": "215f1fa5772c5dd9f3d6e35b0cb573912b00320149666a77864f9d305525504b",
|
||||
"windows-x64": "46d451f3f42b9d2c59339ec268165849c7b7904cdf1cc2a8d44c015815a9e37d"
|
||||
}
|
||||
},
|
||||
"prebuilt": {
|
||||
"version": "2023-04-12",
|
||||
"baseUrl": "https://github.com/obsproject/obs-deps/releases/download",
|
||||
"label": "Pre-Built obs-deps",
|
||||
"hashes": {
|
||||
"macos": "9535c6e1ad96f7d49960251e85a245774088d48da1d602bb82f734b10219125a",
|
||||
"windows-x64": "c13a14a1acc4224b21304d97b63da4121de1ed6981297e50496fbc474abc0503"
|
||||
}
|
||||
},
|
||||
"qt6": {
|
||||
"version": "2023-04-12",
|
||||
"baseUrl": "https://github.com/obsproject/obs-deps/releases/download",
|
||||
"label": "Pre-Built Qt6",
|
||||
"hashes": {
|
||||
"macos": "eb7614544ab4f3d2c6052c797635602280ca5b028a6b987523d8484222ce45d1",
|
||||
"windows-x64": "4d39364b8a8dee5aa24fcebd8440d5c22bb4551c6b440ffeacce7d61f2ed1add"
|
||||
},
|
||||
"debugSymbols": {
|
||||
"windows-x64": "f34ee5067be19ed370268b15c53684b7b8aaa867dc800b68931df905d679e31f"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tools": {
|
||||
"packages": {
|
||||
"version": "1.2.10",
|
||||
"baseUrl": "http://s.sudre.free.fr/Software/files",
|
||||
"label": "Packages.app",
|
||||
"hash": "6afdd25386295974dad8f078b8f1e41cabebd08e72d970bf92f707c7e48b16c9"
|
||||
}
|
||||
},
|
||||
"platformConfig": {
|
||||
"macos": {
|
||||
"bundleId": "com.example.obs-plugintemplate"
|
||||
}
|
||||
},
|
||||
"name": "obs-plugintemplate",
|
||||
"version": "1.0.0",
|
||||
"author": "Your Name Here",
|
||||
"website": "https://example.com",
|
||||
"email": "me@example.com",
|
||||
"uuids": {
|
||||
"macosPackage": "00000000-0000-0000-0000-000000000000",
|
||||
"macosInstaller": "00000000-0000-0000-0000-000000000000",
|
||||
"windowsApp": "00000000-0000-0000-0000-000000000000"
|
||||
}
|
||||
}
|
||||
77
cmake/common/bootstrap.cmake
Normal file
77
cmake/common/bootstrap.cmake
Normal file
@@ -0,0 +1,77 @@
|
||||
cmake_minimum_required(VERSION 3.16...3.26)
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# Enable automatic PUSH and POP of policies to parent scope
|
||||
if(POLICY CMP0011)
|
||||
cmake_policy(SET CMP0011 NEW)
|
||||
endif()
|
||||
|
||||
# Enable distinction between Clang and AppleClang
|
||||
if(POLICY CMP0025)
|
||||
cmake_policy(SET CMP0025 NEW)
|
||||
endif()
|
||||
|
||||
# Enable strict checking of "break()" usage
|
||||
if(POLICY CMP0055)
|
||||
cmake_policy(SET CMP0055 NEW)
|
||||
endif()
|
||||
|
||||
# Honor visibility presets for all target types (executable, shared, module, static)
|
||||
if(POLICY CMP0063)
|
||||
cmake_policy(SET CMP0063 NEW)
|
||||
endif()
|
||||
|
||||
# Disable export function calls to populate package registry by default
|
||||
if(POLICY CMP0090)
|
||||
cmake_policy(SET CMP0090 NEW)
|
||||
endif()
|
||||
|
||||
# Prohibit in-source builds
|
||||
if("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
message(FATAL_ERROR "In-source builds are not supported. "
|
||||
"Specify a build directory via 'cmake -S <SOURCE DIRECTORY> -B <BUILD_DIRECTORY>' instead.")
|
||||
file(REMOVE_RECURSE "${CMAKE_CURRENT_SOURCE_DIR}/CMakeCache.txt" "${CMAKE_CURRENT_SOURCE_DIR}/CMakeFiles")
|
||||
endif()
|
||||
|
||||
# Use folders for source file organization with IDE generators (Visual Studio/Xcode)
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
# Add common module directories to default search path
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/common")
|
||||
|
||||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/buildspec.json" buildspec)
|
||||
|
||||
# cmake-format: off
|
||||
string(JSON _name GET ${buildspec} name)
|
||||
string(JSON _website GET ${buildspec} website)
|
||||
string(JSON _author GET ${buildspec} author)
|
||||
string(JSON _email GET ${buildspec} email)
|
||||
string(JSON _version GET ${buildspec} version)
|
||||
string(JSON _bundleId GET ${buildspec} platformConfig macos bundleId)
|
||||
string(JSON _macosPackageUUID GET ${buildspec} uuids macosPackage)
|
||||
string(JSON _macosInstallerUUID GET ${buildspec} uuids macosInstaller)
|
||||
string(JSON _windowsAppUUID GET ${buildspec} uuids windowsApp)
|
||||
# cmake-format: on
|
||||
|
||||
set(PLUGIN_AUTHOR ${_author})
|
||||
set(PLUGIN_WEBSITE ${_website})
|
||||
set(PLUGIN_EMAIL ${_email})
|
||||
set(PLUGIN_VERSION ${_version})
|
||||
set(MACOS_BUNDLEID ${_bundleId})
|
||||
|
||||
include(buildnumber)
|
||||
include(osconfig)
|
||||
|
||||
# Allow selection of common build types via UI
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE
|
||||
"RelWithDebInfo"
|
||||
CACHE STRING "OBS build type [Release, RelWithDebInfo, Debug, MinSizeRel]" FORCE)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Release RelWithDebInfo Debug MinSizeRel)
|
||||
endif()
|
||||
|
||||
# Disable exports automatically going into the CMake package registry
|
||||
set(CMAKE_EXPORT_PACKAGE_REGISTRY FALSE)
|
||||
# Enable default inclusion of targets' source and binary directory
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
|
||||
21
cmake/common/buildnumber.cmake
Normal file
21
cmake/common/buildnumber.cmake
Normal file
@@ -0,0 +1,21 @@
|
||||
# CMake build number module
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# Define build number cache file
|
||||
set(_BUILD_NUMBER_CACHE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/.CMakeBuildNumber"
|
||||
CACHE INTERNAL "OBS build number cache file")
|
||||
|
||||
# Read build number from cache file or manual override
|
||||
if(NOT DEFINED PLUGIN_BUILD_NUMBER AND EXISTS "${_BUILD_NUMBER_CACHE}")
|
||||
file(READ "${_BUILD_NUMBER_CACHE}" PLUGIN_BUILD_NUMBER)
|
||||
math(EXPR PLUGIN_BUILD_NUMBER "${PLUGIN_BUILD_NUMBER}+1")
|
||||
elseif(NOT DEFINED PLUGIN_BUILD_NUMBER)
|
||||
if($ENV{CI} AND $ENV{GITHUB_RUN_ID})
|
||||
set(PLUGIN_BUILD_NUMBER "$ENV{GITHUB_RUN_ID}")
|
||||
else()
|
||||
set(PLUGIN_BUILD_NUMBER "1")
|
||||
endif()
|
||||
endif()
|
||||
file(WRITE "${_BUILD_NUMBER_CACHE}" "${PLUGIN_BUILD_NUMBER}")
|
||||
215
cmake/common/buildspec_common.cmake
Normal file
215
cmake/common/buildspec_common.cmake
Normal file
@@ -0,0 +1,215 @@
|
||||
# Common build dependencies module
|
||||
|
||||
# cmake-format: off
|
||||
# cmake-lint: disable=C0103
|
||||
# cmake-lint: disable=E1126
|
||||
# cmake-lint: disable=R0912
|
||||
# cmake-lint: disable=R0915
|
||||
# cmake-format: on
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# _check_deps_version: Checks for obs-deps VERSION file in prefix paths
|
||||
function(_check_deps_version version)
|
||||
# cmake-format: off
|
||||
set(found FALSE PARENT_SCOPE)
|
||||
# cmake-format: on
|
||||
|
||||
foreach(path IN LISTS CMAKE_PREFIX_PATH)
|
||||
if(EXISTS "${path}/share/obs-deps/VERSION")
|
||||
if(dependency STREQUAL qt6 AND NOT EXISTS "${path}/lib/cmake/Qt6/Qt6Config.cmake")
|
||||
# cmake-format: off
|
||||
set(found FALSE PARENT_SCOPE)
|
||||
# cmake-format: on
|
||||
continue()
|
||||
endif()
|
||||
|
||||
file(READ "${path}/share/obs-deps/VERSION" _check_version)
|
||||
string(REPLACE "\n" "" _check_version "${_check_version}")
|
||||
string(REPLACE "-" "." _check_version "${_check_version}")
|
||||
string(REPLACE "-" "." version "${version}")
|
||||
|
||||
if(_check_version VERSION_EQUAL version)
|
||||
# cmake-format: off
|
||||
set(found TRUE PARENT_SCOPE)
|
||||
# cmake-format: on
|
||||
break()
|
||||
elseif(_check_version VERSION_LESS version)
|
||||
message(AUTHOR_WARNING "Older ${label} version detected in ${path}: \n"
|
||||
"Found ${_check_version}, require ${version}")
|
||||
list(REMOVE_ITEM CMAKE_PREFIX_PATH "${path}")
|
||||
list(APPEND CMAKE_PREFIX_PATH "${path}")
|
||||
# cmake-format: off
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE)
|
||||
# cmake-format: on
|
||||
continue()
|
||||
else()
|
||||
message(AUTHOR_WARNING "Newer ${label} version detected in ${path}: \n"
|
||||
"Found ${_check_version}, require ${version}")
|
||||
# cmake-format: off
|
||||
set(found TRUE PARENT_SCOPE)
|
||||
# cmake-format: on
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# _setup_obs_studio: Create obs-studio build project, then build libobs and obs-frontend-api
|
||||
function(_setup_obs_studio)
|
||||
if(NOT libobs_DIR)
|
||||
set(_is_fresh --fresh)
|
||||
endif()
|
||||
|
||||
if(OS_WINDOWS)
|
||||
set(_cmake_generator "${CMAKE_GENERATOR}")
|
||||
set(_cmake_arch "-A ${arch}")
|
||||
set(_cmake_extra "-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION} -DCMAKE_ENABLE_SCRIPTING=OFF")
|
||||
set(_cmake_version "2.0.0")
|
||||
elseif(OS_MACOS)
|
||||
set(_cmake_generator "Xcode")
|
||||
set(_cmake_arch "-DCMAKE_OSX_ARCHITECTURES:STRING='arm64;x86_64'")
|
||||
set(_cmake_extra "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
set(_cmake_version "3.0.0")
|
||||
endif()
|
||||
|
||||
message(STATUS "Configure ${label} (${arch})")
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}" -S "${dependencies_dir}/${_obs_destination}" -B
|
||||
"${dependencies_dir}/${_obs_destination}/build_${arch}" -G ${_cmake_generator} "${_cmake_arch}"
|
||||
-DOBS_CMAKE_VERSION:STRING=${_cmake_version} -DENABLE_PLUGINS:BOOL=OFF -DENABLE_UI:BOOL=OFF
|
||||
-DOBS_VERSION_OVERRIDE:STRING=${_obs_version} "-DCMAKE_PREFIX_PATH='${CMAKE_PREFIX_PATH}'" ${_is_fresh}
|
||||
${_cmake_extra}
|
||||
RESULT_VARIABLE _process_result COMMAND_ERROR_IS_FATAL ANY
|
||||
OUTPUT_QUIET)
|
||||
message(STATUS "Configure ${label} (${arch}) - done")
|
||||
|
||||
message(STATUS "Build ${label} (${arch})")
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_COMMAND}" --build build_${arch} --target obs-frontend-api --config Debug --parallel
|
||||
WORKING_DIRECTORY "${dependencies_dir}/${_obs_destination}"
|
||||
RESULT_VARIABLE _process_result COMMAND_ERROR_IS_FATAL ANY
|
||||
OUTPUT_QUIET)
|
||||
message(STATUS "Build ${label} (${arch}) - done")
|
||||
|
||||
message(STATUS "Install ${label} (${arch})")
|
||||
if(OS_WINDOWS)
|
||||
set(_cmake_extra "--component obs_libraries")
|
||||
else()
|
||||
set(_cmake_extra "")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_COMMAND}" --install build_${arch} --component Development --config Debug --prefix
|
||||
"${dependencies_dir}" ${_cmake_extra}
|
||||
WORKING_DIRECTORY "${dependencies_dir}/${_obs_destination}"
|
||||
RESULT_VARIABLE _process_result COMMAND_ERROR_IS_FATAL ANY
|
||||
OUTPUT_QUIET)
|
||||
message(STATUS "Install ${label} (${arch}) - done")
|
||||
endfunction()
|
||||
|
||||
# _check_dependencies: Fetch and extract pre-built OBS build dependencies
|
||||
function(_check_dependencies)
|
||||
if(NOT buildspec)
|
||||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/buildspec.json" buildspec)
|
||||
endif()
|
||||
|
||||
# cmake-format: off
|
||||
string(JSON dependency_data GET ${buildspec} dependencies)
|
||||
# cmake-format: on
|
||||
|
||||
foreach(dependency IN LISTS dependencies_list)
|
||||
# cmake-format: off
|
||||
string(JSON data GET ${dependency_data} ${dependency})
|
||||
string(JSON version GET ${data} version)
|
||||
string(JSON hash GET ${data} hashes ${platform})
|
||||
string(JSON url GET ${data} baseUrl)
|
||||
string(JSON label GET ${data} label)
|
||||
string(JSON revision ERROR_VARIABLE error GET ${data} revision ${platform})
|
||||
# cmake-format: on
|
||||
|
||||
message(STATUS "Setting up ${label} (${arch})")
|
||||
|
||||
set(file "${${dependency}_filename}")
|
||||
set(destination "${${dependency}_destination}")
|
||||
string(REPLACE "VERSION" "${version}" file "${file}")
|
||||
string(REPLACE "VERSION" "${version}" destination "${destination}")
|
||||
string(REPLACE "ARCH" "${arch}" file "${file}")
|
||||
string(REPLACE "ARCH" "${arch}" destination "${destination}")
|
||||
if(revision)
|
||||
string(REPLACE "_REVISION" "_v${revision}" file "${file}")
|
||||
string(REPLACE "-REVISION" "-v${revision}" file "${file}")
|
||||
else()
|
||||
string(REPLACE "_REVISION" "" file "${file}")
|
||||
string(REPLACE "-REVISION" "" file "${file}")
|
||||
endif()
|
||||
|
||||
set(skip FALSE)
|
||||
if(dependency STREQUAL prebuilt OR dependency STREQUAL qt6)
|
||||
_check_deps_version(${version})
|
||||
|
||||
if(found)
|
||||
set(skip TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(skip)
|
||||
message(STATUS "Setting up ${label} (${arch}) - skipped")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
if(dependency STREQUAL obs-studio)
|
||||
set(url ${url}/${file})
|
||||
else()
|
||||
set(url ${url}/${version}/${file})
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${dependencies_dir}/${file}")
|
||||
message(STATUS "Downloading ${url}")
|
||||
file(
|
||||
DOWNLOAD "${url}" "${dependencies_dir}/${file}"
|
||||
STATUS download_status
|
||||
EXPECTED_HASH SHA256=${hash})
|
||||
|
||||
list(GET download_status 0 error_code)
|
||||
list(GET download_status 1 error_message)
|
||||
if(error_code GREATER 0)
|
||||
message(STATUS "Downloading ${url} - Failure")
|
||||
message(FATAL_ERROR "Unable to download ${url}, failed with error: ${error_message}")
|
||||
file(REMOVE "${dependencies_dir}/${file}")
|
||||
else()
|
||||
message(STATUS "Downloading ${url} - done")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${dependencies_dir}/${destination}")
|
||||
file(MAKE_DIRECTORY "${dependencies_dir}/${destination}")
|
||||
if(dependency STREQUAL obs-studio)
|
||||
file(ARCHIVE_EXTRACT INPUT "${dependencies_dir}/${file}" DESTINATION "${dependencies_dir}")
|
||||
else()
|
||||
file(ARCHIVE_EXTRACT INPUT "${dependencies_dir}/${file}" DESTINATION "${dependencies_dir}/${destination}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(dependency STREQUAL prebuilt)
|
||||
list(APPEND CMAKE_PREFIX_PATH "${dependencies_dir}/${destination}")
|
||||
elseif(dependency STREQUAL qt6)
|
||||
list(APPEND CMAKE_PREFIX_PATH "${dependencies_dir}/${destination}")
|
||||
elseif(dependency STREQUAL obs-studio)
|
||||
set(_obs_version ${version})
|
||||
set(_obs_destination "${destination}")
|
||||
list(APPEND CMAKE_PREFIX_PATH "${dependencies_dir}")
|
||||
|
||||
endif()
|
||||
|
||||
message(STATUS "Setting up ${label} (${arch}) - done")
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES CMAKE_PREFIX_PATH)
|
||||
|
||||
# cmake-format: off
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} CACHE PATH "CMake prefix search path" FORCE)
|
||||
# cmake-format: on
|
||||
|
||||
_setup_obs_studio()
|
||||
endfunction()
|
||||
22
cmake/common/ccache.cmake
Normal file
22
cmake/common/ccache.cmake
Normal file
@@ -0,0 +1,22 @@
|
||||
# CMake ccache module
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
if(NOT DEFINED CCACHE_PROGRAM)
|
||||
message(DEBUG "Trying to find ccache on build host...")
|
||||
find_program(CCACHE_PROGRAM "ccache")
|
||||
mark_as_advanced(CCACHE_PROGRAM)
|
||||
endif()
|
||||
|
||||
if(CCACHE_PROGRAM)
|
||||
message(DEBUG "Ccache found as ${CCACHE_PROGRAM}...")
|
||||
option(ENABLE_CCACHE "Enable compiler acceleration with ccache" ON)
|
||||
|
||||
if(ENABLE_CCACHE)
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||
set(CMAKE_OBJC_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||
set(CMAKE_OBJCXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||
set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||
endif()
|
||||
endif()
|
||||
87
cmake/common/compiler_common.cmake
Normal file
87
cmake/common/compiler_common.cmake
Normal file
@@ -0,0 +1,87 @@
|
||||
# CMake common compiler options module
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# Set C and C++ language standards to C17 and C++17
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17)
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
else()
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
endif()
|
||||
set(CMAKE_C_STANDARD_REQUIRED TRUE)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
|
||||
# Set symbols to be hidden by default for C and C++
|
||||
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE)
|
||||
|
||||
# clang options for C
|
||||
set(_obs_clang_c_options
|
||||
# cmake-format: sortable
|
||||
-fno-strict-aliasing
|
||||
-Wbool-conversion
|
||||
-Wcomma
|
||||
-Wconstant-conversion
|
||||
-Wdeprecated-declarations
|
||||
-Wempty-body
|
||||
-Wenum-conversion
|
||||
-Werror=return-type
|
||||
-Wextra
|
||||
-Wformat
|
||||
-Wformat-security
|
||||
-Wfour-char-constants
|
||||
-Winfinite-recursion
|
||||
-Wint-conversion
|
||||
-Wnewline-eof
|
||||
-Wno-conversion
|
||||
-Wno-float-conversion
|
||||
-Wno-implicit-fallthrough
|
||||
-Wno-missing-braces
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-missing-prototypes
|
||||
-Wno-semicolon-before-method-body
|
||||
-Wno-shadow
|
||||
-Wno-sign-conversion
|
||||
-Wno-strict-prototypes
|
||||
-Wno-trigraphs
|
||||
-Wno-unknown-pragmas
|
||||
-Wno-unused-function
|
||||
-Wno-unused-label
|
||||
-Wnon-literal-null-conversion
|
||||
-Wobjc-literal-conversion
|
||||
-Wparentheses
|
||||
-Wpointer-sign
|
||||
-Wquoted-include-in-framework-header
|
||||
-Wshadow
|
||||
-Wshorten-64-to-32
|
||||
-Wuninitialized
|
||||
-Wunreachable-code
|
||||
-Wunused-parameter
|
||||
-Wunused-value
|
||||
-Wunused-variable
|
||||
-Wvla)
|
||||
|
||||
# clang options for C++
|
||||
set(_obs_clang_cxx_options
|
||||
# cmake-format: sortable
|
||||
${_obs_clang_c_options}
|
||||
-Wconversion
|
||||
-Wdeprecated-implementations
|
||||
-Wduplicate-method-match
|
||||
-Wfloat-conversion
|
||||
-Wfour-char-constants
|
||||
-Wimplicit-retain-self
|
||||
-Winvalid-offsetof
|
||||
-Wmove
|
||||
-Wno-c++11-extensions
|
||||
-Wno-exit-time-destructors
|
||||
-Wno-implicit-atomic-properties
|
||||
-Wno-objc-interface-ivars
|
||||
-Wno-overloaded-virtual
|
||||
-Wrange-loop-analysis)
|
||||
|
||||
if(NOT DEFINED CMAKE_COMPILE_WARNING_AS_ERROR)
|
||||
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
|
||||
endif()
|
||||
137
cmake/common/helpers_common.cmake
Normal file
137
cmake/common/helpers_common.cmake
Normal file
@@ -0,0 +1,137 @@
|
||||
# CMake common helper functions module
|
||||
|
||||
# cmake-format: off
|
||||
# cmake-lint: disable=C0103
|
||||
# cmake-format: on
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# * Use QT_VERSION value as a hint for desired Qt version
|
||||
# * If "AUTO" was specified, prefer Qt6 over Qt5
|
||||
# * Creates versionless targets of desired component if none had been created by Qt itself (Qt versions < 5.15)
|
||||
if(NOT QT_VERSION)
|
||||
set(QT_VERSION
|
||||
AUTO
|
||||
CACHE STRING "OBS Qt version [AUTO, 5, 6]" FORCE)
|
||||
set_property(CACHE QT_VERSION PROPERTY STRINGS AUTO 5 6)
|
||||
endif()
|
||||
|
||||
# find_qt: Macro to find best possible Qt version for use with the project:
|
||||
macro(find_qt)
|
||||
set(multiValueArgs COMPONENTS COMPONENTS_WIN COMPONENTS_MAC COMPONENTS_LINUX)
|
||||
cmake_parse_arguments(find_qt "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
# Do not use versionless targets in the first step to avoid Qt::Core being clobbered by later opportunistic
|
||||
# find_package runs
|
||||
set(QT_NO_CREATE_VERSIONLESS_TARGETS TRUE)
|
||||
|
||||
message(DEBUG "Start Qt version discovery...")
|
||||
# Loop until _QT_VERSION is set or FATAL_ERROR aborts script execution early
|
||||
while(NOT _QT_VERSION)
|
||||
message(DEBUG "QT_VERSION set to ${QT_VERSION}")
|
||||
if(QT_VERSION STREQUAL AUTO AND NOT qt_test_version)
|
||||
set(qt_test_version 6)
|
||||
elseif(NOT QT_VERSION STREQUAL AUTO)
|
||||
set(qt_test_version ${QT_VERSION})
|
||||
endif()
|
||||
message(DEBUG "Attempting to find Qt${qt_test_version}")
|
||||
|
||||
find_package(
|
||||
Qt${qt_test_version}
|
||||
COMPONENTS Core
|
||||
QUIET)
|
||||
|
||||
if(TARGET Qt${qt_test_version}::Core)
|
||||
set(_QT_VERSION
|
||||
${qt_test_version}
|
||||
CACHE INTERNAL "")
|
||||
message(STATUS "Qt version found: ${_QT_VERSION}")
|
||||
unset(qt_test_version)
|
||||
break()
|
||||
elseif(QT_VERSION STREQUAL AUTO)
|
||||
if(qt_test_version EQUAL 6)
|
||||
message(WARNING "Qt6 was not found, falling back to Qt5")
|
||||
set(qt_test_version 5)
|
||||
continue()
|
||||
endif()
|
||||
endif()
|
||||
message(FATAL_ERROR "Neither Qt6 nor Qt5 found.")
|
||||
endwhile()
|
||||
|
||||
# Enable versionless targets for the remaining Qt components
|
||||
set(QT_NO_CREATE_VERSIONLESS_TARGETS FALSE)
|
||||
|
||||
set(qt_components ${find_qt_COMPONENTS})
|
||||
if(OS_WINDOWS)
|
||||
list(APPEND qt_components ${find_qt_COMPONENTS_WIN})
|
||||
elseif(OS_MACOS)
|
||||
list(APPEND qt_components ${find_qt_COMPONENTS_MAC})
|
||||
else()
|
||||
list(APPEND qt_components ${find_qt_COMPONENTS_LINUX})
|
||||
endif()
|
||||
message(DEBUG "Trying to find Qt components ${qt_components}...")
|
||||
|
||||
find_package(Qt${_QT_VERSION} REQUIRED ${qt_components})
|
||||
|
||||
list(APPEND qt_components Core)
|
||||
|
||||
if("Gui" IN_LIST find_qt_COMPONENTS_LINUX)
|
||||
list(APPEND qt_components "GuiPrivate")
|
||||
endif()
|
||||
|
||||
# Check for versionless targets of each requested component and create if necessary
|
||||
foreach(component IN LISTS qt_components)
|
||||
message(DEBUG "Checking for target Qt::${component}")
|
||||
if(NOT TARGET Qt::${component} AND TARGET Qt${_QT_VERSION}::${component})
|
||||
add_library(Qt::${component} INTERFACE IMPORTED)
|
||||
set_target_properties(Qt::${component} PROPERTIES INTERFACE_LINK_LIBRARIES Qt${_QT_VERSION}::${component})
|
||||
endif()
|
||||
set_property(TARGET Qt::${component} PROPERTY INTERFACE_COMPILE_FEATURES "")
|
||||
endforeach()
|
||||
|
||||
endmacro()
|
||||
|
||||
# check_uuid: Helper function to check for valid UUID
|
||||
function(check_uuid uuid_string return_value)
|
||||
set(valid_uuid TRUE)
|
||||
set(uuid_token_lengths 8 4 4 4 12)
|
||||
set(token_num 0)
|
||||
|
||||
string(REPLACE "-" ";" uuid_tokens ${uuid_string})
|
||||
list(LENGTH uuid_tokens uuid_num_tokens)
|
||||
|
||||
if(uuid_num_tokens EQUAL 5)
|
||||
message(DEBUG "UUID ${uuid_string} is valid with 5 tokens.")
|
||||
foreach(uuid_token IN LISTS uuid_tokens)
|
||||
list(GET uuid_token_lengths ${token_num} uuid_target_length)
|
||||
string(LENGTH "${uuid_token}" uuid_actual_length)
|
||||
if(uuid_actual_length EQUAL uuid_target_length)
|
||||
string(REGEX MATCH "[0-9a-fA-F]+" uuid_hex_match ${uuid_token})
|
||||
if(NOT uuid_hex_match STREQUAL uuid_token)
|
||||
set(valid_uuid FALSE)
|
||||
break()
|
||||
endif()
|
||||
else()
|
||||
set(valid_uuid FALSE)
|
||||
break()
|
||||
endif()
|
||||
math(EXPR token_num "${token_num}+1")
|
||||
endforeach()
|
||||
else()
|
||||
set(valid_uuid FALSE)
|
||||
endif()
|
||||
message(DEBUG "UUID ${uuid_string} valid: ${valid_uuid}")
|
||||
set(${return_value}
|
||||
${valid_uuid}
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/plugin-support.c.in")
|
||||
configure_file(src/plugin-support.c.in plugin-support.c @ONLY)
|
||||
add_library(plugin-support STATIC)
|
||||
target_sources(
|
||||
plugin-support
|
||||
PRIVATE plugin-support.c
|
||||
PUBLIC src/plugin-support.h)
|
||||
target_include_directories(plugin-support PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
endif()
|
||||
22
cmake/common/osconfig.cmake
Normal file
22
cmake/common/osconfig.cmake
Normal file
@@ -0,0 +1,22 @@
|
||||
# CMake operating system bootstrap module
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# Set minimum CMake version specific to host operating system, add OS-specific module directory to default search paths,
|
||||
# and set helper variables for OS detection in other CMake list files.
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(CMAKE_C_EXTENSIONS FALSE)
|
||||
set(CMAKE_CXX_EXTENSIONS FALSE)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/windows")
|
||||
set(OS_WINDOWS TRUE)
|
||||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(CMAKE_C_EXTENSIONS FALSE)
|
||||
set(CMAKE_CXX_EXTENSIONS FALSE)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos")
|
||||
set(OS_MACOS TRUE)
|
||||
elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|FreeBSD|OpenBSD")
|
||||
set(CMAKE_CXX_EXTENSIONS FALSE)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/linux")
|
||||
string(TOUPPER "${CMAKE_HOST_SYSTEM_NAME}" _SYSTEM_NAME_U)
|
||||
set(OS_${_SYSTEM_NAME_U} TRUE)
|
||||
endif()
|
||||
85
cmake/linux/compilerconfig.cmake
Normal file
85
cmake/linux/compilerconfig.cmake
Normal file
@@ -0,0 +1,85 @@
|
||||
# CMake Linux compiler configuration module
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
include(ccache)
|
||||
include(compiler_common)
|
||||
|
||||
option(ENABLE_COMPILER_TRACE "Enable Clang time-trace (required Clang and Ninja)" OFF)
|
||||
mark_as_advanced(ENABLE_COMPILER_TRACE)
|
||||
|
||||
# gcc options for C
|
||||
set(_obs_gcc_c_options
|
||||
# cmake-format: sortable
|
||||
-fno-strict-aliasing
|
||||
-fopenmp-simd
|
||||
-Wdeprecated-declarations
|
||||
-Wempty-body
|
||||
-Wenum-conversion
|
||||
-Werror=return-type
|
||||
-Wextra
|
||||
-Wformat
|
||||
-Wformat-security
|
||||
-Wno-conversion
|
||||
-Wno-float-conversion
|
||||
-Wno-implicit-fallthrough
|
||||
-Wno-missing-braces
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-shadow
|
||||
-Wno-sign-conversion
|
||||
-Wno-trigraphs
|
||||
-Wno-unknown-pragmas
|
||||
-Wno-unused-function
|
||||
-Wno-unused-label
|
||||
-Wparentheses
|
||||
-Wshadow
|
||||
-Wuninitialized
|
||||
-Wunreachable-code
|
||||
-Wunused-parameter
|
||||
-Wunused-value
|
||||
-Wunused-variable
|
||||
-Wvla)
|
||||
|
||||
# gcc options for C++
|
||||
set(_obs_gcc_cxx_options
|
||||
# cmake-format: sortable
|
||||
${_obs_gcc_c_options} -Wconversion -Wfloat-conversion -Winvalid-offsetof -Wno-overloaded-virtual)
|
||||
|
||||
add_compile_options(
|
||||
-fopenmp-simd
|
||||
"$<$<COMPILE_LANG_AND_ID:C,GNU>:${_obs_gcc_c_options}>"
|
||||
"$<$<COMPILE_LANG_AND_ID:C,GNU>:-Wint-conversion;-Wno-missing-prototypes;-Wno-strict-prototypes;-Wpointer-sign>"
|
||||
"$<$<COMPILE_LANG_AND_ID:CXX,GNU>:${_obs_gcc_cxx_options}>"
|
||||
"$<$<COMPILE_LANG_AND_ID:C,Clang>:${_obs_clang_c_options}>"
|
||||
"$<$<COMPILE_LANG_AND_ID:CXX,Clang>:${_obs_clang_cxx_options}>")
|
||||
|
||||
# Add support for color diagnostics and CMake switch for warnings as errors to CMake < 3.24
|
||||
if(CMAKE_VERSION VERSION_LESS 3.24.0)
|
||||
add_compile_options($<$<C_COMPILER_ID:Clang>:-fcolor-diagnostics> $<$<CXX_COMPILER_ID:Clang>:-fcolor-diagnostics>)
|
||||
if(CMAKE_COMPILE_WARNING_AS_ERROR)
|
||||
add_compile_options(-Werror)
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_COLOR_DIAGNOSTICS ON)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
|
||||
# Disable false-positive warning in GCC 12.1.0 and later
|
||||
add_compile_options(-Wno-error=maybe-uninitialized)
|
||||
|
||||
# Add warning for infinite recursion (added in GCC 12)
|
||||
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0.0)
|
||||
add_compile_options(-Winfinite-recursion)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Enable compiler and build tracing (requires Ninja generator)
|
||||
if(ENABLE_COMPILER_TRACE AND CMAKE_GENERATOR STREQUAL "Ninja")
|
||||
add_compile_options($<$<COMPILE_LANG_AND_ID:C,Clang>:-ftime-trace> $<$<COMPILE_LANG_AND_ID:CXX,Clang>:-ftime-trace>)
|
||||
else()
|
||||
set(ENABLE_COMPILER_TRACE
|
||||
OFF
|
||||
CACHE STRING "Enable Clang time-trace (required Clang and Ninja)" FORCE)
|
||||
endif()
|
||||
|
||||
add_compile_definitions($<$<CONFIG:DEBUG>:DEBUG> $<$<CONFIG:DEBUG>:_DEBUG> SIMDE_ENABLE_OPENMP)
|
||||
86
cmake/linux/defaults.cmake
Normal file
86
cmake/linux/defaults.cmake
Normal file
@@ -0,0 +1,86 @@
|
||||
# CMake Linux defaults module
|
||||
|
||||
# cmake-format: off
|
||||
# cmake-lint: disable=C0103
|
||||
# cmake-lint: disable=C0111
|
||||
# cmake-format: on
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Enable find_package targets to become globally available targets
|
||||
set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL TRUE)
|
||||
|
||||
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
|
||||
set(CPACK_PACKAGE_VERSION "${CMAKE_PROJECT_VERSION}")
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_C_LIBRARY_ARCHITECTURE}")
|
||||
|
||||
set(CPACK_GENERATOR "DEB")
|
||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${PLUGIN_EMAIL}")
|
||||
set(CPACK_SET_DESTDIR ON)
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.25.0 OR NOT CMAKE_CROSSCOMPILING)
|
||||
set(CPACK_DEBIAN_DEBUGINFO_PACKAGE ON)
|
||||
endif()
|
||||
|
||||
set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/release")
|
||||
|
||||
set(CPACK_SOURCE_GENERATOR "TXZ")
|
||||
set(CPACK_SOURCE_IGNORE_FILES
|
||||
# cmake-format: sortable
|
||||
".*~$"
|
||||
\\.git/
|
||||
\\.github/
|
||||
\\.gitignore
|
||||
build_.*
|
||||
cmake/\\.CMakeBuildNumber
|
||||
release/)
|
||||
|
||||
set(CPACK_VERBATIM_VARIABLES YES)
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-source")
|
||||
set(CPACK_ARCHIVE_THREADS 0)
|
||||
|
||||
include(CPack)
|
||||
|
||||
find_package(libobs QUIET)
|
||||
|
||||
if(NOT TARGET OBS::libobs)
|
||||
find_package(LibObs REQUIRED)
|
||||
add_library(OBS::libobs ALIAS libobs)
|
||||
|
||||
if(ENABLE_FRONTEND_API)
|
||||
find_path(
|
||||
obs-frontend-api_INCLUDE_DIR
|
||||
NAMES obs-frontend-api.h
|
||||
PATHS /usr/include /usr/local/include
|
||||
PATH_SUFFIXES obs)
|
||||
|
||||
find_library(
|
||||
obs-frontend-api_LIBRARY
|
||||
NAMES obs-frontend-api
|
||||
PATHS /usr/lib /usr/local/lib)
|
||||
|
||||
if(obs-frontend-api_LIBRARY)
|
||||
if(NOT TARGET OBS::obs-frontend-api)
|
||||
if(IS_ABSOLUTE "${obs-frontend-api_LIBRARY}")
|
||||
add_library(OBS::obs-frontend-api UNKNOWN IMPORTED)
|
||||
set_property(TARGET OBS::obs-frontend-api PROPERTY IMPORTED_LOCATION "${obs-frontend-api_LIBRARY}")
|
||||
else()
|
||||
add_library(OBS::obs-frontend-api INTERFACE IMPORTED)
|
||||
set_property(TARGET OBS::obs-frontend-api PROPERTY IMPORTED_LIBNAME "${obs-frontend-api_LIBRARY}")
|
||||
endif()
|
||||
|
||||
set_target_properties(OBS::obs-frontend-api PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${obs-frontend-api_INCLUDE_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro(find_package)
|
||||
if(NOT "${ARGV0}" STREQUAL libobs AND NOT "${ARGV0}" STREQUAL obs-frontend-api)
|
||||
_find_package(${ARGV})
|
||||
endif()
|
||||
endmacro()
|
||||
endif()
|
||||
74
cmake/linux/helpers.cmake
Normal file
74
cmake/linux/helpers.cmake
Normal file
@@ -0,0 +1,74 @@
|
||||
# CMake Linux helper functions module
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
include(helpers_common)
|
||||
|
||||
# set_target_properties_plugin: Set target properties for use in obs-studio
|
||||
function(set_target_properties_plugin target)
|
||||
set(options "")
|
||||
set(oneValueArgs "")
|
||||
set(multiValueArgs PROPERTIES)
|
||||
cmake_parse_arguments(PARSE_ARGV 0 _STPO "${options}" "${oneValueArgs}" "${multiValueArgs}")
|
||||
|
||||
message(DEBUG "Setting additional properties for target ${target}...")
|
||||
|
||||
while(_STPO_PROPERTIES)
|
||||
list(POP_FRONT _STPO_PROPERTIES key value)
|
||||
set_property(TARGET ${target} PROPERTY ${key} "${value}")
|
||||
endwhile()
|
||||
|
||||
set_target_properties(
|
||||
${target}
|
||||
PROPERTIES VERSION 0
|
||||
SOVERSION ${PLUGIN_VERSION}
|
||||
PREFIX "")
|
||||
|
||||
install(
|
||||
TARGETS ${target}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/obs-plugins)
|
||||
|
||||
if(TARGET plugin-support)
|
||||
target_link_libraries(${target} PRIVATE plugin-support)
|
||||
endif()
|
||||
|
||||
target_install_resources(${target})
|
||||
|
||||
get_target_property(target_sources ${target} SOURCES)
|
||||
set(target_ui_files ${target_sources})
|
||||
list(FILTER target_ui_files INCLUDE REGEX ".+\\.(ui|qrc)")
|
||||
source_group(
|
||||
TREE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
PREFIX "UI Files"
|
||||
FILES ${target_ui_files})
|
||||
endfunction()
|
||||
|
||||
# Helper function to add resources into bundle
|
||||
function(target_install_resources target)
|
||||
message(DEBUG "Installing resources for target ${target}...")
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/data")
|
||||
file(GLOB_RECURSE data_files "${CMAKE_CURRENT_SOURCE_DIR}/data/*")
|
||||
foreach(data_file IN LISTS data_files)
|
||||
cmake_path(RELATIVE_PATH data_file BASE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data/" OUTPUT_VARIABLE
|
||||
relative_path)
|
||||
cmake_path(GET relative_path PARENT_PATH relative_path)
|
||||
target_sources(${target} PRIVATE "${data_file}")
|
||||
source_group("Resources/${relative_path}" FILES "${data_file}")
|
||||
endforeach()
|
||||
|
||||
install(
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data/"
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/obs/obs-plugins/${target}
|
||||
USE_SOURCE_PERMISSIONS)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Helper function to add a specific resource to a bundle
|
||||
function(target_add_resource target resource)
|
||||
message(DEBUG "Add resource '${resource}' to target ${target} at destination '${target_destination}'...")
|
||||
|
||||
install(FILES "${resource}" DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/obs/obs-plugins/${target})
|
||||
|
||||
source_group("Resources" FILES "${resource}")
|
||||
endfunction()
|
||||
56
cmake/linux/toolchains/aarch64-linux-clang.cmake
Normal file
56
cmake/linux/toolchains/aarch64-linux-clang.cmake
Normal file
@@ -0,0 +1,56 @@
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET aarch64-linux-gnu)
|
||||
set(CMAKE_CXX_COMPILER_TARGET aarch64-linux-gnu)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(PKG_CONFIG_EXECUTABLE
|
||||
/usr/bin/aarch64-linux-gnu-pkg-config
|
||||
CACHE FILEPATH "pkg-config executable")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -print-prog-name=llvm-ranlib
|
||||
OUTPUT_VARIABLE CMAKE_RANLIB
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -print-prog-name=llvm-ar
|
||||
OUTPUT_VARIABLE CMAKE_LLVM_AR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -print-prog-name=llvm-readelf
|
||||
OUTPUT_VARIABLE READELF
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -print-prog-name=llvm-objcopy
|
||||
OUTPUT_VARIABLE CMAKE_LLVM_OBJCOPY
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -print-prog-name=llvm-objdump
|
||||
OUTPUT_VARIABLE CMAKE_LLVM_OBJDUMP
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
set(CMAKE_AR
|
||||
"${CMAKE_LLVM_AR}"
|
||||
CACHE INTERNAL "${CMAKE_SYSTEM_NAME} ar" FORCE)
|
||||
set(CMAKE_OBJCOPY
|
||||
"${CMAKE_LLVM_OBJCOPY}"
|
||||
CACHE INTERNAL "${CMAKE_SYSTEM_NAME} objcopy" FORCE)
|
||||
set(CMAKE_OBJDUMP
|
||||
"${CMAKE_LLVM_OBJDUMP}"
|
||||
CACHE INTERNAL "${CMAKE_SYSTEM_NAME} objdump" FORCE)
|
||||
|
||||
set(CPACK_READELF_EXECUTABLE "${READELF}")
|
||||
set(CPACK_OBJCOPY_EXECUTABLE "${CMAKE_LLVM_OBJCOPY}")
|
||||
set(CPACK_OBJDUMP_EXECUTABLE "${CMAKE_LLVM_OBJDUMP}")
|
||||
set(CPACK_PACKAGE_ARCHITECTURE arm64)
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE arm64)
|
||||
20
cmake/linux/toolchains/aarch64-linux-gcc.cmake
Normal file
20
cmake/linux/toolchains/aarch64-linux-gcc.cmake
Normal file
@@ -0,0 +1,20 @@
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
|
||||
set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
set(PKG_CONFIG_EXECUTABLE
|
||||
/usr/bin/aarch64-linux-gnu-pkg-config
|
||||
CACHE FILEPATH "pkg-config executable")
|
||||
|
||||
set(CPACK_READELF_EXECUTABLE /usr/bin/aarch64-linux-gnu-readelf)
|
||||
set(CPACK_OBJCOPY_EXECUTABLE /usr/bin/aarch64-linux-gnu-objcopy)
|
||||
set(CPACK_OBJDUMP_EXECUTABLE /usr/bin/aarch64-linux-gnu-objdump)
|
||||
set(CPACK_PACKAGE_ARCHITECTURE arm64)
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE arm64)
|
||||
56
cmake/linux/toolchains/x86_64-linux-clang.cmake
Normal file
56
cmake/linux/toolchains/x86_64-linux-clang.cmake
Normal file
@@ -0,0 +1,56 @@
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET x86_64-linux-gnu)
|
||||
set(CMAKE_CXX_COMPILER_TARGET x86_64-linux-gnu)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-linux-gnu)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(PKG_CONFIG_EXECUTABLE
|
||||
/usr/bin/x86_64-linux-gnu-pkg-config
|
||||
CACHE FILEPATH "pkg-config executable")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -print-prog-name=llvm-ranlib
|
||||
OUTPUT_VARIABLE CMAKE_RANLIB
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -print-prog-name=llvm-ar
|
||||
OUTPUT_VARIABLE CMAKE_LLVM_AR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -print-prog-name=llvm-readelf
|
||||
OUTPUT_VARIABLE READELF
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -print-prog-name=llvm-objcopy
|
||||
OUTPUT_VARIABLE CMAKE_LLVM_OBJCOPY
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -print-prog-name=llvm-objdump
|
||||
OUTPUT_VARIABLE CMAKE_LLVM_OBJDUMP
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
set(CMAKE_AR
|
||||
"${CMAKE_LLVM_AR}"
|
||||
CACHE INTERNAL "${CMAKE_SYSTEM_NAME} ar" FORCE)
|
||||
set(CMAKE_OBJCOPY
|
||||
"${CMAKE_LLVM_OBJCOPY}"
|
||||
CACHE INTERNAL "${CMAKE_SYSTEM_NAME} objcopy" FORCE)
|
||||
set(CMAKE_OBJDUMP
|
||||
"${CMAKE_LLVM_OBJDUMP}"
|
||||
CACHE INTERNAL "${CMAKE_SYSTEM_NAME} objdump" FORCE)
|
||||
|
||||
set(CPACK_READELF_EXECUTABLE "${READELF}")
|
||||
set(CPACK_OBJCOPY_EXECUTABLE "${CMAKE_LLVM_OBJCOPY}")
|
||||
set(CPACK_OBJDUMP_EXECUTABLE "${CMAKE_LLVM_OBJDUMP}")
|
||||
set(CPACK_PACKAGE_ARCHITECTURE x86_64)
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE x86_64)
|
||||
20
cmake/linux/toolchains/x86_64-linux-gcc.cmake
Normal file
20
cmake/linux/toolchains/x86_64-linux-gcc.cmake
Normal file
@@ -0,0 +1,20 @@
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
|
||||
set(CMAKE_C_COMPILER /usr/bin/x86_64-linux-gnu-gcc)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/x86_64-linux-gnu-g++)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-linux-gnu)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
set(PKG_CONFIG_EXECUTABLE
|
||||
/usr/bin/x86_64-linux-gnu-pkg-config
|
||||
CACHE FILEPATH "pkg-config executable")
|
||||
|
||||
set(CPACK_READELF_EXECUTABLE /usr/bin/x86_64-linux-gnu-readelf)
|
||||
set(CPACK_OBJCOPY_EXECUTABLE /usr/bin/x86_64-linux-gnu-objcopy)
|
||||
set(CPACK_OBJDUMP_EXECUTABLE /usr/bin/x86_64-linux-gnu-objdump)
|
||||
set(CPACK_PACKAGE_ARCHITECTURE x86_64)
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE x86_64)
|
||||
34
cmake/macos/buildspec.cmake
Normal file
34
cmake/macos/buildspec.cmake
Normal file
@@ -0,0 +1,34 @@
|
||||
# CMake macOS build dependencies module
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
include(buildspec_common)
|
||||
|
||||
# _check_dependencies_macos: Set up macOS slice for _check_dependencies
|
||||
function(_check_dependencies_macos)
|
||||
set(arch universal)
|
||||
set(platform macos)
|
||||
|
||||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/buildspec.json" buildspec)
|
||||
|
||||
set(dependencies_dir "${CMAKE_CURRENT_SOURCE_DIR}/.deps")
|
||||
set(prebuilt_filename "macos-deps-VERSION-ARCH_REVISION.tar.xz")
|
||||
set(prebuilt_destination "obs-deps-VERSION-ARCH")
|
||||
set(qt6_filename "macos-deps-qt6-VERSION-ARCH-REVISION.tar.xz")
|
||||
set(qt6_destination "obs-deps-qt6-VERSION-ARCH")
|
||||
set(obs-studio_filename "VERSION.tar.gz")
|
||||
set(obs-studio_destination "obs-studio-VERSION")
|
||||
set(dependencies_list prebuilt qt6 obs-studio)
|
||||
|
||||
_check_dependencies()
|
||||
|
||||
execute_process(COMMAND "xattr" -r -d com.apple.quarantine "${dependencies_dir}"
|
||||
RESULT_VARIABLE result COMMAND_ERROR_IS_FATAL ANY)
|
||||
|
||||
list(APPEND CMAKE_FRAMEWORK_PATH "${dependencies_dir}/Frameworks")
|
||||
set(CMAKE_FRAMEWORK_PATH
|
||||
${CMAKE_FRAMEWORK_PATH}
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
_check_dependencies_macos()
|
||||
57
cmake/macos/compilerconfig.cmake
Normal file
57
cmake/macos/compilerconfig.cmake
Normal file
@@ -0,0 +1,57 @@
|
||||
# CMake macOS compiler configuration module
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
include(ccache)
|
||||
include(compiler_common)
|
||||
|
||||
add_compile_options(-fopenmp-simd)
|
||||
|
||||
if(XCODE)
|
||||
# Use Xcode's standard architecture selection
|
||||
set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)")
|
||||
# Enable dSYM generation for Release builds
|
||||
string(APPEND CMAKE_C_FLAGS_RELEASE " -g")
|
||||
string(APPEND CMAKE_CXX_FLAGS_RELEASE " -g")
|
||||
else()
|
||||
option(ENABLE_COMPILER_TRACE "Enable clang time-trace (requires Ninja)" OFF)
|
||||
mark_as_advanced(ENABLE_COMPILER_TRACE)
|
||||
|
||||
# clang options for ObjC
|
||||
set(_obs_clang_objc_options
|
||||
# cmake-format: sortable
|
||||
-Werror=block-capture-autoreleasing -Wno-selector -Wno-strict-selector-match -Wnon-virtual-dtor -Wprotocol
|
||||
-Wundeclared-selector)
|
||||
|
||||
# clang options for ObjC++
|
||||
set(_obs_clang_objcxx_options
|
||||
# cmake-format: sortable
|
||||
${_obs_clang_objc_options} -Warc-repeated-use-of-weak -Wno-arc-maybe-repeated-use-of-weak)
|
||||
|
||||
add_compile_options(
|
||||
"$<$<COMPILE_LANGUAGE:C>:${_obs_clang_c_options}>" "$<$<COMPILE_LANGUAGE:CXX>:${_obs_clang_cxx_options}>"
|
||||
"$<$<COMPILE_LANGUAGE:OBJC>:${_obs_clang_objc_options}>"
|
||||
"$<$<COMPILE_LANGUAGE:OBJCXX>:${_obs_clang_objcxx_options}>")
|
||||
|
||||
# Enable stripping of dead symbols when not building for Debug configuration
|
||||
set(_release_configs RelWithDebInfo Release MinSizeRel)
|
||||
if(CMAKE_BUILD_TYPE IN_LIST _release_configs)
|
||||
add_link_options(LINKER:-dead_strip)
|
||||
endif()
|
||||
|
||||
# Enable color diagnostics for AppleClang
|
||||
set(CMAKE_COLOR_DIAGNOSTICS ON)
|
||||
# Set universal architectures via CMake flag for non-Xcode generators
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
|
||||
|
||||
# Enable compiler and build tracing (requires Ninja generator)
|
||||
if(ENABLE_COMPILER_TRACE AND CMAKE_GENERATOR STREQUAL "Ninja")
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C>:-ftime-trace> $<$<COMPILE_LANGUAGE:CXX>:-ftime-trace>)
|
||||
else()
|
||||
set(ENABLE_COMPILER_TRACE
|
||||
OFF
|
||||
CACHE STRING "Enable clang time-trace (requires Ninja)" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_compile_definitions($<$<CONFIG:DEBUG>:DEBUG> $<$<CONFIG:DEBUG>:_DEBUG> SIMDE_ENABLE_OPENMP)
|
||||
49
cmake/macos/defaults.cmake
Normal file
49
cmake/macos/defaults.cmake
Normal file
@@ -0,0 +1,49 @@
|
||||
# CMake macOS defaults module
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# Set empty codesigning team if not specified as cache variable
|
||||
if(NOT CODESIGN_TEAM)
|
||||
set(CODESIGN_TEAM
|
||||
""
|
||||
CACHE STRING "OBS code signing team for macOS" FORCE)
|
||||
|
||||
# Set ad-hoc codesigning identity if not specified as cache variable
|
||||
if(NOT CODESIGN_IDENTITY)
|
||||
set(CODESIGN_IDENTITY
|
||||
"-"
|
||||
CACHE STRING "OBS code signing identity for macOS" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(XCODE)
|
||||
include(xcode)
|
||||
endif()
|
||||
|
||||
include(buildspec)
|
||||
|
||||
# Set default deployment target to 11.0 if not set and enable selection in GUI up to 13.0
|
||||
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET
|
||||
11.0
|
||||
CACHE STRING "Minimum macOS version to target for deployment (at runtime). Newer APIs will be weak-linked." FORCE)
|
||||
endif()
|
||||
set_property(CACHE CMAKE_OSX_DEPLOYMENT_TARGET PROPERTY STRINGS 13.0 12.0 11.0)
|
||||
|
||||
# Use Applications directory as default install destination
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX
|
||||
"$ENV{HOME}/Library/Application Support/obs-studio/plugins"
|
||||
CACHE STRING "Directory to install OBS after building" FORCE)
|
||||
endif()
|
||||
|
||||
# Enable find_package targets to become globally available targets
|
||||
set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL TRUE)
|
||||
# Enable RPATH support for generated binaries
|
||||
set(CMAKE_MACOSX_RPATH TRUE)
|
||||
# Use RPATHs from build tree _in_ the build tree
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
# Do not add default linker search paths to RPATH
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
|
||||
# Use common bundle-relative RPATH for installed targets
|
||||
set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks")
|
||||
108
cmake/macos/helpers.cmake
Normal file
108
cmake/macos/helpers.cmake
Normal file
@@ -0,0 +1,108 @@
|
||||
# CMake macOS helper functions module
|
||||
|
||||
# cmake-format: off
|
||||
# cmake-lint: disable=C0103
|
||||
# cmake-lint: disable=C0307
|
||||
# cmake-format: on
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
include(helpers_common)
|
||||
|
||||
# set_target_properties_obs: Set target properties for use in obs-studio
|
||||
function(set_target_properties_plugin target)
|
||||
set(options "")
|
||||
set(oneValueArgs "")
|
||||
set(multiValueArgs PROPERTIES)
|
||||
cmake_parse_arguments(PARSE_ARGV 0 _STPO "${options}" "${oneValueArgs}" "${multiValueArgs}")
|
||||
|
||||
message(DEBUG "Setting additional properties for target ${target}...")
|
||||
|
||||
while(_STPO_PROPERTIES)
|
||||
list(POP_FRONT _STPO_PROPERTIES key value)
|
||||
set_property(TARGET ${target} PROPERTY ${key} "${value}")
|
||||
endwhile()
|
||||
|
||||
string(TIMESTAMP CURRENT_YEAR "%Y")
|
||||
set_target_properties(
|
||||
${target}
|
||||
PROPERTIES BUNDLE TRUE
|
||||
BUNDLE_EXTENSION plugin
|
||||
XCODE_ATTRIBUTE_PRODUCT_NAME ${target}
|
||||
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER ${MACOS_BUNDLEID}
|
||||
XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION ${PLUGIN_BUILD_NUMBER}
|
||||
XCODE_ATTRIBUTE_MARKETING_VERSION ${PLUGIN_VERSION}
|
||||
XCODE_ATTRIBUTE_GENERATE_INFOPLIST_FILE YES
|
||||
XCODE_ATTRIBUTE_INFOPLIST_FILE ""
|
||||
XCODE_ATTRIBUTE_INFOPLIST_KEY_CFBundleDisplayName ${target}
|
||||
XCODE_ATTRIBUTE_INFOPLIST_KEY_NSHumanReadableCopyright "(c) ${CURRENT_YEAR} ${PLUGIN_AUTHOR}"
|
||||
XCODE_ATTRIBUTE_INSTALL_PATH "$(USER_LIBRARY_DIR)/Application Support/obs-studio/plugins")
|
||||
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/entitlements.plist")
|
||||
set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/entitlements.plist")
|
||||
endif()
|
||||
|
||||
if(TARGET plugin-support)
|
||||
target_link_libraries(${target} PRIVATE plugin-support)
|
||||
endif()
|
||||
|
||||
target_install_resources(${target})
|
||||
|
||||
get_target_property(target_sources ${target} SOURCES)
|
||||
set(target_ui_files ${target_sources})
|
||||
list(FILTER target_ui_files INCLUDE REGEX ".+\\.(ui|qrc)")
|
||||
source_group(
|
||||
TREE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
PREFIX "UI Files"
|
||||
FILES ${target_ui_files})
|
||||
|
||||
set(valid_uuid FALSE)
|
||||
check_uuid(${_macosPackageUUID} valid_uuid)
|
||||
if(NOT valid_uuid)
|
||||
message(FATAL_ERROR "Specified macOS package UUID is not a valid UUID value: ${_macosPackageUUID}")
|
||||
else()
|
||||
set(UUID_PACKAGE ${_macosPackageUUID})
|
||||
endif()
|
||||
|
||||
set(valid_uuid FALSE)
|
||||
check_uuid(${_macosInstallerUUID} valid_uuid)
|
||||
if(NOT valid_uuid)
|
||||
message(FATAL_ERROR "Specified macOS package UUID is not a valid UUID value: ${_macosInstallerUUID}")
|
||||
else()
|
||||
set(UUID_INSTALLER ${_macosInstallerUUID})
|
||||
endif()
|
||||
|
||||
install(TARGETS ${target} LIBRARY DESTINATION .)
|
||||
install(
|
||||
FILES "$<TARGET_BUNDLE_DIR:${target}>.dsym"
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION .
|
||||
OPTIONAL)
|
||||
configure_file(cmake/macos/resources/create-package.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/create-package.cmake")
|
||||
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/create-package.cmake")
|
||||
endfunction()
|
||||
|
||||
# target_install_resources: Helper function to add resources into bundle
|
||||
function(target_install_resources target)
|
||||
message(DEBUG "Installing resources for target ${target}...")
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/data")
|
||||
file(GLOB_RECURSE data_files "${CMAKE_CURRENT_SOURCE_DIR}/data/*")
|
||||
foreach(data_file IN LISTS data_files)
|
||||
cmake_path(RELATIVE_PATH data_file BASE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data/" OUTPUT_VARIABLE
|
||||
relative_path)
|
||||
cmake_path(GET relative_path PARENT_PATH relative_path)
|
||||
target_sources(${target} PRIVATE "${data_file}")
|
||||
set_property(SOURCE "${data_file}" PROPERTY MACOSX_PACKAGE_LOCATION "Resources/${relative_path}")
|
||||
source_group("Resources/${relative_path}" FILES "${data_file}")
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# target_add_resource: Helper function to add a specific resource to a bundle
|
||||
function(target_add_resource target resource)
|
||||
message(DEBUG "Add resource ${resource} to target ${target} at destination ${destination}...")
|
||||
target_sources(${target} PRIVATE "${resource}")
|
||||
set_property(SOURCE "${resource}" PROPERTY MACOSX_PACKAGE_LOCATION Resources)
|
||||
source_group("Resources" FILES "${resource}")
|
||||
endfunction()
|
||||
17
cmake/macos/resources/ccache-launcher-c.in
Normal file
17
cmake/macos/resources/ccache-launcher-c.in
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [[ "$1" == "${CMAKE_C_COMPILER}" ]] ; then
|
||||
shift
|
||||
fi
|
||||
|
||||
export CCACHE_CPP2=true
|
||||
export CCACHE_DEPEND=true
|
||||
export CCACHE_DIRECT=true
|
||||
export CCACHE_FILECLONE=true
|
||||
export CCACHE_INODECACHE=true
|
||||
export CCACHE_NOCOMPILERCHECK='content'
|
||||
export CCACHE_SLOPPINESS='include_file_mtime,include_file_ctime,clang_index_store,system_headers'
|
||||
if [[ "${CI}" ]]; then
|
||||
export CCACHE_NOHASHDIR=true
|
||||
fi
|
||||
exec "${CMAKE_C_COMPILER_LAUNCHER}" "${CMAKE_C_COMPILER}" "$@"
|
||||
17
cmake/macos/resources/ccache-launcher-cxx.in
Normal file
17
cmake/macos/resources/ccache-launcher-cxx.in
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [[ "$1" == "${CMAKE_CXX_COMPILER}" ]] ; then
|
||||
shift
|
||||
fi
|
||||
|
||||
export CCACHE_CPP2=true
|
||||
export CCACHE_NODEPEND=true
|
||||
export CCACHE_DIRECT=true
|
||||
export CCACHE_FILECLONE=true
|
||||
export CCACHE_INODECACHE=true
|
||||
export CCACHE_NOCOMPILERCHECK='content'
|
||||
export CCACHE_SLOPPINESS='include_file_mtime,include_file_ctime,clang_index_store,system_headers'
|
||||
if [[ "${CI}" ]]; then
|
||||
export CCACHE_NOHASHDIR=true
|
||||
fi
|
||||
exec "${CMAKE_CXX_COMPILER_LAUNCHER}" "${CMAKE_CXX_COMPILER}" "$@"
|
||||
7
cmake/macos/resources/create-package.cmake.in
Normal file
7
cmake/macos/resources/create-package.cmake.in
Normal file
@@ -0,0 +1,7 @@
|
||||
set(CMAKE_PROJECT_NAME ${CMAKE_PROJECT_NAME})
|
||||
set(CMAKE_PROJECT_VERSION ${CMAKE_PROJECT_VERSION})
|
||||
set(MACOS_BUNDLEID ${MACOS_BUNDLEID})
|
||||
set(UUID_PACKAGE ${UUID_PACKAGE})
|
||||
set(UUID_INSTALLER ${UUID_INSTALLER})
|
||||
configure_file(cmake/macos/resources/installer-macos.pkgproj.in
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/installer-macos.generated.pkgproj")
|
||||
920
cmake/macos/resources/installer-macos.pkgproj.in
Normal file
920
cmake/macos/resources/installer-macos.pkgproj.in
Normal file
@@ -0,0 +1,920 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PACKAGES</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>MUST-CLOSE-APPLICATION-ITEMS</key>
|
||||
<array/>
|
||||
<key>MUST-CLOSE-APPLICATIONS</key>
|
||||
<false/>
|
||||
<key>PACKAGE_FILES</key>
|
||||
<dict>
|
||||
<key>DEFAULT_INSTALL_LOCATION</key>
|
||||
<string>/</string>
|
||||
<key>HIERARCHY</key>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>80</integer>
|
||||
<key>PATH</key>
|
||||
<string>Applications</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>509</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>BUNDLE_CAN_DOWNGRADE</key>
|
||||
<false/>
|
||||
<key>BUNDLE_POSTINSTALL_PATH</key>
|
||||
<dict>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>BUNDLE_PREINSTALL_PATH</key>
|
||||
<dict>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>80</integer>
|
||||
<key>PATH</key>
|
||||
<string>../release/@CMAKE_INSTALL_CONFIG_NAME@/@CMAKE_PROJECT_NAME@.plugin</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>3</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>GID</key>
|
||||
<integer>80</integer>
|
||||
<key>PATH</key>
|
||||
<string>plugins</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>2</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>509</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>2</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>GID</key>
|
||||
<integer>80</integer>
|
||||
<key>PATH</key>
|
||||
<string>obs-studio</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>2</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>509</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>2</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>GID</key>
|
||||
<integer>80</integer>
|
||||
<key>PATH</key>
|
||||
<string>Application Support</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Automator</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Documentation</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Extensions</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Filesystems</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Frameworks</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Input Methods</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Internet Plug-Ins</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>LaunchAgents</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>LaunchDaemons</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>PreferencePanes</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Preferences</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>80</integer>
|
||||
<key>PATH</key>
|
||||
<string>Printers</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>PrivilegedHelperTools</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>1005</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>QuickLook</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>QuickTime</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Screen Savers</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Scripts</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Services</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Widgets</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Library</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>Shared</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>1023</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>GID</key>
|
||||
<integer>80</integer>
|
||||
<key>PATH</key>
|
||||
<string>Users</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>GID</key>
|
||||
<integer>0</integer>
|
||||
<key>PATH</key>
|
||||
<string>/</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PERMISSIONS</key>
|
||||
<integer>493</integer>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>UID</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>PAYLOAD_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>PRESERVE_EXTENDED_ATTRIBUTES</key>
|
||||
<false/>
|
||||
<key>SHOW_INVISIBLE</key>
|
||||
<false/>
|
||||
<key>SPLIT_FORKS</key>
|
||||
<true/>
|
||||
<key>TREAT_MISSING_FILES_AS_WARNING</key>
|
||||
<false/>
|
||||
<key>VERSION</key>
|
||||
<integer>5</integer>
|
||||
</dict>
|
||||
<key>PACKAGE_SCRIPTS</key>
|
||||
<dict>
|
||||
<key>POSTINSTALL_PATH</key>
|
||||
<dict>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>PREINSTALL_PATH</key>
|
||||
<dict>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>RESOURCES</key>
|
||||
<array/>
|
||||
</dict>
|
||||
<key>PACKAGE_SETTINGS</key>
|
||||
<dict>
|
||||
<key>AUTHENTICATION</key>
|
||||
<integer>0</integer>
|
||||
<key>CONCLUSION_ACTION</key>
|
||||
<integer>0</integer>
|
||||
<key>FOLLOW_SYMBOLIC_LINKS</key>
|
||||
<false/>
|
||||
<key>IDENTIFIER</key>
|
||||
<string>@MACOS_BUNDLEID@</string>
|
||||
<key>LOCATION</key>
|
||||
<integer>0</integer>
|
||||
<key>NAME</key>
|
||||
<string>@CMAKE_PROJECT_NAME@</string>
|
||||
<key>OVERWRITE_PERMISSIONS</key>
|
||||
<false/>
|
||||
<key>PAYLOAD_SIZE</key>
|
||||
<integer>-1</integer>
|
||||
<key>REFERENCE_PATH</key>
|
||||
<string></string>
|
||||
<key>RELOCATABLE</key>
|
||||
<false/>
|
||||
<key>USE_HFS+_COMPRESSION</key>
|
||||
<false/>
|
||||
<key>VERSION</key>
|
||||
<string>@CMAKE_PROJECT_VERSION@</string>
|
||||
</dict>
|
||||
<key>TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>UUID</key>
|
||||
<string>@UUID_PACKAGE@</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>PROJECT</key>
|
||||
<dict>
|
||||
<key>PROJECT_COMMENTS</key>
|
||||
<dict>
|
||||
<key>NOTES</key>
|
||||
<data>
|
||||
</data>
|
||||
</dict>
|
||||
<key>PROJECT_PRESENTATION</key>
|
||||
<dict>
|
||||
<key>BACKGROUND</key>
|
||||
<dict>
|
||||
<key>APPAREANCES</key>
|
||||
<dict>
|
||||
<key>DARK_AQUA</key>
|
||||
<dict/>
|
||||
<key>LIGHT_AQUA</key>
|
||||
<dict/>
|
||||
</dict>
|
||||
<key>SHARED_SETTINGS_FOR_ALL_APPAREANCES</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>INSTALLATION TYPE</key>
|
||||
<dict>
|
||||
<key>HIERARCHIES</key>
|
||||
<dict>
|
||||
<key>INSTALLER</key>
|
||||
<dict>
|
||||
<key>LIST</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CHILDREN</key>
|
||||
<array/>
|
||||
<key>DESCRIPTION</key>
|
||||
<array/>
|
||||
<key>OPTIONS</key>
|
||||
<dict>
|
||||
<key>HIDDEN</key>
|
||||
<false/>
|
||||
<key>STATE</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>PACKAGE_UUID</key>
|
||||
<string>@UUID_PACKAGE@</string>
|
||||
<key>TITLE</key>
|
||||
<array/>
|
||||
<key>TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>UUID</key>
|
||||
<string>@UUID_INSTALLER@</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>REMOVED</key>
|
||||
<dict/>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>MODE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>INSTALLATION_STEPS</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS</key>
|
||||
<string>ICPresentationViewIntroductionController</string>
|
||||
<key>INSTALLER_PLUGIN</key>
|
||||
<string>Introduction</string>
|
||||
<key>LIST_TITLE_KEY</key>
|
||||
<string>InstallerSectionTitle</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS</key>
|
||||
<string>ICPresentationViewReadMeController</string>
|
||||
<key>INSTALLER_PLUGIN</key>
|
||||
<string>ReadMe</string>
|
||||
<key>LIST_TITLE_KEY</key>
|
||||
<string>InstallerSectionTitle</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS</key>
|
||||
<string>ICPresentationViewLicenseController</string>
|
||||
<key>INSTALLER_PLUGIN</key>
|
||||
<string>License</string>
|
||||
<key>LIST_TITLE_KEY</key>
|
||||
<string>InstallerSectionTitle</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS</key>
|
||||
<string>ICPresentationViewDestinationSelectController</string>
|
||||
<key>INSTALLER_PLUGIN</key>
|
||||
<string>TargetSelect</string>
|
||||
<key>LIST_TITLE_KEY</key>
|
||||
<string>InstallerSectionTitle</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS</key>
|
||||
<string>ICPresentationViewInstallationTypeController</string>
|
||||
<key>INSTALLER_PLUGIN</key>
|
||||
<string>PackageSelection</string>
|
||||
<key>LIST_TITLE_KEY</key>
|
||||
<string>InstallerSectionTitle</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS</key>
|
||||
<string>ICPresentationViewInstallationController</string>
|
||||
<key>INSTALLER_PLUGIN</key>
|
||||
<string>Install</string>
|
||||
<key>LIST_TITLE_KEY</key>
|
||||
<string>InstallerSectionTitle</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS</key>
|
||||
<string>ICPresentationViewSummaryController</string>
|
||||
<key>INSTALLER_PLUGIN</key>
|
||||
<string>Summary</string>
|
||||
<key>LIST_TITLE_KEY</key>
|
||||
<string>InstallerSectionTitle</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>INTRODUCTION</key>
|
||||
<dict>
|
||||
<key>LOCALIZATIONS</key>
|
||||
<array/>
|
||||
</dict>
|
||||
<key>LICENSE</key>
|
||||
<dict>
|
||||
<key>LOCALIZATIONS</key>
|
||||
<array/>
|
||||
<key>MODE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>README</key>
|
||||
<dict>
|
||||
<key>LOCALIZATIONS</key>
|
||||
<array/>
|
||||
</dict>
|
||||
<key>SUMMARY</key>
|
||||
<dict>
|
||||
<key>LOCALIZATIONS</key>
|
||||
<array/>
|
||||
</dict>
|
||||
<key>TITLE</key>
|
||||
<dict>
|
||||
<key>LOCALIZATIONS</key>
|
||||
<array/>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>PROJECT_REQUIREMENTS</key>
|
||||
<dict>
|
||||
<key>LIST</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>BEHAVIOR</key>
|
||||
<integer>3</integer>
|
||||
<key>DICTIONARY</key>
|
||||
<dict>
|
||||
<key>IC_REQUIREMENT_OS_DISK_TYPE</key>
|
||||
<integer>1</integer>
|
||||
<key>IC_REQUIREMENT_OS_DISTRIBUTION_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>IC_REQUIREMENT_OS_MINIMUM_VERSION</key>
|
||||
<integer>101300</integer>
|
||||
</dict>
|
||||
<key>IC_REQUIREMENT_CHECK_TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>IDENTIFIER</key>
|
||||
<string>fr.whitebox.Packages.requirement.os</string>
|
||||
<key>MESSAGE</key>
|
||||
<array/>
|
||||
<key>NAME</key>
|
||||
<string>Operating System</string>
|
||||
<key>STATE</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</array>
|
||||
<key>RESOURCES</key>
|
||||
<array/>
|
||||
<key>ROOT_VOLUME_ONLY</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>PROJECT_SETTINGS</key>
|
||||
<dict>
|
||||
<key>ADVANCED_OPTIONS</key>
|
||||
<dict>
|
||||
<key>installer-script.domains:enable_currentUserHome</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>BUILD_FORMAT</key>
|
||||
<integer>0</integer>
|
||||
<key>BUILD_PATH</key>
|
||||
<dict>
|
||||
<key>PATH</key>
|
||||
<string>.</string>
|
||||
<key>PATH_TYPE</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>EXCLUDED_FILES</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>PATTERNS_ARRAY</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>REGULAR_EXPRESSION</key>
|
||||
<false/>
|
||||
<key>STRING</key>
|
||||
<string>.DS_Store</string>
|
||||
<key>TYPE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>PROTECTED</key>
|
||||
<true/>
|
||||
<key>PROXY_NAME</key>
|
||||
<string>Remove .DS_Store files</string>
|
||||
<key>PROXY_TOOLTIP</key>
|
||||
<string>Remove ".DS_Store" files created by the Finder.</string>
|
||||
<key>STATE</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>PATTERNS_ARRAY</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>REGULAR_EXPRESSION</key>
|
||||
<false/>
|
||||
<key>STRING</key>
|
||||
<string>.pbdevelopment</string>
|
||||
<key>TYPE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>PROTECTED</key>
|
||||
<true/>
|
||||
<key>PROXY_NAME</key>
|
||||
<string>Remove .pbdevelopment files</string>
|
||||
<key>PROXY_TOOLTIP</key>
|
||||
<string>Remove ".pbdevelopment" files created by ProjectBuilder or Xcode.</string>
|
||||
<key>STATE</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>PATTERNS_ARRAY</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>REGULAR_EXPRESSION</key>
|
||||
<false/>
|
||||
<key>STRING</key>
|
||||
<string>CVS</string>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>REGULAR_EXPRESSION</key>
|
||||
<false/>
|
||||
<key>STRING</key>
|
||||
<string>.cvsignore</string>
|
||||
<key>TYPE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>REGULAR_EXPRESSION</key>
|
||||
<false/>
|
||||
<key>STRING</key>
|
||||
<string>.cvspass</string>
|
||||
<key>TYPE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>REGULAR_EXPRESSION</key>
|
||||
<false/>
|
||||
<key>STRING</key>
|
||||
<string>.svn</string>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>REGULAR_EXPRESSION</key>
|
||||
<false/>
|
||||
<key>STRING</key>
|
||||
<string>.git</string>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>REGULAR_EXPRESSION</key>
|
||||
<false/>
|
||||
<key>STRING</key>
|
||||
<string>.gitignore</string>
|
||||
<key>TYPE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>PROTECTED</key>
|
||||
<true/>
|
||||
<key>PROXY_NAME</key>
|
||||
<string>Remove SCM metadata</string>
|
||||
<key>PROXY_TOOLTIP</key>
|
||||
<string>Remove helper files and folders used by the CVS, SVN or Git Source Code Management systems.</string>
|
||||
<key>STATE</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>PATTERNS_ARRAY</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>REGULAR_EXPRESSION</key>
|
||||
<false/>
|
||||
<key>STRING</key>
|
||||
<string>classes.nib</string>
|
||||
<key>TYPE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>REGULAR_EXPRESSION</key>
|
||||
<false/>
|
||||
<key>STRING</key>
|
||||
<string>designable.db</string>
|
||||
<key>TYPE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>REGULAR_EXPRESSION</key>
|
||||
<false/>
|
||||
<key>STRING</key>
|
||||
<string>info.nib</string>
|
||||
<key>TYPE</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>PROTECTED</key>
|
||||
<true/>
|
||||
<key>PROXY_NAME</key>
|
||||
<string>Optimize nib files</string>
|
||||
<key>PROXY_TOOLTIP</key>
|
||||
<string>Remove "classes.nib", "info.nib" and "designable.nib" files within .nib bundles.</string>
|
||||
<key>STATE</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>PATTERNS_ARRAY</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>REGULAR_EXPRESSION</key>
|
||||
<false/>
|
||||
<key>STRING</key>
|
||||
<string>Resources Disabled</string>
|
||||
<key>TYPE</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>PROTECTED</key>
|
||||
<true/>
|
||||
<key>PROXY_NAME</key>
|
||||
<string>Remove Resources Disabled folders</string>
|
||||
<key>PROXY_TOOLTIP</key>
|
||||
<string>Remove "Resources Disabled" folders.</string>
|
||||
<key>STATE</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SEPARATOR</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</array>
|
||||
<key>NAME</key>
|
||||
<string>@CMAKE_PROJECT_NAME@</string>
|
||||
<key>PAYLOAD_ONLY</key>
|
||||
<false/>
|
||||
<key>TREAT_MISSING_PRESENTATION_DOCUMENTS_AS_WARNING</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>TYPE</key>
|
||||
<integer>0</integer>
|
||||
<key>VERSION</key>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
</plist>
|
||||
174
cmake/macos/xcode.cmake
Normal file
174
cmake/macos/xcode.cmake
Normal file
@@ -0,0 +1,174 @@
|
||||
# CMake macOS Xcode module
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# Use a compiler wrapper to enable ccache in Xcode projects
|
||||
if(ENABLE_CCACHE AND CCACHE_PROGRAM)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/resources/ccache-launcher-c.in" ccache-launcher-c)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos/resources/ccache-launcher-cxx.in" ccache-launcher-cxx)
|
||||
|
||||
execute_process(COMMAND chmod a+rx "${CMAKE_CURRENT_BINARY_DIR}/ccache-launcher-c"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/ccache-launcher-cxx")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_CURRENT_BINARY_DIR}/ccache-launcher-c")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_CURRENT_BINARY_DIR}/ccache-launcher-cxx")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_C_COMPILER}")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_CXX_COMPILER}")
|
||||
endif()
|
||||
|
||||
# Set project variables
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION ${PLUGIN_BUILD_NUMBER})
|
||||
set(CMAKE_XCODE_ATTRIBUTE_DYLIB_COMPATIBILITY_VERSION 1.0.0)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_MARKETING_VERSION ${PLUGIN_VERSION})
|
||||
|
||||
# Set deployment target
|
||||
set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET})
|
||||
|
||||
if(NOT CODESIGN_TEAM)
|
||||
# Switch to manual codesigning if no codesigning team is provided
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_STYLE Manual)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${CODESIGN_IDENTITY}")
|
||||
else()
|
||||
if(CODESIGN_IDENTITY AND NOT CODESIGN_IDENTITY STREQUAL "-")
|
||||
# Switch to manual codesigning if a non-adhoc codesigning identity is provided
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_STYLE Manual)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${CODESIGN_IDENTITY}")
|
||||
else()
|
||||
# Switch to automatic codesigning via valid team ID
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_STYLE Automatic)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Apple Development")
|
||||
endif()
|
||||
set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "${CODESIGN_TEAM}")
|
||||
endif()
|
||||
|
||||
# Only create a single Xcode project file
|
||||
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE)
|
||||
# Add all libraries to project link phase (lets Xcode handle linking)
|
||||
set(CMAKE_XCODE_LINK_BUILD_PHASE_MODE KNOWN_LOCATION)
|
||||
|
||||
# Enable codesigning with secure timestamp when not in Debug configuration (required for Notarization)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS[variant=Release] "--timestamp")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS[variant=RelWithDebInfo] "--timestamp")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS[variant=MinSizeRel] "--timestamp")
|
||||
|
||||
# Enable codesigning with hardened runtime option when not in Debug configuration (required for Notarization)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME[variant=Release] YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME[variant=RelWithDebInfo] YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME[variant=MinSizeRel] YES)
|
||||
|
||||
# Disable injection of Xcode's base entitlements used for debugging when not in Debug configuration (required for
|
||||
# Notarization)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_INJECT_BASE_ENTITLEMENTS[variant=Release] NO)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_INJECT_BASE_ENTITLEMENTS[variant=RelWithDebInfo] NO)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_INJECT_BASE_ENTITLEMENTS[variant=MinSizeRel] NO)
|
||||
|
||||
# Use Swift version 5.0 by default
|
||||
set(CMAKE_XCODE_ATTRIBUTE_SWIFT_VERSION 5.0)
|
||||
|
||||
# Use DWARF with separate dSYM files when in Release or MinSizeRel configuration.
|
||||
#
|
||||
# * Currently overruled by CMake's Xcode generator, requires adding '-g' flag to raw compiler command line for desired
|
||||
# output configuration. Report to KitWare.
|
||||
#
|
||||
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT[variant=Debug] dwarf)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT[variant=RelWithDebInfo] dwarf)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT[variant=Release] dwarf-with-dsym)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT[variant=MinSizeRel] dwarf-with-dsym)
|
||||
|
||||
# Make all symbols hidden by default (currently overriden by CMake's compiler flags)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES)
|
||||
|
||||
# Strip unused code
|
||||
set(CMAKE_XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING YES)
|
||||
|
||||
# Display mangled names in Debug configuration
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LINKER_DISPLAYS_MANGLED_NAMES[variant=Debug] YES)
|
||||
|
||||
# Build active architecture only in Debug configuration
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH[variant=Debug] YES)
|
||||
|
||||
# Enable testability in Debug configuration
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_TESTABILITY[variant=Debug] YES)
|
||||
|
||||
# Enable using ARC in ObjC by default
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
|
||||
# Enable weak references in manual retain release
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_WEAK YES)
|
||||
# Disable strict aliasing
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_STRICT_ALIASING NO)
|
||||
|
||||
# Set C++ language default to c17
|
||||
#
|
||||
# * CMake explicitly sets the version via compiler flag when transitive dependencies require specific compiler feature
|
||||
# set, resulting in the flag being added twice. Report to KitWare as a feature request for Xcode generator
|
||||
# * See also: https://gitlab.kitware.com/cmake/cmake/-/issues/17183
|
||||
#
|
||||
# set(CMAKE_XCODE_ATTRIBUTE_GCC_C_LANGUAGE_STANDARD c17)
|
||||
#
|
||||
# Set C++ language default to c++17
|
||||
#
|
||||
# * See above. Report to KitWare as a feature request for Xcode generator
|
||||
#
|
||||
# set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD c++17)
|
||||
|
||||
# Enable support for module imports in ObjC
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_MODULES YES)
|
||||
# Enable automatic linking of imported modules in ObjC
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_MODULES_AUTOLINK YES)
|
||||
# Enable strict msg_send rules for ObjC
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_STRICT_OBJC_MSGSEND YES)
|
||||
|
||||
# Set default warnings for ObjC and C++
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING YES_ERROR)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_BOOL_CONVERSION YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_COMMA YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_CONSTANT_CONVERSION YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_EMPTY_BODY YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_ENUM_CONVERSION YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_INFINITE_RECURSION YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_INT_CONVERSION YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_NON_LITERAL_NULL_CONVERSION YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_OBJC_LITERAL_CONVERSION YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_RANGE_LOOP_ANALYSIS YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_STRICT_PROTOTYPES NO)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION NO)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_SUSPICIOUS_MOVE YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_UNREACHABLE_CODE YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN__DUPLICATE_METHOD_MATCH YES)
|
||||
|
||||
# Set default warnings for C and C++
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_NO_COMMON_BLOCKS YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_64_TO_32_BIT_CONVERSION YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS NO)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_NEWLINE YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_ABOUT_RETURN_TYPE YES_ERROR)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_CHECK_SWITCH_STATEMENTS YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_FOUR_CHARACTER_CONSTANTS YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_SHADOW NO)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_SIGN_COMPARE YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_TYPECHECK_CALLS_TO_PRINTF YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNDECLARED_SELECTOR YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNINITIALIZED_AUTOS YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_FUNCTION NO)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_PARAMETER YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_VALUE YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_UNUSED_VARIABLE YES)
|
||||
|
||||
# Add additional warning compiler flags
|
||||
set(CMAKE_XCODE_ATTRIBUTE_WARNING_CFLAGS "-Wvla -Wformat-security")
|
||||
|
||||
if(CMAKE_COMPILE_WARNING_AS_ERROR)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_TREAT_WARNINGS_AS_ERRORS YES)
|
||||
endif()
|
||||
|
||||
# Enable color diagnostics
|
||||
set(CMAKE_COLOR_DIAGNOSTICS TRUE)
|
||||
|
||||
# Disable usage of RPATH in build or install configurations
|
||||
set(CMAKE_SKIP_RPATH TRUE)
|
||||
# Have Xcode set default RPATH entries
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks")
|
||||
24
cmake/windows/buildspec.cmake
Normal file
24
cmake/windows/buildspec.cmake
Normal file
@@ -0,0 +1,24 @@
|
||||
# CMake Windows build dependencies module
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
include(buildspec_common)
|
||||
|
||||
# _check_dependencies_windows: Set up Windows slice for _check_dependencies
|
||||
function(_check_dependencies_windows)
|
||||
set(arch ${CMAKE_GENERATOR_PLATFORM})
|
||||
set(platform windows-${arch})
|
||||
|
||||
set(dependencies_dir "${CMAKE_CURRENT_SOURCE_DIR}/.deps")
|
||||
set(prebuilt_filename "windows-deps-VERSION-ARCH-REVISION.zip")
|
||||
set(prebuilt_destination "obs-deps-VERSION-ARCH")
|
||||
set(qt6_filename "windows-deps-qt6-VERSION-ARCH-REVISION.zip")
|
||||
set(qt6_destination "obs-deps-qt6-VERSION-ARCH")
|
||||
set(obs-studio_filename "VERSION.zip")
|
||||
set(obs-studio_destination "obs-studio-VERSION")
|
||||
set(dependencies_list prebuilt qt6 obs-studio)
|
||||
|
||||
_check_dependencies()
|
||||
endfunction()
|
||||
|
||||
_check_dependencies_windows()
|
||||
35
cmake/windows/compilerconfig.cmake
Normal file
35
cmake/windows/compilerconfig.cmake
Normal file
@@ -0,0 +1,35 @@
|
||||
# CMake Windows compiler configuration module
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
include(compiler_common)
|
||||
|
||||
# CMake 3.24 introduces a bug mistakenly interpreting MSVC as supporting the '-pthread' compiler flag
|
||||
if(CMAKE_VERSION VERSION_EQUAL 3.24.0)
|
||||
set(THREADS_HAVE_PTHREAD_ARG FALSE)
|
||||
endif()
|
||||
|
||||
message(DEBUG "Current Windows API version: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
||||
if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM)
|
||||
message(DEBUG "Maximum Windows API version: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION VERSION_LESS 10.0.20348)
|
||||
message(FATAL_ERROR "OBS requires Windows 10 SDK version 10.0.20348.0 or more recent.\n"
|
||||
"Please download and install the most recent Windows platform SDK.")
|
||||
endif()
|
||||
|
||||
add_compile_options(
|
||||
/W3 /utf-8 "$<$<COMPILE_LANG_AND_ID:C,MSVC>:/MP>" "$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/MP>"
|
||||
"$<$<COMPILE_LANG_AND_ID:C,Clang>:${_obs_clang_c_options}>"
|
||||
"$<$<COMPILE_LANG_AND_ID:CXX,Clang>:${_obs_clang_cxx_options}>")
|
||||
|
||||
add_compile_definitions(UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS $<$<CONFIG:DEBUG>:DEBUG>
|
||||
$<$<CONFIG:DEBUG>:_DEBUG>)
|
||||
|
||||
add_link_options("$<$<NOT:$<CONFIG:Debug>>:/OPT:REF>" "$<$<CONFIG:Debug>:/INCREMENTAL:NO>"
|
||||
"$<$<CONFIG:RelWithDebInfo>:/INCREMENTAL:NO>" "$<$<CONFIG:RelWithDebInfo>:/OPT:ICF>")
|
||||
|
||||
if(CMAKE_COMPILE_WARNING_AS_ERROR)
|
||||
add_link_options(/WX)
|
||||
endif()
|
||||
8
cmake/windows/defaults.cmake
Normal file
8
cmake/windows/defaults.cmake
Normal file
@@ -0,0 +1,8 @@
|
||||
# CMake Windows defaults module
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# Enable find_package targets to become globally available targets
|
||||
set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL TRUE)
|
||||
|
||||
include(buildspec)
|
||||
130
cmake/windows/helpers.cmake
Normal file
130
cmake/windows/helpers.cmake
Normal file
@@ -0,0 +1,130 @@
|
||||
# CMake Windows helper functions module
|
||||
|
||||
# cmake-format: off
|
||||
# cmake-lint: disable=C0103
|
||||
# cmake-format: on
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
include(helpers_common)
|
||||
|
||||
# set_target_properties_plugin: Set target properties for use in obs-studio
|
||||
function(set_target_properties_plugin target)
|
||||
set(options "")
|
||||
set(oneValueArgs "")
|
||||
set(multiValueArgs PROPERTIES)
|
||||
cmake_parse_arguments(PARSE_ARGV 0 _STPO "${options}" "${oneValueArgs}" "${multiValueArgs}")
|
||||
|
||||
message(DEBUG "Setting additional properties for target ${target}...")
|
||||
|
||||
while(_STPO_PROPERTIES)
|
||||
list(POP_FRONT _STPO_PROPERTIES key value)
|
||||
set_property(TARGET ${target} PROPERTY ${key} "${value}")
|
||||
endwhile()
|
||||
|
||||
string(TIMESTAMP CURRENT_YEAR "%Y")
|
||||
|
||||
set_target_properties(${target} PROPERTIES VERSION 0 SOVERSION ${PLUGIN_VERSION})
|
||||
|
||||
install(
|
||||
TARGETS ${target}
|
||||
RUNTIME DESTINATION bin/64bit
|
||||
LIBRARY DESTINATION obs-plugins/64bit)
|
||||
|
||||
install(
|
||||
FILES "$<TARGET_PDB_FILE:${target}>"
|
||||
CONFIGURATIONS RelWithDebInfo Debug
|
||||
DESTINATION obs-plugins/64bit
|
||||
OPTIONAL)
|
||||
|
||||
if(OBS_BUILD_DIR)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory "${OBS_BUILD_DIR}/obs-plugins/64bit"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:${target}>"
|
||||
"$<$<CONFIG:Debug,RelWithDebInfo>:$<TARGET_PDB_FILE:${target}>>" "${OBS_BUILD_DIR}/obs-plugin/64bit"
|
||||
COMMENT "Copy ${target} to obs-studio directory ${OBS_BUILD_DIR}"
|
||||
VERBATIM)
|
||||
endif()
|
||||
|
||||
if(TARGET plugin-support)
|
||||
target_link_libraries(${target} PRIVATE plugin-support)
|
||||
endif()
|
||||
|
||||
target_install_resources(${target})
|
||||
|
||||
get_target_property(target_sources ${target} SOURCES)
|
||||
set(target_ui_files ${target_sources})
|
||||
list(FILTER target_ui_files INCLUDE REGEX ".+\\.(ui|qrc)")
|
||||
source_group(
|
||||
TREE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
PREFIX "UI Files"
|
||||
FILES ${target_ui_files})
|
||||
|
||||
set(valid_uuid FALSE)
|
||||
check_uuid(${_windowsAppUUID} valid_uuid)
|
||||
if(NOT valid_uuid)
|
||||
message(FATAL_ERROR "Specified Windows package UUID is not a valid UUID value: ${_windowsAppUUID}")
|
||||
else()
|
||||
set(UUID_APP ${_windowsAppUUID})
|
||||
endif()
|
||||
|
||||
configure_file(cmake/windows/resources/installer-Windows.iss.in
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/installer-Windows.generated.iss")
|
||||
|
||||
configure_file(cmake/windows/resources/resource.rc.in "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.rc")
|
||||
target_sources(${CMAKE_PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.rc")
|
||||
endfunction()
|
||||
|
||||
# Helper function to add resources into bundle
|
||||
function(target_install_resources target)
|
||||
message(DEBUG "Installing resources for target ${target}...")
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/data")
|
||||
file(GLOB_RECURSE data_files "${CMAKE_CURRENT_SOURCE_DIR}/data/*")
|
||||
foreach(data_file IN LISTS data_files)
|
||||
cmake_path(RELATIVE_PATH data_file BASE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data/" OUTPUT_VARIABLE
|
||||
relative_path)
|
||||
cmake_path(GET relative_path PARENT_PATH relative_path)
|
||||
target_sources(${target} PRIVATE "${data_file}")
|
||||
source_group("Resources/${relative_path}" FILES "${data_file}")
|
||||
endforeach()
|
||||
|
||||
install(
|
||||
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data/"
|
||||
DESTINATION data/obs-plugins/${target}
|
||||
USE_SOURCE_PERMISSIONS)
|
||||
|
||||
if(OBS_BUILD_DIR)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory "${OBS_BUILD_DIR}/data/obs-plugins/${target}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/data"
|
||||
"${OBS_BUILD_DIR}/data/obs-plugins/${target}"
|
||||
COMMENT "Copy ${target} resources to data directory"
|
||||
VERBATIM)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Helper function to add a specific resource to a bundle
|
||||
function(target_add_resource target resource)
|
||||
message(DEBUG "Add resource '${resource}' to target ${target} at destination '${target_destination}'...")
|
||||
|
||||
install(
|
||||
FILES "${resource}"
|
||||
DESTINATION data/obs-plugins/${target}
|
||||
COMPONENT Runtime)
|
||||
|
||||
if(OBS_BUILD_DIR)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory "${OBS_BUILD_DIR}/data/obs-plugins/${target}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy "${resource}" "${OBS_BUILD_DIR}/data/obs-plugins/${target}"
|
||||
COMMENT "Copy ${target} resource ${resource} to library directory"
|
||||
VERBATIM)
|
||||
endif()
|
||||
source_group("Resources" FILES "${resource}")
|
||||
endfunction()
|
||||
64
cmake/windows/resources/installer-Windows.iss.in
Normal file
64
cmake/windows/resources/installer-Windows.iss.in
Normal file
@@ -0,0 +1,64 @@
|
||||
#define MyAppName "@CMAKE_PROJECT_NAME@"
|
||||
#define MyAppVersion "@CMAKE_PROJECT_VERSION@"
|
||||
#define MyAppPublisher "@PLUGIN_AUTHOR@"
|
||||
#define MyAppURL "@PLUGIN_WEBSITE@"
|
||||
|
||||
[Setup]
|
||||
; NOTE: The value of AppId uniquely identifies this application.
|
||||
; Do not use the same AppId value in installers for other applications.
|
||||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||
AppId={{@UUID_APP@}
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
AppPublisherURL={#MyAppURL}
|
||||
AppSupportURL={#MyAppURL}
|
||||
AppUpdatesURL={#MyAppURL}
|
||||
DefaultDirName={code:GetDirName}
|
||||
DefaultGroupName={#MyAppName}
|
||||
OutputBaseFilename={#MyAppName}-{#MyAppVersion}-Windows-Installer
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
DirExistsWarning=no
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
[Files]
|
||||
Source: "..\release\Package\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
Source: "..\LICENSE"; Flags: dontcopy
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
|
||||
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
|
||||
|
||||
[Code]
|
||||
procedure InitializeWizard();
|
||||
var
|
||||
GPLText: AnsiString;
|
||||
Page: TOutputMsgMemoWizardPage;
|
||||
begin
|
||||
ExtractTemporaryFile('LICENSE');
|
||||
LoadStringFromFile(ExpandConstant('{tmp}\LICENSE'), GPLText);
|
||||
Page := CreateOutputMsgMemoPage(wpWelcome,
|
||||
'License Information', 'Please review the license terms before installing {#MyAppName}',
|
||||
'Press Page Down to see the rest of the agreement. Once you are aware of your rights, click Next to continue.',
|
||||
String(GPLText)
|
||||
);
|
||||
end;
|
||||
|
||||
// credit where it's due :
|
||||
// following function come from https://github.com/Xaymar/obs-studio_amf-encoder-plugin/blob/master/%23Resources/Installer.in.iss#L45
|
||||
function GetDirName(Value: string): string;
|
||||
var
|
||||
InstallPath: string;
|
||||
begin
|
||||
// initialize default path, which will be returned when the following registry
|
||||
// key queries fail due to missing keys or for some different reason
|
||||
Result := '{autopf}\obs-studio';
|
||||
// query the first registry value; if this succeeds, return the obtained value
|
||||
if RegQueryStringValue(HKLM32, 'SOFTWARE\OBS Studio', '', InstallPath) then
|
||||
Result := InstallPath
|
||||
end;
|
||||
|
||||
32
cmake/windows/resources/resource.rc.in
Normal file
32
cmake/windows/resources/resource.rc.in
Normal file
@@ -0,0 +1,32 @@
|
||||
1 VERSIONINFO
|
||||
FILEVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH},0
|
||||
PRODUCTVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH},0
|
||||
FILEFLAGSMASK 0x0L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x0L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "${PLUGIN_AUTHOR}"
|
||||
VALUE "FileDescription", "${PROJECT_NAME}"
|
||||
VALUE "FileVersion", "${PROJECT_VERSION}"
|
||||
VALUE "InternalName", "${PROJECT_NAME}"
|
||||
VALUE "LegalCopyright", "(C) ${CURRENT_YEAR} ${PLUGIN_AUTHOR}"
|
||||
VALUE "OriginalFilename", "${PROJECT_NAME}"
|
||||
VALUE "ProductName", "${PROJECT_NAME}"
|
||||
VALUE "ProductVersion", "${PROJECT_VERSION}"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
0
data/locale/en-US.ini
Normal file
0
data/locale/en-US.ini
Normal file
35
src/plugin-main.c
Normal file
35
src/plugin-main.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
Plugin Name
|
||||
Copyright (C) <Year> <Developer> <Email Address>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include <obs-module.h>
|
||||
#include <plugin-support.h>
|
||||
|
||||
OBS_DECLARE_MODULE()
|
||||
OBS_MODULE_USE_DEFAULT_LOCALE(PLUGIN_NAME, "en-US")
|
||||
|
||||
bool obs_module_load(void)
|
||||
{
|
||||
obs_log(LOG_INFO, "plugin loaded successfully (version %s)",
|
||||
PLUGIN_VERSION);
|
||||
return true;
|
||||
}
|
||||
|
||||
void obs_module_unload(void)
|
||||
{
|
||||
obs_log(LOG_INFO, "plugin unloaded");
|
||||
}
|
||||
39
src/plugin-support.c.in
Normal file
39
src/plugin-support.c.in
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
Plugin Name
|
||||
Copyright (C) <Year> <Developer> <Email Address>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include <plugin-support.h>
|
||||
|
||||
const char *PLUGIN_NAME = "@CMAKE_PROJECT_NAME@";
|
||||
const char *PLUGIN_VERSION = "@CMAKE_PROJECT_VERSION@";
|
||||
|
||||
void obs_log(int log_level, const char *format, ...)
|
||||
{
|
||||
size_t length = 4 + strlen(PLUGIN_NAME) + strlen(format);
|
||||
|
||||
char *template = malloc(length + 1);
|
||||
|
||||
snprintf(template, length, "[%s] %s", PLUGIN_NAME, format);
|
||||
|
||||
va_list(args);
|
||||
|
||||
va_start(args, format);
|
||||
blogva(log_level, template, args);
|
||||
va_end(args);
|
||||
|
||||
free(template);
|
||||
}
|
||||
38
src/plugin-support.h
Normal file
38
src/plugin-support.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Plugin Name
|
||||
Copyright (C) <Year> <Developer> <Email Address>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
extern const char *PLUGIN_NAME;
|
||||
extern const char *PLUGIN_VERSION;
|
||||
|
||||
void obs_log(int log_level, const char *format, ...);
|
||||
extern void blogva(int log_level, const char *format, va_list args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user