> ## Documentation Index
> Fetch the complete documentation index at: https://docs.daydream.live/llms.txt
> Use this file to discover all available pages before exploring further.

# Building from Source

> Build the Daydream OBS plugin for development

# Building from Source

This guide is for developers who want to build the Daydream OBS plugin from source code.

<Note>
  For most users, we recommend downloading the pre-built releases from
  [GitHub](https://github.com/daydreamlive/daydream-obs/releases).
</Note>

## Prerequisites

| Tool               | Version       |
| ------------------ | ------------- |
| CMake              | 3.28 or later |
| Platform toolchain | See below     |

### Platform Toolchains

| Platform | Toolchain                |
| -------- | ------------------------ |
| macOS    | Xcode Command Line Tools |
| Windows  | Visual Studio 2022       |
| Linux    | GCC 11+ or Clang 14+     |

## macOS

### Build

```bash theme={null}
# Clone the repository
git clone https://github.com/daydreamlive/daydream-obs.git
cd daydream-obs

# Configure and build
cmake --preset macos
cmake --build build_macos --config Debug
```

### Install for Development

Create a symlink for rapid iteration:

```bash theme={null}
ln -sf "$(pwd)/build_macos/Debug/daydream-obs.plugin" \
  ~/Library/Application\ Support/obs-studio/plugins/
```

Now when you rebuild, OBS will automatically load the new version (after restart).

### Build Release

```bash theme={null}
cmake --build build_macos --config Release
```

The plugin will be at `build_macos/Release/daydream-obs.plugin`.

## Windows

### Build

```bash theme={null}
# Clone the repository
git clone https://github.com/daydreamlive/daydream-obs.git
cd daydream-obs

# Configure and build
cmake --preset windows-x64
cmake --build build_windows --config Release
```

### Install

Copy the built plugin to OBS:

```bash theme={null}
copy build_windows\Release\daydream-obs.dll ^
  "%APPDATA%\obs-studio\plugins\daydream-obs\bin\64bit\"
```

Or open the solution in Visual Studio:

```bash theme={null}
start build_windows\daydream-obs.sln
```

## Linux

### Dependencies

```bash theme={null}
# Ubuntu/Debian
sudo apt install build-essential cmake libobs-dev

# Fedora
sudo dnf install gcc-c++ cmake obs-studio-devel

# Arch
sudo pacman -S base-devel cmake obs-studio
```

### Build

```bash theme={null}
# Clone the repository
git clone https://github.com/daydreamlive/daydream-obs.git
cd daydream-obs

# Configure and build
cmake --preset ubuntu-x86_64
cmake --build build_ubuntu
```

### Install

```bash theme={null}
mkdir -p ~/.config/obs-studio/plugins/daydream-obs/bin/64bit
cp build_ubuntu/daydream-obs.so \
  ~/.config/obs-studio/plugins/daydream-obs/bin/64bit/
```

## Project Structure

```
daydream-obs/
├── CMakeLists.txt           # Build configuration
├── CMakePresets.json        # Platform presets
├── src/
│   ├── daydream-filter.c    # Main OBS filter
│   ├── daydream-api.c       # Daydream API client
│   ├── daydream-auth.c      # Authentication
│   ├── daydream-encoder.c   # Video encoding
│   ├── daydream-decoder.c   # Video decoding
│   ├── daydream-broadcaster.c  # WHIP client
│   └── daydream-framebuffer.c  # Frame handling
├── lib/                     # Dependencies
└── assets/                  # Images and resources
```

## Development Tips

### Logging

The plugin uses OBS's logging system:

```c theme={null}
blog(LOG_INFO, "[Daydream] Connected to stream %s", stream_id);
blog(LOG_WARNING, "[Daydream] Reconnecting...");
blog(LOG_ERROR, "[Daydream] Failed: %s", error_message);
```

View logs in OBS: **Help** → **Log Files** → **View Current Log**

### Debugging

On macOS, you can attach a debugger:

```bash theme={null}
# Start OBS with debugger
lldb /Applications/OBS.app/Contents/MacOS/OBS
```

On Windows, attach Visual Studio to the running OBS process.

### Hot Reload

OBS caches plugins, so you need to restart OBS after rebuilding. For faster iteration:

1. Use a Debug build
2. Symlink the plugin (macOS) or copy after each build
3. Restart OBS to test changes

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Submit a pull request

See the [GitHub repository](https://github.com/daydreamlive/daydream-obs) for contribution guidelines.

## Next Steps

* [Installation](/sdks/obs/installation) - User installation guide
* [Features](/sdks/obs/features) - Plugin features
* [GitHub Repository](https://github.com/daydreamlive/daydream-obs) - Source code and issues
