This should always have been part of the code, but hey - we learn at some point and improve ourselves.
9 KiB
Building
This document intends to guide you through the process of building StreamFX. It requires understanding of the tools used, and may require you to learn tools yourself before you can advance further in the guide. It is intended to be used by developers and contributors.
Building Bundled
The main method to build StreamFX is to first set up an OBS Studio copy and then integrate the StreamFX repository into it.
- Uninstall any currently installed versions of StreamFX to prevent conflicts.
- Follow the OBS Studio build guide for automated building on your platform of choice.
- MacOS: You will need to use the XCode generator to build StreamFX as the Ninja generator does not support the flags StreamFX requires.
- Integrate StreamFX into the OBS Studio build flow:
- Navigate to either of these directories:
- With UI:
<obs studio source>/UI/frontend-plugins
- Without UI:
<obs studio source>/plugins
- With UI:
- Open a
git
enabled shell (git-bash on windows). - Run
git submodule add 'https://github.com/Xaymar/obs-StreamFX.git' streamfx
. - Run
git submodule update --init --recursive
. - Append the line
add_subdirectory(streamfx)
to theCMakeLists.txt
file in the same directory.
- Navigate to either of these directories:
- Run the same script(s) from step 2 again.
- Done. StreamFX is now part of the build.
Building CI-Style
This method is designed for continuous integration and releases, and requires significant knowledge of CMake, OBS, and various other tools. Additionally it is not guaranteed to work on every machine, as it is only designed for use in continuous integration and nowhere else. It may even stop being maintained entirely with no warning whatsoever. You are entirely on your own when you choose this method.
Install Prerequisites / Dependencies
- Git
- Debian / Ubuntu:
sudo apt install git
- Debian / Ubuntu:
- CMake 3.20 (or newer)
- Debian / Ubuntu:
sudo apt install cmake
- Debian / Ubuntu:
- A compatible Compiler:
- Windows
Visual Studio 2019 (or newer) - MacOS
Xcode 11.x (or newer) for x86_64
Xcode 12.x (or newer) for arm64 - Debian / Ubuntu
- Essential Build Tools:
sudo apt install build-essential pkg-config checkinstall make ninja-build
- One of:
- GCC 11 (or newer)
sudo apt install gcc-11 g++-11
- LLVM Clang 14 (or newer)
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
- GCC 11 (or newer)
- One of:
- Essential Build Tools:
- Windows
- Qt 6:
- Windows
A Node.JS based tool is provided toread and parse the/third-party/obs-studio/buildspec.json
file. See/.github/workflows/main.yml
on usage and output parsing. - MacOS
A Node.JS based tool is provided toread and parse the/third-party/obs-studio/buildspec.json
file. See/.github/workflows/main.yml
on usage and output parsing. - Linux:
- Debian / Ubuntu:
sudo apt install qt6-base-dev qt6-base-private-dev libqt6svg6-dev
- Debian / Ubuntu:
- Windows
- CURL:
- Windows
A Node.JS based tool is provided toread and parse the/third-party/obs-studio/buildspec.json
file. See/.github/workflows/main.yml
on usage and output parsing. - MacOS
A Node.JS based tool is provided toread and parse the/third-party/obs-studio/buildspec.json
file. See/.github/workflows/main.yml
on usage and output parsing. - Debian / Ubuntu:
sudo apt install libcurl4-openssl-dev
- Windows
- FFmpeg (Optional, for FFmpeg component only):
- Windows
A Node.JS based tool is provided toread and parse the/third-party/obs-studio/buildspec.json
file. See/.github/workflows/main.yml
on usage and output parsing. - MacOS
A Node.JS based tool is provided toread and parse the/third-party/obs-studio/buildspec.json
file. See/.github/workflows/main.yml
on usage and output parsing. - Debian / Ubuntu
sudo apt install libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev
- Windows
- LLVM (Optional, for clang-format and clang-tidy integration only):
- Debian / Ubuntu
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" all
- Debian / Ubuntu
- InnoSetup (Optional, for Windows installer only)
Cloning the Project
Using your preferred tool of choice for git, clone the repository including all submodules into a directory. If you use git directly, then you can clone the entire project with git clone --recursive https://github.com/Xaymar/obs-StreamFX.git streamfx
.
Configuring with CMake
There are two ways to handle this step, with the GUI variant of CMake and with the command line version of CMake. This guide will focus on the GUI variant, but all the steps below can be done with the command line version as well.
- Launch CMake-GUI and wait for it to open.
- Click the button named
Browse Build
and point it at an empty folder. For example, create a folder in the project calledbuild
and select that folder. - Click the button named
Browse Source
and point it at the project itself. - Click the button named
Configure
, select your preferred Generator (the default is usually fine), and wait for it to complete. This will most likely result in an error which is expected. - Adjust the variables in the variable list as necessary. Take a look at the documentation for what each option does.
- Click the button named
Generate
, which will also runConfigure
. Both together should succeed if you did everything correctly. - If available, you can now click the button named
Open Project
to immediately jump into your IDE of choice.
CMake Options
The project is intended to be versatile and configurable, so we offer almost everything to be configured on a silver platter directly in CMake (if possible). If StreamFX detects that it is being built together with other projects, it will automatically prefix all options with `StreamFX_` to prevent collisions.
Generic
GIT
(not prefixed)
Path to thegit
binary on your system, for use with features that require git during configuration and generation.VERSION
Set or override the version of the project with a custom one. Allowed formats are: SemVer 2.0.0, CMake.
Code
ENABLE_CLANG
Enable integration ofclang-format
andclang-tidy
CLANG_PATH
(not prefixed, only withENABLE_CLANG
)
Path to theclang
installation containingclang-format
andclang-tidy
. Only used as a hint.CLANG_FORMAT_PATH
andCLANG_TIDY_PATH
(not prefixed) Path toclang-format
andclang-tidy
that will be used.
Dependencies
LibObs_DIR
Path to the obs-studio libraries.Qt5_DIR
,Qt6_DIR
orQt_DIR
(autodetect)
Path to Qt5 (OBS Studio 27.x and lower) or Qt6 (OBS Studio 28.x and higher).FFmpeg_DIR
Path to compatible FFmpeg libraries and headers.CURL_DIR
Path to compatible CURL libraries and headers.AOM_DIR
Path to compatible AOM libraries and headers.
Compiling
ENABLE_FASTMATH
Enable fast math optimizations if the compiler supports them. This trades precision for performance, and is usually good enough anyway.ENABLE_LTO
Enable link time optimization for faster binaries in exchange for longer build times.ENABLE_PROFILING
Enable CPU and GPU profiling code, this option reduces performance drastically.TARGET_*
Specify which architecture target the generated binaries will use.
Components
COMPONENT_<NAME>
Enable the component by the given name.
Installing & Packaging
These options are only available in CI-Style mode.
CMAKE_INSTALL_PREFIX
The path in which installed content should be placed when building theinstall
target.STRUCTURE_PACKAGEMANAGER
If enabled will install files in a layout compatible with package managers.STRUCTURE_UNIFIED
Enable to install files in a layout compatible with an OBS Studio plugin manager.PACKAGE_NAME
The name of the packaged archive, excluding the prefix, suffix and extension.PACKAGE_PREFIX
The path in which the packages should be placed.PACKAGE_SUFFIX
The suffix to attach to the name, before the file extension. If left blank will attach the current version string to the package.STRUCTURE_UNIFIED
Enable to replace the PACKAGE_ZIP target with a target that generates a single.obs
file instead.