From 4b90d162502d65f20a89331898cd8a0b3eea8fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ignacio=20Rold=C3=A1n=20Etcheverry?= Date: Sun, 27 Feb 2022 21:57:52 +0100 Subject: C#: Initial NativeAOT support This commit adds initial support for games exported as NativeAOT shared libraries. At this moment, the NativeAOT runtime is experimental. Additionally, Godot is not trim-safe as it still makes some use of reflection. For the time being, a rd.xml file is needed to prevent code triming: ``` ``` These are the csproj changes for publishing: ``` Shared ``` More info: - https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/compiling.md - https://github.com/dotnet/runtimelab/tree/feature/NativeAOT/samples/NativeLibrary - https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/rd-xml-format.md --- modules/mono/csharp_script.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/mono/csharp_script.cpp') diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 134dd92078..f74c32ba04 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2179,7 +2179,9 @@ bool CSharpScript::_update_exports(PlaceHolderScriptInstance *p_instance_to_upda if (exports_invalidated) #endif { +#ifdef TOOLS_ENABLED exports_invalidated = false; +#endif changed = true; @@ -2222,6 +2224,7 @@ bool CSharpScript::_update_exports(PlaceHolderScriptInstance *p_instance_to_upda } }); +#ifdef TOOLS_ENABLED GDMonoCache::managed_callbacks.ScriptManagerBridge_GetPropertyDefaultValues(this, [](CSharpScript *p_script, GDMonoCache::godotsharp_property_def_val_pair *p_def_vals, int32_t p_count) { for (int i = 0; i < p_count; i++) { @@ -2233,6 +2236,7 @@ bool CSharpScript::_update_exports(PlaceHolderScriptInstance *p_instance_to_upda p_script->exported_members_defval_cache[name] = value; } }); +#endif } } -- cgit v1.2.3