Browse Source

Merge pull request #535 from neikeq/a

Add documentation for building with the mono module
Rémi Verschelde 7 years ago
parent
commit
3db734cd93
2 changed files with 67 additions and 0 deletions
  1. 66 0
      development/compiling/compiling_with_mono.rst
  2. 1 0
      development/compiling/index.rst

+ 66 - 0
development/compiling/compiling_with_mono.rst

@@ -0,0 +1,66 @@
+.. _doc_compiling_with_mono:
+
+Compiling with Mono
+===================
+
+.. highlight:: shell
+
+Requirements
+------------
+
+-  Mono 5.2.0+
+-  pkg-config
+
+Environment Variables
+---------------------
+
+By default, SCons will try to find Mono in the Windows Registry on Windows or via ``pkg-config`` on other platforms. You can specify a different installation directory by using the following environment variables for the respective ``bits`` option: ``MONO32_PREFIX`` and ``MONO64_PREFIX``.
+
+The specified directory must contain the subdirectories ``bin``, ``include``, and ``lib``.
+
+Enable Mono Module
+--------------------
+
+By default, the mono module is disabled for builds. To enable it you can pass the option ``module_mono_enabled=yes`` to your SCons command.
+
+Generate The Glue
+-------------------
+
+The glue sources are the wrapper functions that will be called by the managed side. In order to generate them, first, you must build Godot with the options ``tools=yes`` and ``mono_glue=no``:
+
+::
+
+    scons p=<platform> tools=yes module_mono_enabled=yes mono_glue=no
+
+After the build finishes, you need to run the compiled executable with the parameter ``--generate-mono-glue`` followed by the path to an output directory. This path must be ``modules/mono/glue`` in the Godot directory.
+
+::
+
+    godot --generate-mono-glue modules/mono/glue
+
+This command will tell Godot to generate the file *modules/mono/glue/mono_glue.gen.cpp*. Once this file is generated, you can build Godot for all the desired targets without the need to repeat this process.
+
+Notes
+^^^^^
+-  **Do not** build normal binaries with ``mono_glue=no``. This option disables C# scripting and therefore must only be used for the temporary binary that will be used to generate the glue. Godot should print a message at startup warning you about this.
+-  The glue sources must be regenerated every time the ClassDB API changes. If there is an API mismatch with the generated glue, Godot will print an error at startup.
+
+Example (x11)
+-------------
+
+::
+
+    # Build temporary binary
+    scons p=x11 tools=yes module_mono_enabled=yes mono_glue=no
+    # Generate glue sources
+    bin/godot.x11.tools.64 --generate-mono-glue modules/mono/glue
+
+    ### Build binaries normally
+    # Editor
+    scons p=x11 target=release_debug tools=yes module_mono_enabled=yes
+    # Export templates
+    scons p=x11 target=debug tools=no module_mono_enabled=yes
+    scons p=x11 target=release tools=no module_mono_enabled=yes
+
+If everything went well, apart from the normal output, SCons should have also built the *GodotSharpTools.dll* assembly and copied it together with the mono runtime shared library to the ``bin`` subdirectory.
+

+ 1 - 0
development/compiling/index.rst

@@ -14,5 +14,6 @@ Compiling
    cross-compiling_for_ios_on_linux
    compiling_for_uwp
    compiling_for_web
+   compiling_with_mono
    batch_building_templates
    packaging_godot