Build Instructions¶
Overview¶
Building the Steam Audio Unity integration involves the following steps:
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.(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 |
---|---|
|
Compiled binaries placed by the |
|
Build scripts and the build system generated by CMake. |
|
The zip file generated by the |
|
Documentation. |
|
Header files for libraries that the Unity integration depends on. |
|
Binary library files that the Unity integration depends on. |
|
Source code. |
|
C++ source code for the native plugin for the audio engine. |
|
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:
Python (https://www.python.org)
CMake 3.17 or later (https://cmake.org)
To build the Windows plugin, you will need:
Visual Studio 2013 or later (https://visualstudio.microsoft.com)
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:
Android SDK for platform 25 (Android 7.1 Nougat) or later (https://developer.android.com/studio)
Android NDK (install using the Android SDK Manager)
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:
Sphinx (https://www.sphinx-doc.org)
Sphinx Read The Docs theme (https://sphinx-rtd-theme.readthedocs.io)
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
, andios
. Default is the current host platform.- -t, --toolchain NAME
Specifies the compiler version (on Windows only). Valid options are
vs2013
,vs2015
,vs2017
,vs2019
. Default isvs2015
.- -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), andarm64
(64-bit ARM, available on Android and iOS). Default isx64
for Windows, Linux, and macOS;armv7
for Android; andarm64
for iOS.- -c, --configuration NAME
Specifies the build configuration. Valid options are
debug
andrelease
. Default isrelease
.- -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 theINSTALL
target, which copies binaries to thebin/
folder),package
(runs thePACKAGE
target, which generates the zip file and copies it to thedist/
folder),ci_build
(which runsgenerate
, thenbuild
, theninstall
), andci_package
(which runsgenerate
, thenpackage
). Default isgenerate
followed bybuild
.
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 |
---|---|
|
32-bit ARM |
|
64-bit ARM |
|
32-bit Intel |
|
64-bit Intel |
When building for iOS, Steam Audio provides the following toolchain files that you can use:
Toolchain File |
Platform |
---|---|
|
64-bit ARM |
Below are some of the CMake options you may want to configure:
Option |
Description |
---|---|
|
|
|
Absolute path to the Android NDK. |
|
Absolute path to the |
|
Absolute path to the directory containing the Sphinx executable. |
|
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
.