Browse Source

Mono: Add mono_bcl SCons option for a custom BCL location

Makes it let's bothersome to work with builds from our
godotengine/godot-mono-builds scripts, as they write the
BCL into an output directory separate from the runtime
(which is good as two runtimes may share the same BCL).

(cherry picked from commit dd5ace219d3a718938cd4262625129decc8b8e8a)
Ignacio Etcheverry 4 years ago
parent
commit
a624448197
2 changed files with 12 additions and 3 deletions
  1. 4 3
      modules/mono/build_scripts/mono_configure.py
  2. 8 0
      modules/mono/config.py

+ 4 - 3
modules/mono/build_scripts/mono_configure.py

@@ -93,6 +93,7 @@ def configure(env, env_mono):
     copy_mono_root = env["copy_mono_root"]
     copy_mono_root = env["copy_mono_root"]
 
 
     mono_prefix = env["mono_prefix"]
     mono_prefix = env["mono_prefix"]
+    mono_bcl = env["mono_bcl"]
 
 
     mono_lib_names = ["mono-2.0-sgen", "monosgen-2.0"]
     mono_lib_names = ["mono-2.0-sgen", "monosgen-2.0"]
 
 
@@ -393,7 +394,7 @@ def configure(env, env_mono):
 
 
         if tools_enabled:
         if tools_enabled:
             # Only supported for editor builds.
             # Only supported for editor builds.
-            copy_mono_root_files(env, mono_root)
+            copy_mono_root_files(env, mono_root, mono_bcl)
 
 
 
 
 def make_template_dir(env, mono_root):
 def make_template_dir(env, mono_root):
@@ -426,7 +427,7 @@ def make_template_dir(env, mono_root):
     copy_mono_shared_libs(env, mono_root, template_mono_root_dir)
     copy_mono_shared_libs(env, mono_root, template_mono_root_dir)
 
 
 
 
-def copy_mono_root_files(env, mono_root):
+def copy_mono_root_files(env, mono_root, mono_bcl):
     from glob import glob
     from glob import glob
     from shutil import copy
     from shutil import copy
     from shutil import rmtree
     from shutil import rmtree
@@ -451,7 +452,7 @@ def copy_mono_root_files(env, mono_root):
 
 
     # Copy framework assemblies
     # Copy framework assemblies
 
 
-    mono_framework_dir = os.path.join(mono_root, "lib", "mono", "4.5")
+    mono_framework_dir = mono_bcl or os.path.join(mono_root, "lib", "mono", "4.5")
     mono_framework_facades_dir = os.path.join(mono_framework_dir, "Facades")
     mono_framework_facades_dir = os.path.join(mono_framework_dir, "Facades")
 
 
     editor_mono_framework_dir = os.path.join(editor_mono_root_dir, "lib", "mono", "4.5")
     editor_mono_framework_dir = os.path.join(editor_mono_root_dir, "lib", "mono", "4.5")

+ 8 - 0
modules/mono/config.py

@@ -28,6 +28,14 @@ def configure(env):
             PathVariable.PathAccept,
             PathVariable.PathAccept,
         )
         )
     )
     )
+    envvars.Add(
+        PathVariable(
+            "mono_bcl",
+            "Path to a custom Mono BCL (Base Class Library) directory for the target platform",
+            "",
+            PathVariable.PathAccept,
+        )
+    )
     envvars.Add(BoolVariable("mono_static", "Statically link Mono", default_mono_static))
     envvars.Add(BoolVariable("mono_static", "Statically link Mono", default_mono_static))
     envvars.Add(BoolVariable("mono_glue", "Build with the Mono glue sources", True))
     envvars.Add(BoolVariable("mono_glue", "Build with the Mono glue sources", True))
     envvars.Add(BoolVariable("build_cil", "Build C# solutions", True))
     envvars.Add(BoolVariable("build_cil", "Build C# solutions", True))