diff --git a/Source/ThirdParty/mono-2.0/mono.Build.cs b/Source/ThirdParty/mono-2.0/mono.Build.cs
index 9fa592f35..873f368f4 100644
--- a/Source/ThirdParty/mono-2.0/mono.Build.cs
+++ b/Source/ThirdParty/mono-2.0/mono.Build.cs
@@ -87,7 +87,7 @@ public class mono : DepsModule
options.Libraries.Add(Path.Combine(depsRoot, "libmonosgen-2.0.so"));
break;
case TargetPlatform.Switch:
- // TODO: mono for Switch
+ options.OutputFiles.Add(Path.Combine(depsRoot, "libmonosgen-2.0.a"));
break;
default: throw new InvalidPlatformException(options.Platform.Target);
}
diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/mono.cs b/Source/Tools/Flax.Build/Deps/Dependencies/mono.cs
index 7cd7649b1..595d7ac0e 100644
--- a/Source/Tools/Flax.Build/Deps/Dependencies/mono.cs
+++ b/Source/Tools/Flax.Build/Deps/Dependencies/mono.cs
@@ -33,6 +33,7 @@ namespace Flax.Deps.Dependencies
TargetPlatform.XboxOne,
TargetPlatform.PS4,
TargetPlatform.XboxScarlett,
+ TargetPlatform.Switch,
};
case TargetPlatform.Linux:
return new[]
@@ -614,7 +615,7 @@ namespace Flax.Deps.Dependencies
{ "ANDROID_API", apiLevel },
{ "ANDROID_API_VERSION", apiLevel },
{ "ANDROID_NATIVE_API_LEVEL", apiLevel },
-
+
{ "CC", Path.Combine(ndkBin, archName + apiLevel + "-clang") },
{ "CXX", Path.Combine(ndkBin, archName + apiLevel + "-clang++") },
{ "AR", Path.Combine(ndkBin, archName + "-ar") },
@@ -705,6 +706,13 @@ namespace Flax.Deps.Dependencies
Utilities.DirectoryDelete(Path.Combine(bclLibMonoOutput, "2.1", "Facades"));
break;
}
+ case TargetPlatform.Switch:
+ {
+ var type = Type.GetType("Flax.Build.Platforms.Switch.mono");
+ var method = type.GetMethod("Build");
+ method.Invoke(null, new object[] { root, options });
+ break;
+ }
}
}
}
diff --git a/Source/Tools/Flax.Build/Deps/Dependency.cs b/Source/Tools/Flax.Build/Deps/Dependency.cs
index c19687c2a..17d158d42 100644
--- a/Source/Tools/Flax.Build/Deps/Dependency.cs
+++ b/Source/Tools/Flax.Build/Deps/Dependency.cs
@@ -263,5 +263,36 @@ namespace Flax.Deps
Utilities.Run("cmake", cmdLine, null, path, Utilities.RunOptions.None, envVars);
}
+
+ ///
+ /// Runs the bash script via Cygwin tool (native bash on platforms other than Windows).
+ ///
+ /// The path.
+ /// The workspace folder.
+ /// Custom environment variables to pass to the child process.
+ public static void RunCygwin(string path, string workspace = null, Dictionary envVars = null)
+ {
+ string app;
+ switch (BuildPlatform)
+ {
+ case TargetPlatform.Windows:
+ {
+ var cygwinFolder = Environment.GetEnvironmentVariable("CYGWIN");
+ if (string.IsNullOrEmpty(cygwinFolder) || !Directory.Exists(cygwinFolder))
+ {
+ cygwinFolder = "C:\\cygwin";
+ if (!Directory.Exists(cygwinFolder))
+ throw new Exception("Missing Cygwin. Install Cygwin64 to C:\\cygwin or set CYGWIN env variable to install location folder.");
+ }
+ app = Path.Combine(cygwinFolder, "bin\\bash.exe");
+ break;
+ }
+ case TargetPlatform.Linux:
+ app = "bash";
+ break;
+ default: throw new InvalidPlatformException(BuildPlatform);
+ }
+ Utilities.Run(app, path, null, workspace, Utilities.RunOptions.None, envVars);
+ }
}
}