obsproject / obs-plugintemplate

GNU General Public License v2.0
285 stars 133 forks source link

OBS Plugin Template

Introduction

The plugin template is meant to be used as a starting point for OBS Studio plugin development. It includes:

Set Up

The plugin project is set up using the included buildspec.json file. The following fields should be customized for an actual plugin:

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:

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:

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:

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 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:

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:

GitHub Actions & CI

Default GitHub Actions workflows are available for the following repository actions:

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:

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.