Build Instructions

Overview

Building the Steam Audio Unity integration involves the following steps:

  1. Building the native audio plugin (audioplugin_phonon.dll on Windows, for example). This step involves compiling C++ code, and must be done separately on each supported platform.

  2. (Optional) Generating the zip file (steamaudio_unity.zip) for distribution. This step involves running Unity from the command line.

Directory Structure

Below is an overview of the directories contained within the source repository for the Steam Audio Unity plugin:

Directory

Contents

bin/

Compiled binaries placed by the INSTALL target of the build system generated by CMake.

build/

Build scripts and the build system generated by CMake.

dist/

The zip file generated by the PACKAGE target.

doc/

Documentation.

include/

Header files for libraries that the Unity integration depends on.

lib/

Binary library files that the Unity integration depends on.

src/

Source code.

src/native/

C++ source code for the native plugin for the audio engine.

src/project/

C# source code and Unity project for the managed plugin for the game engine and editor.

Building the native plugin

Requirements

To build the native plugin on any platform, you need the following software:

To build the Windows plugin, you will need:

To build the Linux plugin, you will need:

  • g++ 4.8 or later (install using your distribution’s package manager)

  • g++-multilib 4.8 or later if building the 32-bit binaries on a 64-bit system (install using your distribution’s package manager)

  • glibc 2.19 or later

To build the macOS plugin, you will need:

  • Xcode 7.0 or later (install from the Mac App Store)

To build the Android plugin, you will need:

To build the iOS plugin, you will need:

  • Xcode 14.0 or later (install from the Mac App Store)

To build the documentation, you will need:

Preparing the repository

After cloning the Steam Audio Git repository, the first step is to download the Steam Audio API libraries and place them in the correct locations in the Git repository. To do this, run the following from a command prompt in the unity directory of the repository:

$ python setup.py

This will download the appropriate release of the Steam Audio API from GitHub, extract it, and place the files in the appropriate locations.

Building using the build script

To build the plugin, run the following from a command prompt in the unity directory of the repository:

$ cd build
$ python build.py

On Windows, this will generate a Visual Studio 2015 solution for 64-bit Windows (build/windows-vs2015-x64/Phonon.sln) and build it in the Release configuration.

On Linux, this will generate a Makefile for 64-bit Linux (build/linux-x64-release/Makefile) and build it.

On macOS, this will generate an Xcode project (build/osx/Phonon.xcodeproj) and build it in the Release configuration.

On Android, this will generate a Makefile for 32-bit ARM (build/android-armv7-release/Makefile) and build it.

On iOS, this will generate an Xcode project (build/ios/Phonon.xcodeproj) and build it in the Release configuration.

If CMake cannot generate the build system due to missing dependencies, you can run CMake directly and adjust settings that control where CMake looks for dependencies, and which targets it builds.

The Steam Audio build script (build.py) lets you specify the following command line parameters to control its behavior:

-p, --platform NAME

Specifies the target platform. Valid options are windows, linux, osx, android, and ios. Default is the current host platform.

-t, --toolchain NAME

Specifies the compiler version (on Windows only). Valid options are vs2013, vs2015, vs2017, vs2019. Default is vs2015.

-a, --architecture NAME

Specifies the CPU architecture to build for. Valid options are x86 (32-bit Intel, available on Windows, Linux, and Android), x64 (64-bit Intel, available on Windows, Linux, macOS, and Android), armv7 (32-bit ARM, available on Android), and arm64 (64-bit ARM, available on Android and iOS). Default is x64 for Windows, Linux, and macOS; armv7 for Android; and arm64 for iOS.

-c, --configuration NAME

Specifies the build configuration. Valid options are debug and release. Default is release.

-o, --operation NAME

Specifies the CMake operation to perform. Valid options are generate (generates the build system), build (build all targets in the build system), install (runs the INSTALL target, which copies binaries to the bin/ folder), package (runs the PACKAGE target, which generates the zip file and copies it to the dist/ folder), ci_build (which runs generate, then build, then install), and ci_package (which runs generate, then package). Default is generate followed by build.

Building using CMake directly

You can also directly using CMake to generate the build system. This is useful if you need to specify non-default paths for CMake to search for dependencies. To do this, first create the directory in which you want to generate the build system:

$ cd build
$ mkdir windows-vs2019-x64

Now run CMake:

$ cmake ../..

Alternatively, use cmake-gui if you prefer using a GUI to configure various CMake options:

$ cmake-gui ../..

When building for Android, Steam Audio provides the following toolchain files that you can use:

Toolchain File

Platform

build/toolchain_android_armv7.cmake

32-bit ARM

build/toolchain_android_armv8.cmake

64-bit ARM

build/toolchain_android_x86.cmake

32-bit Intel

build/toolchain_android_x64.cmake

64-bit Intel

When building for iOS, Steam Audio provides the following toolchain files that you can use:

Toolchain File

Platform

build/toolchain_ios.cmake

64-bit ARM

Below are some of the CMake options you may want to configure:

Option

Description

STEAMAUDIOUNITY_BUILD_DOCS

TRUE if you want to build documentation, FALSE otherwise.

CMAKE_ANDROID_NDK

Absolute path to the Android NDK.

CMAKE_MAKE_PROGRAM

Absolute path to the make executable in the Android NDK.

Sphinx_EXECUTABLE_DIR

Absolute path to the directory containing the Sphinx executable.

Unity_EXECUTABLE_DIR

Absolute path to the directory containing the Unity editor executable.

Generating the zip file

As an optional step, you can package the plugin, including documentation, into a zip file. To do this, run the following from a command prompt in the unity directory of the repository:

$ cd build
$ python build.py -o install
$ python build.py -o package

This will place the generated zip file in dist/steamaudio_unity.zip.