summaryrefslogtreecommitdiff
path: root/modules/mono/build_scripts
diff options
context:
space:
mode:
authorIgnacio Roldán Etcheverry <ignalfonsore@gmail.com>2021-12-28 23:25:16 +0100
committerIgnacio Roldán Etcheverry <ignalfonsore@gmail.com>2022-08-22 03:36:51 +0200
commit88e367a4066773a6fbfe2ea25dc2e81d2035d791 (patch)
treea219a4332cb7b4c05daacce718af76347774df77 /modules/mono/build_scripts
parentf88d8902cfc0d6a9441e794eb47611ef4ed0d46c (diff)
C#/netcore: Add base desktop game export implementation
This base implementation is still very barebones but it defines the path for how exporting will work (at least when embedding the .NET runtime). Many manual steps are still needed, which should be automatized in the future. For example, in addition to the API assemblies, now you also need to copy the GodotPlugins assembly to each game project.
Diffstat (limited to 'modules/mono/build_scripts')
-rw-r--r--modules/mono/build_scripts/mono_configure.py44
1 files changed, 25 insertions, 19 deletions
diff --git a/modules/mono/build_scripts/mono_configure.py b/modules/mono/build_scripts/mono_configure.py
index 5d2030f756..39c9d58eee 100644
--- a/modules/mono/build_scripts/mono_configure.py
+++ b/modules/mono/build_scripts/mono_configure.py
@@ -25,7 +25,7 @@ def configure(env, env_mono):
if tools_enabled and not module_supports_tools_on(env["platform"]):
raise RuntimeError("This module does not currently support building for this platform with tools enabled")
- if env["tools"] or env["target"] != "release":
+ if env["tools"]:
env_mono.Append(CPPDEFINES=["GD_MONO_HOT_RELOAD"])
app_host_dir = find_dotnet_app_host_dir(env)
@@ -47,29 +47,33 @@ def configure(env, env_mono):
check_app_host_file_exists("hostfxr.h")
check_app_host_file_exists("coreclr_delegates.h")
- env.Append(LIBPATH=[app_host_dir])
env_mono.Prepend(CPPPATH=app_host_dir)
- libnethost_path = os.path.join(app_host_dir, "libnethost.lib" if os.name == "nt" else "libnethost.a")
+ env.Append(LIBPATH=[app_host_dir])
+
+ # Only the editor build links nethost, which is needed to find hostfxr.
+ # Exported games don't need this logic as hostfxr is bundled with them.
+ if tools_enabled:
+ libnethost_path = os.path.join(app_host_dir, "libnethost.lib" if os.name == "nt" else "libnethost.a")
- if env["platform"] == "windows":
- env_mono.Append(CPPDEFINES=["NETHOST_USE_AS_STATIC"])
+ if env["platform"] == "windows":
+ env_mono.Append(CPPDEFINES=["NETHOST_USE_AS_STATIC"])
- if env.msvc:
- env.Append(LINKFLAGS="libnethost.lib")
+ if env.msvc:
+ env.Append(LINKFLAGS="libnethost.lib")
+ else:
+ env.Append(LINKFLAGS=["-Wl,-whole-archive", libnethost_path, "-Wl,-no-whole-archive"])
else:
- env.Append(LINKFLAGS=["-Wl,-whole-archive", libnethost_path, "-Wl,-no-whole-archive"])
- else:
- is_apple = env["platform"] in ["macos", "ios"]
- # is_macos = is_apple and not is_ios
+ is_apple = env["platform"] in ["macos", "ios"]
+ # is_macos = is_apple and not is_ios
- # if is_ios and not is_ios_sim:
- # env_mono.Append(CPPDEFINES=["IOS_DEVICE"])
+ # if is_ios and not is_ios_sim:
+ # env_mono.Append(CPPDEFINES=["IOS_DEVICE"])
- if is_apple:
- env.Append(LINKFLAGS=["-Wl,-force_load," + libnethost_path])
- else:
- env.Append(LINKFLAGS=["-Wl,-whole-archive", libnethost_path, "-Wl,-no-whole-archive"])
+ if is_apple:
+ env.Append(LINKFLAGS=["-Wl,-force_load," + libnethost_path])
+ else:
+ env.Append(LINKFLAGS=["-Wl,-whole-archive", libnethost_path, "-Wl,-no-whole-archive"])
def find_dotnet_app_host_dir(env):
@@ -156,7 +160,8 @@ def find_app_host_version(dotnet_cmd, search_version_str):
search_version = LooseVersion(search_version_str)
try:
- lines = subprocess.check_output([dotnet_cmd, "--list-runtimes"]).splitlines()
+ env = dict(os.environ, DOTNET_CLI_UI_LANGUAGE="en-US")
+ lines = subprocess.check_output([dotnet_cmd, "--list-runtimes"], env=env).splitlines()
for line_bytes in lines:
line = line_bytes.decode("utf-8")
@@ -188,7 +193,8 @@ def find_dotnet_sdk(dotnet_cmd, search_version_str):
search_version = LooseVersion(search_version_str)
try:
- lines = subprocess.check_output([dotnet_cmd, "--list-sdks"]).splitlines()
+ env = dict(os.environ, DOTNET_CLI_UI_LANGUAGE="en-US")
+ lines = subprocess.check_output([dotnet_cmd, "--list-sdks"], env=env).splitlines()
for line_bytes in lines:
line = line_bytes.decode("utf-8")