Add macOS build for dotnet7

This commit is contained in:
Wojtek Figat
2023-02-19 13:31:57 +01:00
parent b44c7ab32c
commit 2c1409c2a4
6 changed files with 75 additions and 26 deletions

View File

@@ -59,7 +59,13 @@ bool CoreCLR::InitHostfxr(const String& configPath, const String& libraryPath)
const String path(hostfxrPath);
LOG(Info, "Found hostfxr in {0}", path);
// Get API from hostfxr library
void* hostfxr = Platform::LoadLibrary(path.Get());
if (hostfxr == nullptr)
{
LOG(Error, "Failed to setup hostfxr API ({0})", path);
return true;
}
hostfxr_initialize_for_runtime_config = (hostfxr_initialize_for_runtime_config_fn)Platform::GetProcAddress(hostfxr, "hostfxr_initialize_for_runtime_config");
hostfxr_initialize_for_dotnet_command_line = (hostfxr_initialize_for_dotnet_command_line_fn)Platform::GetProcAddress(hostfxr, "hostfxr_initialize_for_dotnet_command_line");
hostfxr_get_runtime_delegate = (hostfxr_get_runtime_delegate_fn)Platform::GetProcAddress(hostfxr, "hostfxr_get_runtime_delegate");
@@ -69,7 +75,7 @@ bool CoreCLR::InitHostfxr(const String& configPath, const String& libraryPath)
hostfxr_run_app = (hostfxr_run_app_fn)Platform::GetProcAddress(hostfxr, "hostfxr_run_app");
if (!hostfxr_get_runtime_delegate || !hostfxr_run_app)
{
LOG(Error, "Failed to setup hostfxr API");
LOG(Error, "Failed to setup hostfxr API ({0})", path);
return true;
}

View File

@@ -119,6 +119,7 @@ void MCore::UnloadDomain(const MString& domainName)
#if USE_NETCORE
bool MCore::LoadEngine()
{
PROFILE_CPU();
const String csharpLibraryPath = Globals::BinariesFolder / TEXT("FlaxEngine.CSharp.dll");
const String csharpRuntimeConfigPath = Globals::BinariesFolder / TEXT("FlaxEngine.CSharp.runtimeconfig.json");
if (!FileSystem::FileExists(csharpLibraryPath))
@@ -152,6 +153,9 @@ bool MCore::LoadEngine()
void MCore::UnloadEngine()
{
if (!MRootDomain)
return;
PROFILE_CPU();
CoreCLR::CallStaticMethodByName<void>(TEXT("Exit"));
MDomains.ClearDelete();
MRootDomain = nullptr;

View File

@@ -140,7 +140,7 @@ bool ScriptingService::Init()
// Initialize managed runtime
if (MCore::LoadEngine())
{
LOG(Fatal, "Mono initialization failed.");
LOG(Fatal, "C# runtime initialization failed.");
return true;
}