README_SETUP.md
(Setup instructions for the editor here).
This guide focuses on the tool and platform sdk installation.
Build instructions for the engine are found here here).
At the very minimum, you need to install the SDK for your host platform (Windows, macOS or Linux)
Here is a table of our supported target platforms, and on which host platform you can build it:
| host↓ target→ | macOS | Linux | Windows | Android | iOS | Hmtl5 | PS4/PS5 | Switch | XBox |
|---|---|---|---|---|---|---|---|---|---|
| macOS | ✅ | ✅ | ✅ | ✅ | |||||
| Linux | ✅ | ✅ | ✅ | ||||||
| Windows (x64) | ✅ | ✅ | ✅ | ✅ | ✅ |
Our build system detects local installations of the platform SDK's.
See more detailed installation details further down in this document.
EMSDK environment variable to locate the local installation.Throughout our build instructions, we refer to commands that should be run in a shell.
While we try to be as vanilla as possible, on Windows we only use git-bash. See instructions below.
git-bashGit (required), and also git-bash.
git-bash is currently our recommended shell for windows. ´git-bash´ can install as a Terminal add on.
It's useful to modify your command prompt to show the status of the repo you're in. E.g. it makes it easier to keep the git branches apart.
You do this by editing the PS1 variable in your shell. Put it in the recommended config for your system (e.g. .zprofile or .bashrc)
Here's a very small improvement on the default prompt, whic shows you the time of the last command, as well as the current git branch name and its status:
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
acolor() {
[[ -n $(git status --porcelain=v2 2>/dev/null) ]] && echo 31 || echo 33
}
export PS1='\t \[\033[32m\]\w\[\033[$(acolor)m\] $(git_branch)\[\033[00m\] $ '
These are not strictly required, but helps install some of the software you need.
<details><summary>Windows...</summary><p>Once it is installed, you can install packages using
brew install <package_name>
apt - (alternatively name apt-get) is a package mananger for Linux. It is the default package manager and is installed by default.Once it is installed, you can install packages using
apt install <package_name>
You can use a package manager or do a manual download and installation.
<details><summary>Windows...</summary><p>Install temurin jdk using winget:
winget install --id EclipseAdoptium.Temurin.25.JDK -e
The JDK bin path is automatically added to PATH environment variable, but you need to sign out and sign in again for it to take effect.
</p></details> <details><summary>Linux...</summary><p>Install temurin jdk using apt-get:
> sudo apt-get install temurin-25-jdk
Once the Java SDK is installed you may need to add <java install path>/Contents/Home/bin to your PATH:
> nano ~/.bashrc
export PATH=<JAVA_INSTALL_PATH>/Contents/Home/bin:$PATH
After that, update the path by reloading the PATH variable:
source ~/.bashrc
Install temurin jdk using brew:
> brew install --cask temurin@25
after installation, it's installed under /Library/Java/JavaVirtualMachines/temurin-<version>.jdk/Contents/Home`
Once the Java SDK is installed you may need to add <java install path>/Contents/Home/bin to your PATH:
> nano ~/.zprofile
export PATH=<JAVA_INSTALL_PATH>/Contents/Home/bin:$PATH
After that, update the path by reloading the PATH variable:
source ~/.zprofile
Download and install the latest JDK 25 (25+36 or later) release from either of these locations:
Finally, verify that Java is installed and working:
> javac -version
You need a 64 bit Python 3 version to build the engine and tools. The latest tested on all platforms is Python 3.10+.
<details><summary>macOS...</summary><p>You need to install a Python3 version from Python downloads.
Once Python has been installed you also need install certificates (for https requests):
> "/Applications/Python\ 3.12/Install\ Certificates.command"
Install Python using winget:
winget install -e --id Python.Python.3.12
Linux comes with a preinstalled version of Python.
</p></details> <details><summary>Manual installation...</summary><p>Install an appropriate version from https://www.python.org/downloads/
</p></details>Finally, verify that Python 3 is installed and working:
> python -V
Git is needed to work with our code base. It is used to push and pull code changes between the code repositories.
<details><summary>Windows...</summary><p>This is not needed if you've installed git-bash
You can download a command line version of Git.
During install, select the option to not do any CR/LF conversion.
You most likely want to set up working with ssh keys as well.
start-ssh-agent (in C:\Program Files\Git\cmd)Alternatively, you can easily create your own key from command line:
$ ssh-keygen -t ed25519 -C "[email protected]"
# Copy the contents of the public file
$ cat ~/.ssh/id_ed25519.pub
# Add the public key to your Github profile (under the Setting tab on your github user profile)
# Test your new key:
$ ssh -T [email protected]
Now you should be able to clone the defold repo from a command prompt:
> git clone [email protected]:defold/defold.git
You can install git using apt-get:
apt-get install git
Git is installed with XCode, but you can also install git using brew:
brew install git
Each platform requires SDK's and other tools (e.g. debuggers)
<details><summary>macOS/iOS...</summary><p>We use XCode for building and debugging macOS + iOS targets.
While XCode is available from the App Store, we recommend logging into your Apple Developer account and downloading it manually from More Downloads.
After downloading XCode, you also need to install the Command line tools:
xcode-select --install
Once installed, verify the installation with
defold$ ./scripts/build.py check_sdk --verbose
Download the Visual Studio Community 2022 version or use the Professional or Enterprise version if you have the proper licence.
When installing, in the "Workloads" tab, select the "Desktop Development with C++"
We also require Clang:
In Visual Studio Installer, under Individual components, select C++ Clang Compiler for Windows and MSBuild support for LLVM (clang-cl) toolset.
Add clang to your PATH. For a default installation, the path to add will likely be C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\bin
There is also an optional 3rd party git client.
Once installed, verify the installation with
defold$ ./scripts/build.py check_sdk --verbose
There is no single "sdk" to install, but a list of libraries that are needed for development.
Development files
Tools
Download and install using apt-get:
apt-get install \
autoconf \
automake \
build-essential \
freeglut3-dev \
libssl-dev \
libtool \
libxi-dev \
libx11-xcb-dev \
libxrandr-dev \
libopenal-dev \
libgl1-mesa-dev \
libglw1-mesa-dev \
libncurses5 \
openssl \
valgrind \
uuid-dev \
xvfb
Once installed, verify the installation with
defold$ ./scripts/build.py check_sdk --verbose
If you're using Ubuntu and it fails to install libncurses5, try:
sudo ln -s /usr/lib/x86_64-linux-gnu/libtinfo.so.5 /usr/lib/libtinfo.so.5
and:
sudo ln -s /usr/lib/x86_64-linux-gnu/libncurses.so.5 /usr/lib/libncurses.so.5
There are two options:
Download and install Android Studio.
Set the ANDROID_HOME environment variable
ANDROID_HOME=/path/to/android/sdkOnce installed, verify the installation with
defold$ ./scripts/build.py check_sdk --verbose --platform=arm64-android
EMSDK environment variable to locate the local installation.
EMSDK=/path/to/emsdk-4.0.7/Once installed, verify the installation with
defold$ ./scripts/build.py check_sdk --verbose --platform=wasm-web
For each console we detect the appropriate environment variables used by each platform. We refer to each vendor's installation notes for their SDK's.
Once installed, verify the installation with
defold$ ./scripts/build.py check_sdk --verbose --platform=...
NOTE: this is not required to build the engine locally!
In order to build Extender images locally, you need access to prepackaged SDK's for each platform.
Due to licensing restrictions the SDKs are not distributed with Defold. You need to provide these from a URL accessible by your local machine so that build.py and the install_sdk command can download and unpack them.
In order to simplify this process we provide scripts to download and package the SDKs Read more about this process here.
The path to the SDKs can either be passed to build.py using the --package-path option or by setting the DM_PACKAGES_URL environment variable.
These tools are generally not needed for a regular build.
<details><summary>Details...</summary><p>In order to build and test the csharp languange bindings locally, you need to install DotNet 9.
<details><summary>Install...</summary><p>There are a few ways to install the DotNet sdk:
Install via https://dotnet.microsoft.com/en-us/download/dotnet/9.0
Install via your package manager
brew search dotnetapt-get install dotnetwinget install Microsoft.DotNet.SDK.9Install via dotnet-install.sh:
<details><summary>Linux/macOS...</summary><p>Bash:
> chmod +x ./dotnet-install.sh
> ./dotnet-install.sh --channel 9.0
PowerShell (Windows):
> ./dotnet-install.ps1 -Channel 9.0
These are needed in some special build scripts (e.g. when rebuilding external source libraries).
brew install wget curl cmake patch
apt-get install wget curl cmake patch
In powershell or bash:
winget install wget curl cmake Ninja-build.Ninja GnuWin32.Patch
This is an optional tool to help speed up building the code by caching the results.
<details><summary>macOS...</summary><p>> brew install ccache
Configure ccache by running (source)
> ccache --max-size=5G
> apt-get install ccache
Configure ccache by running (source)
> ccache --max-size=5G
In powershell:
> winget install ccache
Configure ccache by running (source)
> ccache --max-size=5G
These are rarely used by developers in our build setup. They're mainly used to help unpack some archives and sync source code in a pl
external/bullet3d)brew install 7z dos2unix
apt-get install 7z
In powershell:
winget install 7z dos2unix
It is sometimes possible to cross compile to other systems.
It is possible to build Linux targets using WSL 1.
Install relevant packages (git, java, python, clang etc) using ./scripts/linux/install_wsl_packages.sh.
If also updates your ~/.bashrc with updated paths.
In order to get the proper username of your files, we need to setup WSL for this. Otherwise the git clone won't work in a mounted C: drive folder.
Open (or create) the config file:
sudo nano /etc/wsl.conf
Add these lines:
[automount]
options = "metadata"
And restart your WSL session
The script also sets the DISPLAY=localhost:0.0 which allows you to connect to a local X server.
A popular choice is VCXSRV
</p></details>Build the docker container (Ubuntu). It will use the arch of your current host system.
./scripts/docker/build.sh
Run the guest system in the cwd of choice. E.g. to start setup for building Defold engine for Linux
cd <defold root>
./scripts/docker/run.sh
./scripts/build.py shell
./scripts/build.py install_ext
...