| Crates.io | cargo-obs-build |
| lib.rs | cargo-obs-build |
| version | 2.0.5 |
| created_at | 2024-07-31 12:23:55.589908+00 |
| updated_at | 2025-12-24 00:04:56.469749+00 |
| description | A library and CLI tool used to build the libobs library and put it in the target directory |
| homepage | |
| repository | https://github.com/libobs-rs/libobs-rs |
| max_upload_size | |
| id | 1320884 |
| size | 1,094,143 |
A library and CLI tool for building and installing libOBS binaries. It automatically downloads the correct version of OBS Studio binaries based on your libobs crate version, handling caching and version compatibility.
Note: On Linux, you must build OBS Studio from source and install it manually. This can be automatically be done by cargo-obs-build on Ubuntu, just run cargo-obs-build install. For other platforms refer to these Build Instructions For Linux.
For Windows and macOS, this tool will download prebuilt binaries.
The CLI tool automatically prepares the environment by putting the required OBS libraries in the target directory.
cargo install cargo-obs-build
cargo obs-build build --out-dir ./target/debug # or ./target/release, this should be the directory where your binary will be built
Run cargo obs-build --help for all available options.
You can use cargo-obs-build as a library in your build.rs to automatically download and install OBS binaries during the build process.
Add to your Cargo.toml:
[build-dependencies]
cargo-obs-build = { version = "1.2.4", default-features = false }
Simple Usage (Recommended):
fn main() {
cargo_obs_build::install().expect("Failed to install OBS binaries");
}
Advanced Usage with custom configuration:
use cargo_obs_build::{build_obs_binaries, ObsBuildConfig};
use std::env;
use std::path::PathBuf;
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let target_dir = PathBuf::from(&out_dir)
.parent().unwrap()
.parent().unwrap()
.parent().unwrap()
.join("obs-binaries");
let config = ObsBuildConfig {
out_dir: target_dir,
browser: true, // Include browser support
..Default::default()
};
build_obs_binaries(config).expect("Failed to build OBS binaries");
}
See BUILD_SCRIPT_EXAMPLE.md for more examples and detailed explanations.
You can configure the tool using workspace or package metadata:
[package.metadata] # Can also be [workspace.metadata]
libobs-version = "30.2.2"
libobs-cache-dir = "../obs-build" # Optional, defaults to "obs-build", relative to the Cargo.toml file
GITHUB_TOKEN: Provide a GitHub token to increase the API rate limit. This is especially useful for CI environments.RUST_LOG: Set the logging level (e.g., RUST_LOG=debug).libobs crate versionCache both the obs-build directory and the API cache to avoid re-downloading binaries and reduce API calls:
The library automatically:
obs-build/.api-cache/ (1 day expiration)GitHub Actions Example:
- uses: actions/cache@v3
with:
path: |
obs-build
key: obs-build-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
For detailed CI setup instructions, see CI_SETUP.md.
MIT