SCons: Better validation for platform-specific opt-in drivers
This replaces cryptic compilation errors with a clear error message and early build termination.
This commit is contained in:
parent
5ca419e32c
commit
6e9bcc0f18
|
@ -218,11 +218,11 @@ opts.Add(BoolVariable("deprecated", "Enable compatibility code for deprecated an
|
||||||
opts.Add(EnumVariable("precision", "Set the floating-point precision level", "single", ("single", "double")))
|
opts.Add(EnumVariable("precision", "Set the floating-point precision level", "single", ("single", "double")))
|
||||||
opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True))
|
opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True))
|
||||||
opts.Add(BoolVariable("brotli", "Enable Brotli for decompresson and WOFF2 fonts support", True))
|
opts.Add(BoolVariable("brotli", "Enable Brotli for decompresson and WOFF2 fonts support", True))
|
||||||
opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver", False))
|
opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver on supported platforms", False))
|
||||||
opts.Add(BoolVariable("vulkan", "Enable the vulkan rendering driver", True))
|
opts.Add(BoolVariable("vulkan", "Enable the vulkan rendering driver", True))
|
||||||
opts.Add(BoolVariable("opengl3", "Enable the OpenGL/GLES3 rendering driver", True))
|
opts.Add(BoolVariable("opengl3", "Enable the OpenGL/GLES3 rendering driver", True))
|
||||||
opts.Add(BoolVariable("d3d12", "Enable the Direct3D 12 rendering driver", False))
|
opts.Add(BoolVariable("d3d12", "Enable the Direct3D 12 rendering driver on supported platforms", False))
|
||||||
opts.Add(BoolVariable("metal", "Enable the Metal rendering driver (Apple arm64 only)", False))
|
opts.Add(BoolVariable("metal", "Enable the Metal rendering driver on supported platforms (Apple arm64 only)", False))
|
||||||
opts.Add(BoolVariable("openxr", "Enable the OpenXR driver", True))
|
opts.Add(BoolVariable("openxr", "Enable the OpenXR driver", True))
|
||||||
opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loader dynamically", True))
|
opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loader dynamically", True))
|
||||||
opts.Add(BoolVariable("disable_exceptions", "Force disabling exception handling code", True))
|
opts.Add(BoolVariable("disable_exceptions", "Force disabling exception handling code", True))
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
env.drivers_sources = []
|
env.drivers_sources = []
|
||||||
|
supported = env.get("supported", [])
|
||||||
|
|
||||||
# OS drivers
|
# OS drivers
|
||||||
SConscript("unix/SCsub")
|
SConscript("unix/SCsub")
|
||||||
|
@ -17,6 +18,9 @@ if env["platform"] == "windows":
|
||||||
if not env.msvc:
|
if not env.msvc:
|
||||||
SConscript("backtrace/SCsub")
|
SConscript("backtrace/SCsub")
|
||||||
if env["xaudio2"]:
|
if env["xaudio2"]:
|
||||||
|
if "xaudio2" not in supported:
|
||||||
|
print("Target platform '{}' does not support the XAudio2 audio driver. Aborting.".format(env["platform"]))
|
||||||
|
Exit(255)
|
||||||
SConscript("xaudio2/SCsub")
|
SConscript("xaudio2/SCsub")
|
||||||
|
|
||||||
# Midi drivers
|
# Midi drivers
|
||||||
|
@ -28,12 +32,18 @@ SConscript("winmidi/SCsub")
|
||||||
if env["vulkan"]:
|
if env["vulkan"]:
|
||||||
SConscript("vulkan/SCsub")
|
SConscript("vulkan/SCsub")
|
||||||
if env["d3d12"]:
|
if env["d3d12"]:
|
||||||
|
if "d3d12" not in supported:
|
||||||
|
print("Target platform '{}' does not support the D3D12 rendering driver. Aborting.".format(env["platform"]))
|
||||||
|
Exit(255)
|
||||||
SConscript("d3d12/SCsub")
|
SConscript("d3d12/SCsub")
|
||||||
if env["opengl3"]:
|
if env["opengl3"]:
|
||||||
SConscript("gl_context/SCsub")
|
SConscript("gl_context/SCsub")
|
||||||
SConscript("gles3/SCsub")
|
SConscript("gles3/SCsub")
|
||||||
SConscript("egl/SCsub")
|
SConscript("egl/SCsub")
|
||||||
if env["metal"]:
|
if env["metal"]:
|
||||||
|
if "metal" not in supported:
|
||||||
|
print("Target platform '{}' does not support the Metal rendering driver. Aborting.".format(env["platform"]))
|
||||||
|
Exit(255)
|
||||||
SConscript("metal/SCsub")
|
SConscript("metal/SCsub")
|
||||||
|
|
||||||
# Core dependencies
|
# Core dependencies
|
||||||
|
|
|
@ -11,9 +11,11 @@ def can_build(env, platform):
|
||||||
def configure(env):
|
def configure(env):
|
||||||
# Check if the platform has marked mono as supported.
|
# Check if the platform has marked mono as supported.
|
||||||
supported = env.get("supported", [])
|
supported = env.get("supported", [])
|
||||||
|
|
||||||
if "mono" not in supported:
|
if "mono" not in supported:
|
||||||
raise RuntimeError("This module does not currently support building for this platform")
|
import sys
|
||||||
|
|
||||||
|
print("The 'mono' module does not currently support building for this platform. Aborting.")
|
||||||
|
sys.exit(255)
|
||||||
|
|
||||||
env.add_module_version_string("mono")
|
env.add_module_version_string("mono")
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ def get_flags():
|
||||||
"target": "template_debug",
|
"target": "template_debug",
|
||||||
"use_volk": False,
|
"use_volk": False,
|
||||||
"metal": True,
|
"metal": True,
|
||||||
"supported": ["mono"],
|
"supported": ["metal", "mono"],
|
||||||
"builtin_pcre2_with_jit": False,
|
"builtin_pcre2_with_jit": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ def get_flags():
|
||||||
"arch": detect_arch(),
|
"arch": detect_arch(),
|
||||||
"use_volk": False,
|
"use_volk": False,
|
||||||
"metal": True,
|
"metal": True,
|
||||||
"supported": ["mono"],
|
"supported": ["metal", "mono"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -247,7 +247,7 @@ def get_flags():
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"arch": arch,
|
"arch": arch,
|
||||||
"supported": ["mono"],
|
"supported": ["d3d12", "mono", "xaudio2"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue