2019-07-04 17:54:14 +02:00
# Mono build scripts for Godot
This repository contains scripts for building the Mono runtime to use with Godot Engine
2019-11-10 04:58:04 +01:00
## Command-line options
2019-07-04 22:56:29 +02:00
2019-11-10 04:58:04 +01:00
**Requires Python 3.7 or higher**
2019-07-04 22:56:29 +02:00
2019-11-10 04:58:04 +01:00
These scripts are based on the Mono [sdks ](https://github.com/mono/mono/tree/master/sdks ) makefiles, with some changes to work well with Godot. Some platforms or targets depend on files from the `sdks` directory in the Mono source repository. This directory may be missing from tarballs. If that's the case, cloning the git repository may be needed. [This table ](https://www.mono-project.com/docs/about-mono/versioning/#mono-source-versioning ) can be used to determine the branch for a specific version of Mono.
2020-03-11 01:23:59 +01:00
Some patches need to be applied to the Mono sources before building. This can be done by running `python ./patch_mono.py` .
2019-11-10 04:58:04 +01:00
Run `python SCRIPT.py --help` for the full list of command line options.
By default, the scripts will install the resulting files to `$HOME/mono-installs` .
A custom output directory can be specified with the `--install-dir` option.
When cross-compiling to Windows, `--mxe-prefix` must be specified. For example, with the `mingw-w64` package installed on Ubuntu, one can pass `--mxe-prefix=/usr` .
A path to the Mono source tree must be provided with the `--mono-sources` option or with the `MONO_SOURCE_ROOT` environment variable:
```bash
export MONO_SOURCE_ROOT=$HOME/git/mono
```
### Notes
- Python 3.7 or higher is required.
2020-03-11 01:23:59 +01:00
- OSXCROSS is supported expect for building the Mono cross-compilers.
2019-11-10 04:58:04 +01:00
- Building on Windows is not supported. It's possible to use Cygwin or WSL (Windows Subsystem for Linux) but this hasn't been tested.
## Desktop
```bash
# Build the runtimes for 32-bit and 64-bit Linux.
2020-01-29 13:00:08 +01:00
./linux.py configure --target=i686 --target=x86_64
./linux.py make --target=i686 --target=x86_64
2019-11-10 04:58:04 +01:00
# Build the runtimes for 32-bit and 64-bit Windows.
2020-01-29 13:00:08 +01:00
./windows.py configure --target=i686 --target=x86_64 --mxe-prefix=/usr
./windows.py make --target=i686 --target=x86_64 --mxe-prefix=/usr
2019-11-10 04:58:04 +01:00
# Build the runtime for 64-bit macOS.
2020-01-29 13:00:08 +01:00
./osx.py configure --target=x86_64
./osx.py make --target=x86_64
2019-11-10 04:58:04 +01:00
```
2020-01-29 13:00:08 +01:00
_AOT cross-compilers for desktop platforms cannot be built with these scripts yet._
2019-11-10 04:58:04 +01:00
## Android
2019-07-04 22:56:29 +02:00
```bash
2019-11-10 04:58:04 +01:00
# These are the default values. This step can be omitted if SDK and NDK root are in this location.
2019-07-04 22:56:29 +02:00
export ANDROID_SDK_ROOT=$HOME/Android/Sdk
export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk-bundle
2019-11-10 04:58:04 +01:00
# Build the runtime for all supported Android ABIs.
./android.py configure --target=all-runtime
./android.py make --target=all-runtime
# Build the AOT cross-compilers targeting all supported Android ABIs.
./android.py configure --target=all-cross
./android.py make --target=all-cross
# Build the AOT cross-compilers for Windows targeting all supported Android ABIs.
./android.py configure --target=all-cross-win --mxe-prefix=/usr
./android.py make --target=all-cross-win --mxe-prefix=/usr
```
The option `--target=all-runtime` is a shortcut for `--target=armeabi-v7a --target=x86 --target=arm64-v8a --target=x86_64` . The equivalent applies for `all-cross` and `all-cross-win` .
2020-03-11 01:23:59 +01:00
# iOS
```bash
# Build the runtime for the iPhone simulator.
./ios.py configure --target=x86_64
./ios.py make --target=x86_64
# Build the runtime for the iPhone device.
./ios.py configure --target=arm64
./ios.py make --target=arm64
# Build the AOT cross-compiler targeting the iPhone device.
./ios.py configure --target=cross-arm64
./ios.py make --target=cross-arm64
```
The runtime can also be built an OSXCROSS iOS toolchain. The `--ios-toolchain` and `--ios-sdk` options
are the equivalent of the Godot SCons options `IPHONEPATH` and `IPHONESDK` respectively.
The cross compiler cannot be built with OSXCROSS yet.
2019-11-10 04:58:04 +01:00
## WebAssembly
Just like with Godot, an active Emscripten SDK is needed for building the Mono WebAssembly runtime.
Some patches may need to be applied to the Emscripten SDK before building Mono. This can be done by running `./patch_emscripten.py` .
```bash
# Build the runtime for WebAssembly.
./wasm.py configure --target=runtime
./wasm.py make --target=runtime
```
_AOT cross-compilers for WebAssembly cannot be built with this script yet._
2019-07-04 22:56:29 +02:00
2019-11-10 04:58:04 +01:00
## Base Class library
```bash
# Build the Desktop BCL.
./bcl.py make --product=desktop
2020-01-29 12:27:35 +01:00
# Build the Desktop BCL for Windows.
./bcl.py make --product=desktop-win32
2019-11-10 04:58:04 +01:00
# Build the Android BCL.
./bcl.py make --product=android
2020-03-11 01:23:59 +01:00
# Build the iOS BCL.
./bcl.py make --product=ios
2019-11-10 04:58:04 +01:00
# Build the WebAssembly BCL.
./bcl.py make --product=wasm
2019-07-04 22:56:29 +02:00
```
2019-11-10 04:58:04 +01:00
## Reference Assemblies
2019-07-04 22:56:29 +02:00
2019-11-10 04:58:04 +01:00
```bash
./reference_assemblies.py install
```