summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreia Gaita <shana@spoiledcat.net>2024-02-05 20:55:06 +0100
committerAndreia Gaita <shana@spoiledcat.net>2024-02-13 22:48:43 +0100
commit21e524a798bf3c3728f63657ff2e7a79f6de9ee6 (patch)
tree5c0cd368101dd87bd1cafc86859a68338e93b0fa
parent3a8524dd923e9d9a79e4979a47fd427388ea7010 (diff)
downloadredot-engine-21e524a798bf3c3728f63657ff2e7a79f6de9ee6.tar.gz
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.
-rw-r--r--modules/mono/config.py10
-rw-r--r--platform/android/detect.py1
-rw-r--r--platform/ios/detect.py1
-rw-r--r--platform/linuxbsd/detect.py1
-rw-r--r--platform/macos/detect.py1
-rw-r--r--platform/windows/detect.py1
6 files changed, 8 insertions, 7 deletions
diff --git a/modules/mono/config.py b/modules/mono/config.py
index 859d77b262..3d087c9e27 100644
--- a/modules/mono/config.py
+++ b/modules/mono/config.py
@@ -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):
if env["arch"].startswith("rv"):
return False
@@ -14,9 +9,10 @@ def can_build(env, platform):
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")
env.add_module_version_string("mono")
diff --git a/platform/android/detect.py b/platform/android/detect.py
index a417ef454b..3da8ee0b62 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -68,6 +68,7 @@ def get_flags():
return [
("arch", "arm64"), # Default for convenience.
("target", "template_debug"),
+ ("supported", ["mono"]),
]
diff --git a/platform/ios/detect.py b/platform/ios/detect.py
index 26d81c8ed6..1f2e935946 100644
--- a/platform/ios/detect.py
+++ b/platform/ios/detect.py
@@ -49,6 +49,7 @@ def get_flags():
("arch", "arm64"), # Default for convenience.
("target", "template_debug"),
("use_volk", False),
+ ("supported", ["mono"]),
]
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index 59cc6e7962..6737c0c4e0 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -65,6 +65,7 @@ def get_doc_path():
def get_flags():
return [
("arch", detect_arch()),
+ ("supported", ["mono"]),
]
diff --git a/platform/macos/detect.py b/platform/macos/detect.py
index b41d2141fb..fe2a0adc60 100644
--- a/platform/macos/detect.py
+++ b/platform/macos/detect.py
@@ -50,6 +50,7 @@ def get_flags():
return [
("arch", detect_arch()),
("use_volk", False),
+ ("supported", ["mono"]),
]
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 801b32140a..12b14ee99e 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -215,6 +215,7 @@ def get_flags():
return [
("arch", arch),
+ ("supported", ["mono"]),
]