Fixes for Editor on Linux

This commit is contained in:
mafiesto4
2021-01-17 21:48:15 +01:00
parent 6b0d34a21d
commit 837174582b
2 changed files with 16 additions and 6 deletions

View File

@@ -113,9 +113,9 @@ Action ScriptsBuilder::OnCompilationFailed;
void ScriptsBuilderImpl::sourceDirEvent(const String& path, FileSystemAction action) void ScriptsBuilderImpl::sourceDirEvent(const String& path, FileSystemAction action)
{ {
// Discard non-source files or generated files // Discard non-source files or generated files
if (!path.EndsWith(TEXT(".cs")) && if ((!path.EndsWith(TEXT(".cs")) &&
!path.EndsWith(TEXT(".cpp")) && !path.EndsWith(TEXT(".cpp")) &&
!path.EndsWith(TEXT(".h")) || !path.EndsWith(TEXT(".h"))) ||
path.EndsWith(TEXT(".Gen.cs"))) path.EndsWith(TEXT(".Gen.cs")))
return; return;
@@ -344,8 +344,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)
{ {
// Special case when opening engine project
if (Editor::Project->ProjectFolderPath == Globals::StartupFolder) if (Editor::Project->ProjectFolderPath == Globals::StartupFolder)
// Special case when opening engine project
{ {
target = platform = architecture = configuration = nullptr; target = platform = architecture = configuration = nullptr;
return; return;
@@ -354,12 +354,18 @@ void ScriptsBuilder::GetBinariesConfiguration(const Char*& target, const Char*&
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS
platform = TEXT("Windows"); platform = TEXT("Windows");
#elif PLATFORM_LINUX
platform = TEXT("Linux");
#else
#error "Unknown platform"
#endif #endif
#if PLATFORM_ARCH_X64 #if PLATFORM_ARCH_X64
architecture = TEXT("x64"); architecture = TEXT("x64");
#elif PLATFORM_ARCH_X86 #elif PLATFORM_ARCH_X86
architecture = TEXT("x86"); architecture = TEXT("x86");
#else
#error "Unknown architecture"
#endif #endif
#if BUILD_DEBUG #if BUILD_DEBUG
@@ -368,6 +374,8 @@ void ScriptsBuilder::GetBinariesConfiguration(const Char*& target, const Char*&
configuration = TEXT("Development"); configuration = TEXT("Development");
#elif BUILD_RELEASE #elif BUILD_RELEASE
configuration = TEXT("Release"); configuration = TEXT("Release");
#else
#error "Unknown configuration"
#endif #endif
} }

View File

@@ -361,7 +361,6 @@ bool MCore::LoadEngine()
} }
#if MONO_DEBUG_ENABLE #if MONO_DEBUG_ENABLE
StringAnsi debuggerIp = "127.0.0.1"; StringAnsi debuggerIp = "127.0.0.1";
uint16 debuggerPort = 41000 + Platform::GetCurrentProcessId() % 1000; uint16 debuggerPort = 41000 + Platform::GetCurrentProcessId() % 1000;
if (CommandLine::Options.DebuggerAddress.HasValue()) if (CommandLine::Options.DebuggerAddress.HasValue())
@@ -426,6 +425,10 @@ bool MCore::LoadEngine()
// Hint to use default system assemblies location // Hint to use default system assemblies location
const MString assembliesPath = (Globals::MonoPath / TEXT("/lib/mono/2.1")).ToStringAnsi(); const MString assembliesPath = (Globals::MonoPath / TEXT("/lib/mono/2.1")).ToStringAnsi();
mono_set_assemblies_path(*assembliesPath); mono_set_assemblies_path(*assembliesPath);
#elif PLATFORM_LINUX
// Adjust GC threads suspending mode on Linux
Platform::SetEnvironmentVariable(TEXT("MONO_THREADS_SUSPEND"), TEXT("preemptive"));
#endif
#endif #endif
mono_config_parse(nullptr); mono_config_parse(nullptr);
@@ -459,7 +462,6 @@ bool MCore::LoadEngine()
configDir += "\\Mono"; configDir += "\\Mono";
#endif #endif
mono_domain_set_config(monoRootDomain, configDir.Get(), configFilename.Get()); mono_domain_set_config(monoRootDomain, configDir.Get(), configFilename.Get());
mono_thread_set_main(mono_thread_current()); mono_thread_set_main(mono_thread_current());
// Register for threads ending to cleanup after managed runtime usage // Register for threads ending to cleanup after managed runtime usage
@@ -556,7 +558,7 @@ void MCore::GC::WaitForPendingFinalizers()
} }
} }
#if PLATFORM_WIN32 #if PLATFORM_WIN32 && !USE_MONO_DYNAMIC_LIB
// Export Mono functions // Export Mono functions
#pragma comment(linker, "/export:mono_add_internal_call") #pragma comment(linker, "/export:mono_add_internal_call")