config.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. supported_platforms = ["windows", "osx", "x11", "server", "android", "haiku", "javascript", "iphone"]
  2. def can_build(env, platform):
  3. return not env["arch"].startswith("rv")
  4. def configure(env):
  5. platform = env["platform"]
  6. if platform not in supported_platforms:
  7. raise RuntimeError("This module does not currently support building for this platform")
  8. env.use_ptrcall = True
  9. env.add_module_version_string("mono")
  10. from SCons.Script import BoolVariable, PathVariable, Variables, Help
  11. default_mono_static = platform in ["iphone", "javascript"]
  12. default_mono_bundles_zlib = platform in ["javascript"]
  13. envvars = Variables()
  14. envvars.Add(
  15. PathVariable(
  16. "mono_prefix",
  17. "Path to the Mono installation directory for the target platform and architecture",
  18. "",
  19. PathVariable.PathAccept,
  20. )
  21. )
  22. envvars.Add(
  23. PathVariable(
  24. "mono_bcl",
  25. "Path to a custom Mono BCL (Base Class Library) directory for the target platform",
  26. "",
  27. PathVariable.PathAccept,
  28. )
  29. )
  30. envvars.Add(BoolVariable("mono_static", "Statically link Mono", default_mono_static))
  31. envvars.Add(BoolVariable("mono_glue", "Build with the Mono glue sources", True))
  32. envvars.Add(BoolVariable("build_cil", "Build C# solutions", True))
  33. envvars.Add(
  34. BoolVariable("copy_mono_root", "Make a copy of the Mono installation directory to bundle with the editor", True)
  35. )
  36. # TODO: It would be great if this could be detected automatically instead
  37. envvars.Add(
  38. BoolVariable(
  39. "mono_bundles_zlib", "Specify if the Mono runtime was built with bundled zlib", default_mono_bundles_zlib
  40. )
  41. )
  42. envvars.Update(env)
  43. Help(envvars.GenerateHelpText(env))
  44. if env["mono_bundles_zlib"]:
  45. # Mono may come with zlib bundled for WASM or on newer version when built with MinGW.
  46. print("This Mono runtime comes with zlib bundled. Disabling 'builtin_zlib'...")
  47. env["builtin_zlib"] = False
  48. thirdparty_zlib_dir = "#thirdparty/zlib/"
  49. env.Prepend(CPPPATH=[thirdparty_zlib_dir])
  50. def get_doc_classes():
  51. return [
  52. "CSharpScript",
  53. "GodotSharp",
  54. ]
  55. def get_doc_path():
  56. return "doc_classes"
  57. def is_enabled():
  58. # The module is disabled by default. Use module_mono_enabled=yes to enable it.
  59. return False