This documentation is for a prerelease version of O3DE. Click here to switch to the latest release, or select a version from the dropdown.

Version:

Open 3D Engine on Linux

Open 3D Engine (O3DE) includes support for the Linux platform. Learn how to build O3DE tools and projects for the supported versions of Linux using the instructions included here.

Prerequisites

The following instructions assume that you have:

Note:
These instructions use $O3DE_ENGINE to refer to the absolute path where the O3DE source code is located on your local file system.

Create an O3DE project

If you haven’t yet created an O3DE project, do so now using the o3de script. $O3DE_PROJECT_PATH refers to the absolute path of the project and $O3DE_PROJECT_NAME refers to the name of the project.

$O3DE_ENGINE/scripts/o3de.sh create-project --project-path $O3DE_PROJECT_PATH

Refer to Creating Projects Using the Command Line Interface for more information on creating new O3DE projects.

Generate the build folder

Although CMake supports Unix Make Files on Linux, we recommend that you use Ninja as a build system to support multiple configurations in your generated builds. These instructions use “Ninja Multi-Config” as the CMake generator.

Important:
When building using the O3DE pre-build Snap SDK, first export the O3DE_SNAP environment variable so CMake does not attempt to install Python pip requirements and fail. To export the O3DE_SNAP environment variable, run the command export O3DE_SNAP from the command line before running the CMake commands below.

Multiple Config Builds

The following command generates a build folder, build/linux, under the root of the project folder, $O3DE_PROJECT_PATH, by using Ninja as the build generator and clang-12 as the compiler.


cd $O3DE_PROJECT_PATH

cmake -B build/linux -S . -G "Ninja Multi-Config"

Single Config Builds

If you do not need to generate multi-config build folders, you can specify “Unix Makefiles” as the generator for CMake. You will need to specify a configuration at the time of project generation. Valid values for $BUILD_CONFIG include: debug, profile, and release.


cd $O3DE_PROJECT_PATH

cmake -B build/linux -S . -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_CONFIG

Building from command line

Once the build folder is generated, building from command line is the same process as for other platforms.

Important:
When building using the O3DE pre-build Snap SDK, first export the O3DE_SNAP environment variable so CMake does not attempt to install Python pip requirements and fail. To export the O3DE_SNAP environment variable, run the command export O3DE_SNAP from the command line before running the CMake commands below.

Multiple Config Builds

When building a project that was generated using the Ninja Multi-Config generator, include the build configuration in the build command.


cd $O3DE_PROJECT_PATH

cmake --build build/linux --config profile --target $O3DE_PROJECT_NAME.GameLauncher Editor

Single Config Builds

When building a project that was generated using the Unix Makefile generator, CMake will use the configuration that you specified during project generation.


cd $O3DE_PROJECT_PATH

cmake --build build/linux --target $O3DE_PROJECT_NAME.GameLauncher Editor

Advanced Topics

Generating a Compilation Database

To support code completion and other IntelliSense features found in IDEs such as Visual Studio, instruct CMake to generate a compilation database ( compile-command.json ) file as part of the project generation command.

Note:
IDEs can use the compile-command.json only when Unity builds are turned off. Since Unity builds are enabled by default in O3DE, you will need to explicitly turn it off with the -DLY_UNITY_BUILD=OFF argument.

To enable the generation of the compilation database file, include the following arguments in the project generation command:

-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLY_UNITY_BUILD=OFF