Use bundled mono on Linux for C# compilation
This commit is contained in:
@@ -217,39 +217,29 @@ bool ScriptsBuilder::RunBuildTool(const StringView& args)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PLATFORM_WINDOWS
|
|
||||||
// Prepare build options
|
// Prepare build options
|
||||||
StringBuilder cmdLine(args.Length() + buildToolPath.Length() + 30);
|
StringBuilder cmdLine(args.Length() + buildToolPath.Length() + 200);
|
||||||
cmdLine.Append(TEXT("\""));
|
#if PLATFORM_LINUX
|
||||||
cmdLine.Append(buildToolPath);
|
const String monoPath = Globals::MonoPath / TEXT("bin/mono");
|
||||||
cmdLine.Append(TEXT("\" "));
|
|
||||||
cmdLine.Append(args.Get(), args.Length());
|
|
||||||
cmdLine.Append(TEXT('\0'));
|
|
||||||
#else
|
|
||||||
// Use mono to run the build tool
|
|
||||||
const String monoPath = Globals::MonoPath / TEXT("bin/mono.exe");
|
|
||||||
if (!FileSystem::FileExists(monoPath))
|
if (!FileSystem::FileExists(monoPath))
|
||||||
{
|
{
|
||||||
Log::FileNotFoundException(monoPath).SetLevel(LogType::Fatal);
|
Log::FileNotFoundException(monoPath).SetLevel(LogType::Fatal);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//const String monoPath = TEXT("mono");
|
||||||
// Prepare build options
|
|
||||||
StringBuilder cmdLine(monoPath.Length() + args.Length() + buildToolPath.Length() + 30);
|
|
||||||
cmdLine.Append(TEXT("\""));
|
cmdLine.Append(TEXT("\""));
|
||||||
cmdLine.Append(monoPath);
|
cmdLine.Append(monoPath);
|
||||||
cmdLine.Append(TEXT("\" \""));
|
cmdLine.Append(TEXT("\" "));
|
||||||
|
#endif
|
||||||
|
cmdLine.Append(TEXT("\""));
|
||||||
cmdLine.Append(buildToolPath);
|
cmdLine.Append(buildToolPath);
|
||||||
cmdLine.Append(TEXT("\" "));
|
cmdLine.Append(TEXT("\" "));
|
||||||
cmdLine.Append(args.Get(), args.Length());
|
cmdLine.Append(args.Get(), args.Length());
|
||||||
cmdLine.Append(TEXT('\0'));
|
cmdLine.Append(TEXT('\0'));
|
||||||
|
// TODO: Set env var for the mono MONO_GC_PARAMS=nursery-size64m to boost build performance -> profile it
|
||||||
// TODO: Set env var for the mono MONO_GC_PARAMS=nursery-size64m to boost build performance
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Call build tool
|
// Call build tool
|
||||||
const int32 result = Platform::RunProcess(StringView(*cmdLine, cmdLine.Length()), StringView::Empty);
|
const int32 result = Platform::RunProcess(StringView(*cmdLine, cmdLine.Length()), StringView::Empty);
|
||||||
|
|
||||||
return result != 0;
|
return result != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,8 +334,8 @@ void ScriptsBuilder::GetBinariesConfiguration(StringView& target, StringView& pl
|
|||||||
|
|
||||||
void ScriptsBuilder::GetBinariesConfiguration(const Char*& target, const Char*& platform, const Char*& architecture, const Char*& configuration)
|
void ScriptsBuilder::GetBinariesConfiguration(const Char*& target, const Char*& platform, const Char*& architecture, const Char*& configuration)
|
||||||
{
|
{
|
||||||
if (Editor::Project->ProjectFolderPath == Globals::StartupFolder)
|
|
||||||
// Special case when opening engine project
|
// Special case when opening engine project
|
||||||
|
if (Editor::Project->ProjectFolderPath == Globals::StartupFolder)
|
||||||
{
|
{
|
||||||
target = platform = architecture = configuration = nullptr;
|
target = platform = architecture = configuration = nullptr;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -44,9 +44,20 @@ namespace Flax.Build
|
|||||||
var outputPath = Path.GetDirectoryName(buildData.Target.GetOutputFilePath(buildOptions));
|
var outputPath = Path.GetDirectoryName(buildData.Target.GetOutputFilePath(buildOptions));
|
||||||
var outputFile = Path.Combine(outputPath, binaryModuleName + ".CSharp.dll");
|
var outputFile = Path.Combine(outputPath, binaryModuleName + ".CSharp.dll");
|
||||||
var outputDocFile = Path.Combine(outputPath, binaryModuleName + ".CSharp.xml");
|
var outputDocFile = Path.Combine(outputPath, binaryModuleName + ".CSharp.xml");
|
||||||
var monoRoot = Path.Combine(Globals.EngineRoot, "Source", "Platforms", "Editor", "Windows", "Mono");
|
string monoRoot, exePath;
|
||||||
|
switch (buildPlatform)
|
||||||
|
{
|
||||||
|
case TargetPlatform.Windows:
|
||||||
|
monoRoot = Path.Combine(Globals.EngineRoot, "Source", "Platforms", "Editor", "Windows", "Mono");
|
||||||
|
exePath = Path.Combine(monoRoot, "bin", "mono.exe");
|
||||||
|
break;
|
||||||
|
case TargetPlatform.Linux:
|
||||||
|
monoRoot = Path.Combine(Globals.EngineRoot, "Source", "Platforms", "Editor", "Linux", "Mono");
|
||||||
|
exePath = Path.Combine(monoRoot, "bin", "mono");
|
||||||
|
break;
|
||||||
|
default: throw new InvalidPlatformException(buildPlatform);
|
||||||
|
}
|
||||||
var cscPath = Path.Combine(monoRoot, "lib", "mono", "4.5", "csc.exe");
|
var cscPath = Path.Combine(monoRoot, "lib", "mono", "4.5", "csc.exe");
|
||||||
var exePath = buildPlatform == TargetPlatform.Windows ? Path.Combine(monoRoot, "bin", "mono.exe") : "mono";
|
|
||||||
var referenceAssemblies = Path.Combine(monoRoot, "lib", "mono", "4.5-api");
|
var referenceAssemblies = Path.Combine(monoRoot, "lib", "mono", "4.5-api");
|
||||||
var references = new HashSet<string>(buildOptions.ScriptingAPI.FileReferences);
|
var references = new HashSet<string>(buildOptions.ScriptingAPI.FileReferences);
|
||||||
foreach (var module in binaryModule)
|
foreach (var module in binaryModule)
|
||||||
|
|||||||
Reference in New Issue
Block a user