From 4d78c82027182af55cf45bd964419d0a662cf637 Mon Sep 17 00:00:00 2001 From: RedworkDE <10944644+RedworkDE@users.noreply.github.com> Date: Mon, 20 Feb 2023 12:28:56 +0100 Subject: [PATCH] Rename page mono->dotnet, Doc build_assemblies args, Note about mono, Reviews, Fixes --- _tools/redirects/redirects.csv | 1 + ...ith_mono.rst => compiling_with_dotnet.rst} | 78 ++++++++++++++++--- contributing/development/compiling/index.rst | 2 +- .../scripting/c_sharp/c_sharp_basics.rst | 3 +- 4 files changed, 73 insertions(+), 11 deletions(-) rename contributing/development/compiling/{compiling_with_mono.rst => compiling_with_dotnet.rst} (66%) diff --git a/_tools/redirects/redirects.csv b/_tools/redirects/redirects.csv index 1e1eb66e2..69c9f25f6 100644 --- a/_tools/redirects/redirects.csv +++ b/_tools/redirects/redirects.csv @@ -25,6 +25,7 @@ source,destination /content/3d/making_trees.html,/tutorials/content/making_trees.html /contributing/_contributing.html,/community/contributing/ /contributing/bug_triage_guidelines.html,/community/contributing/bug_triage_guidelines.html +/contributing/development/compiling/compiling_with_mono.html,/contributing/development/compiling/compiling_with_dotnet.html /contributing/development/core_and_modules/introduction_to_godot_development.html,/contributing/development/core_and_modules/index.html /contributing/doc_and_l10n_guidelines.html,/community/contributing/doc_and_l10n_guidelines.html /contributing/updating_the_class_reference.html,/community/contributing/updating_the_class_reference.html diff --git a/contributing/development/compiling/compiling_with_mono.rst b/contributing/development/compiling/compiling_with_dotnet.rst similarity index 66% rename from contributing/development/compiling/compiling_with_mono.rst rename to contributing/development/compiling/compiling_with_dotnet.rst index 35b70427a..d89ba61ca 100644 --- a/contributing/development/compiling/compiling_with_mono.rst +++ b/contributing/development/compiling/compiling_with_dotnet.rst @@ -1,6 +1,6 @@ -.. _doc_compiling_with_mono: +.. _doc_compiling_with_dotnet: -Compiling with Mono +Compiling with .NET =================== .. highlight:: shell @@ -8,14 +8,22 @@ Compiling with Mono Requirements ------------ -- .NET SDK 6.0 or greater (generally 64 bit) +- `.NET SDK 6.0 `_ or greater + (generally 64 bit) -You can use ``dotnet --version`` to check your .NET version. +You can use ``dotnet --list-sdks`` to check if you have a compatible .NET SDK +installed. -Enable the Mono module +Enable the .NET module ---------------------- -By default, the Mono module is disabled when building. To enable it, add the +.. note:: C# support for Godot has historically used the + `Mono `_ runtime instead of the + `.NET Runtime `_ and internally + many things are still named ``mono`` instead of ``dotnet`` or + otherwise referred to as ``mono``. + +By default, the .NET module is disabled when building. To enable it, add the option ``module_mono_enabled=yes`` to the SCons command line, while otherwise following the instructions for building the desired Godot binaries. @@ -55,8 +63,8 @@ used to generate the Mono glue. Building the managed libraries ------------------------------ -Once you have generated the Mono glue, you can builds the managed libraries with -the ``build_assemblies.py`` script.:: +Once you have generated the Mono glue, you can build the managed libraries with +the ``build_assemblies.py`` script:: ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin @@ -76,6 +84,58 @@ proper functioning and must be distributed together with Godot. More details about this directory in :ref:`Data directory`. +Build Platform +^^^^^^^^^^^^^^ + +Provide the ``--godot-platform=`` argument to control for which +platform specific the libraries are built. Omit this argument to build for the +current system. + +This currently only controls the inclusion of the support for Visual Studio as +an external editor, the libraries are otherwise identical. + +NuGet packages +^^^^^^^^^^^^^^ + +The API assemblies, source generators, and custom MSBuild project SDK are +distributed as NuGet packages. This is all transparent to the user, but it can +make things complicated during development. + +In order to use Godot with a development version of those packages, a local +NuGet source must be created where MSBuild can find them. This can be done with +the .NET CLI: + +:: + + dotnet nuget add source ~/MyLocalNugetSource --name MyLocalNugetSource + +The Godot NuGet packages must be added to that local source. Additionally, we +must make sure there are no other versions of the package in the NuGet cache, as +MSBuild may pick one of those instead. + +In order to simplify this process, the ``build_assemblies.py`` script provides +the following ``--push-nupkgs-local`` option: + +:: + + ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir ./bin --push-nupkgs-local ~/MyLocalNugetSource + +This option ensures the packages will be added to the specified local NuGet +source and that conflicting versions of the package are removed from the NuGet +cache. It's recommended to always use this option when building the C# solutions +during development to avoid mistakes. + +Double Precision Support (REAL_T_IS_DOUBLE) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When building Godot with double precision support, i.e. the ``precision=double`` +argument for scons, the managed libraries must be adjusted to match by passing +the ``--precision=double`` argument: + +:: + + ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir ./bin --push-nupkgs-local ~/MyLocalNugetSource --precision=double + Examples -------- @@ -129,7 +189,7 @@ The name of the data directory for the Godot editor will always be API assemblies and a ``Tools`` subdirectory with the tools required by the editor, like the ``GodotTools`` assemblies and its dependencies. -On macOS, if the Godot editor is distributed as a bundle, ``GodotSharp`` +On macOS, if the Godot editor is distributed as a bundle, the ``GodotSharp`` directory may be placed in the ``.app/Contents/Resources/`` directory inside the bundle. diff --git a/contributing/development/compiling/index.rst b/contributing/development/compiling/index.rst index 8265925b8..3fdc014f8 100644 --- a/contributing/development/compiling/index.rst +++ b/contributing/development/compiling/index.rst @@ -15,6 +15,6 @@ Building from source cross-compiling_for_ios_on_linux compiling_for_uwp compiling_for_web - compiling_with_mono + compiling_with_dotnet optimizing_for_size compiling_with_script_encryption_key diff --git a/tutorials/scripting/c_sharp/c_sharp_basics.rst b/tutorials/scripting/c_sharp/c_sharp_basics.rst index ed317ff16..2f88d3749 100644 --- a/tutorials/scripting/c_sharp/c_sharp_basics.rst +++ b/tutorials/scripting/c_sharp/c_sharp_basics.rst @@ -56,7 +56,8 @@ Download and install the latest stable version of the SDK from the if you are using the 64-bit version of Godot. If you are building Godot from source, make sure to follow the steps to enable -.NET support in your build as outlined in the :ref:`doc_compiling_with_mono` page. +.NET support in your build as outlined in the :ref:`doc_compiling_with_dotnet` +page. Configuring an external editor ------------------------------