Overview
Thexb (xenia-build) script is a Python-based build tool that orchestrates the entire Xenia build process. It wraps premake5, git operations, and platform-specific build tools.
Requirements
- Python 3.9+ (64-bit)
- Git
- Platform-specific build tools (Visual Studio, Clang, etc.)
Core Commands
setup
Initializes the build environment by setting up git submodules and running premake.Target OS for cross-compilation (e.g.,
android)- Initializes and updates git submodules
- Runs premake to generate platform-specific project files
- Generates
build/version.hwith git version information
build
Builds the project using the platform’s native build tools.Build configuration:
debug, checked, or releaseSpecific target(s) to build. Can be specified multiple times.
Forces a full rebuild (clean + build)
Skips running premake before building
Compiler toolchain:
clang, gcc, or mscpremake
Runs premake to update project files without building.Compiler toolchain:
clang, gcc, or mscDevelopment environment:
vs2022, xcode4, cmake, etc.Target OS for cross-compilation
devenv
Runs premake and opens the development environment (IDE).- Windows: Opens Visual Studio with
build/xenia.sln - macOS: Opens Xcode
- Linux: Opens CLion (if available), otherwise CodeLite
pull
Pulls the latest changes from the repository, updates submodules, and runs premake.Merges instead of rebasing on canary_experimental branch
Target OS for premake
- Switches to
canary_experimentalbranch - Pulls latest changes (with rebase by default)
- Updates git submodules
- Runs premake to update project files
Code Quality Commands
format
Formats staged code using clang-format 19.Format all files, not just changed files
Format all files changed relative to origin/canary_experimental
clang-format version 19 is required. The script will automatically detect the correct version.
lint
Checks for lint errors using clang-format without modifying files.Lint all files, not just changed files
Lint files changed relative to origin/canary_experimental
style
Runs cpplint style checker on all code.tidy
Runs clang-tidy static analyzer on all code.Applies suggested fixes where possible
Target OS for compilation database
Maintenance Commands
clean
Removes intermediate files and build outputs.premake clean to remove build artifacts while preserving the build directory structure.
nuke
Removes all build output and performs a hard git reset.Testing Commands
test
Runs automated unit tests.Build configuration to test
Specific test target(s) to run
Don’t build before running tests
Don’t stop when a test fails; run all tests
xenia-base-testsxenia-cpu-ppc-tests
gputest
Runs automated GPU diff tests against reference imagery.Build configuration to test
Don’t build before running tests
Update all reference imagery
Create reference files for new traces
gentests
Generates test binaries from PowerPC assembly files.- Finds all
.sassembly files starting withinstr_orseq_insrc/ - Assembles them using PowerPC binutils
- Generates test binaries in
src/xenia/cpu/ppc/testing/bin/
.s test files.
Advanced Commands
buildshaders
Generates shader binaries for inclusion in C++ files.Shader target:
dxbc (Direct3D) or spirv (Vulkan). Can specify multiple.dxbc- Direct3D 12 Shader Model 5.1 (Windows only)spirv- Vulkan SPIR-V (all platforms)
Requirements:
- DXBC: Windows with FXC (from Windows SDK)
- SPIR-V:
VULKAN_SDKenvironment variable set, with glslangValidator and spirv-opt
stub
Creates new source files with copyright headers.Generate a single source file at the specified path
Generate a class pair (.cc and .h) at the specified path
Target OS for premake
src/xenia/. The command will:
- Generate files with copyright headers
- Run premake to update project files
Common Workflows
First-Time Setup
Daily Development
Before Committing
Clean Build
Passing Arguments to Build Tools
You can pass additional arguments to the underlying build tools using--:
Environment Variables
Linux/macOS
| Variable | Default | Description |
|---|---|---|
CC | clang | C compiler |
CXX | clang++ | C++ compiler |
VULKAN_SDK | - | Path to Vulkan SDK (required for shader builds) |
Windows
| Variable | Description |
|---|---|
VSVERSION | Visual Studio version (auto-detected) |
VULKAN_SDK | Path to Vulkan SDK (required for shader builds) |
Troubleshooting
Command not found: xb
Command not found: xb
Use the full Python command:Or add the xenia-canary directory to your PATH.
Python version error
Python version error
Ensure you have Python 3.9+ 64-bit:
Visual Studio not found (Windows)
Visual Studio not found (Windows)
Install Visual Studio 2022 with C++ development tools. The script uses
vswhere.exe to locate it.Clang not found (Linux)
Clang not found (Linux)
Install Clang 19 and set environment variables:
clang-format version mismatch
clang-format version mismatch
Install clang-format 19:Ubuntu/Debian:Windows:
Install via Visual Studio or download LLVM 19.
Quick Reference
| Command | Description |
|---|---|
xb setup | Initialize build environment |
xb build | Build the project |
xb build --config=release | Build release version |
xb devenv | Open IDE |
xb pull | Update from repository |
xb premake | Regenerate project files |
xb format | Format staged code |
xb lint | Check code formatting |
xb test | Run tests |
xb clean | Remove build artifacts |
xb nuke | Nuclear reset (destructive) |
Next Steps
Windows Build
Detailed Windows build guide
Linux Build
Linux build instructions
Build Setup
Build system overview
