C#: Let platforms signal if they support it or not

Instead of hardcoding platform names that support C#, let platforms
set a flag indicating if they support it. All public platforms
except web already support it, and it's a pain to maintain a patch
for this list just to add additional names of proprietary console
platforms.

This makes adding new platforms or variants or existing platforms
much easier, as the platform can signal what it supports/doesn't
support directly, and we can avoid harcoding platform names.
This commit is contained in:
Andreia Gaita 2024-02-05 20:55:06 +01:00
parent 3a8524dd92
commit 21e524a798
6 changed files with 8 additions and 7 deletions

View file

@ -1,8 +1,3 @@
# Prior to .NET Core, we supported these: ["windows", "macos", "linuxbsd", "android", "web", "ios"]
# Eventually support for each them should be added back.
supported_platforms = ["windows", "macos", "linuxbsd", "android", "ios"]
def can_build(env, platform): def can_build(env, platform):
if env["arch"].startswith("rv"): if env["arch"].startswith("rv"):
return False return False
@ -14,9 +9,10 @@ def can_build(env, platform):
def configure(env): def configure(env):
platform = env["platform"] # Check if the platform has marked mono as supported.
supported = env.get("supported", [])
if platform not in supported_platforms: if not "mono" in supported:
raise RuntimeError("This module does not currently support building for this platform") raise RuntimeError("This module does not currently support building for this platform")
env.add_module_version_string("mono") env.add_module_version_string("mono")

View file

@ -68,6 +68,7 @@ def get_flags():
return [ return [
("arch", "arm64"), # Default for convenience. ("arch", "arm64"), # Default for convenience.
("target", "template_debug"), ("target", "template_debug"),
("supported", ["mono"]),
] ]

View file

@ -49,6 +49,7 @@ def get_flags():
("arch", "arm64"), # Default for convenience. ("arch", "arm64"), # Default for convenience.
("target", "template_debug"), ("target", "template_debug"),
("use_volk", False), ("use_volk", False),
("supported", ["mono"]),
] ]

View file

@ -65,6 +65,7 @@ def get_doc_path():
def get_flags(): def get_flags():
return [ return [
("arch", detect_arch()), ("arch", detect_arch()),
("supported", ["mono"]),
] ]

View file

@ -50,6 +50,7 @@ def get_flags():
return [ return [
("arch", detect_arch()), ("arch", detect_arch()),
("use_volk", False), ("use_volk", False),
("supported", ["mono"]),
] ]

View file

@ -215,6 +215,7 @@ def get_flags():
return [ return [
("arch", arch), ("arch", arch),
("supported", ["mono"]),
] ]