Fix Web to run without dotnet
This commit is contained in:
@@ -193,6 +193,11 @@ enum class DotNetAOTModes
|
||||
/// Use Mono AOT to cross-compile all used C# assemblies into native platform static libraries which can be linked into a single shared library.
|
||||
/// </summary>
|
||||
MonoAOTStatic,
|
||||
|
||||
/// <summary>
|
||||
/// Target platform doesn't support .NET or it has been disabled.
|
||||
/// </summary>
|
||||
NoDotnet,
|
||||
};
|
||||
|
||||
extern FLAXENGINE_API const Char* ToString(const BuildPlatform platform);
|
||||
|
||||
@@ -189,6 +189,8 @@ const Char* ToString(const DotNetAOTModes mode)
|
||||
return TEXT("MonoAOTDynamic");
|
||||
case DotNetAOTModes::MonoAOTStatic:
|
||||
return TEXT("MonoAOTStatic");
|
||||
case DotNetAOTModes::NoDotnet:
|
||||
return TEXT("NoDotnet");
|
||||
default:
|
||||
return TEXT("");
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ ArchitectureType WebPlatformTools::GetArchitecture() const
|
||||
|
||||
DotNetAOTModes WebPlatformTools::UseAOT() const
|
||||
{
|
||||
return DotNetAOTModes::MonoAOTStatic;
|
||||
return DotNetAOTModes::NoDotnet;
|
||||
}
|
||||
|
||||
PixelFormat WebPlatformTools::GetTextureFormat(CookingData& data, TextureBase* texture, PixelFormat format)
|
||||
|
||||
@@ -39,17 +39,23 @@ bool DeployDataStep::Perform(CookingData& data)
|
||||
}
|
||||
String dstDotnet = data.DataOutputPath / TEXT("Dotnet");
|
||||
const DotNetAOTModes aotMode = data.Tools->UseAOT();
|
||||
const bool usAOT = aotMode != DotNetAOTModes::None;
|
||||
const bool usAOT = aotMode != DotNetAOTModes::None && aotMode != DotNetAOTModes::NoDotnet;
|
||||
if (usAOT)
|
||||
{
|
||||
// Deploy Dotnet files into intermediate cooking directory for AOT
|
||||
FileSystem::DeleteDirectory(dstDotnet);
|
||||
dstDotnet = data.ManagedCodeOutputPath;
|
||||
}
|
||||
if (buildSettings.SkipDotnetPackaging && data.Tools->UseSystemDotnet())
|
||||
if (aotMode == DotNetAOTModes::NoDotnet)
|
||||
{
|
||||
// No .NET
|
||||
FileSystem::DeleteDirectory(dstDotnet);
|
||||
}
|
||||
else if (buildSettings.SkipDotnetPackaging && data.Tools->UseSystemDotnet())
|
||||
{
|
||||
// Use system-installed .NET Runtime
|
||||
FileSystem::DeleteDirectory(dstDotnet);
|
||||
LOG(Info, "Not using .NET Runtime");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
void PrecompileAssembliesStep::OnBuildStarted(CookingData& data)
|
||||
{
|
||||
const DotNetAOTModes aotMode = data.Tools->UseAOT();
|
||||
if (aotMode == DotNetAOTModes::None || EnumHasAllFlags(data.Options, BuildOptions::NoCook))
|
||||
if (aotMode == DotNetAOTModes::None ||
|
||||
aotMode == DotNetAOTModes::NoDotnet ||
|
||||
EnumHasAllFlags(data.Options, BuildOptions::NoCook))
|
||||
return;
|
||||
const auto& buildSettings = *BuildSettings::Get();
|
||||
|
||||
@@ -49,7 +51,8 @@ void PrecompileAssembliesStep::OnBuildStarted(CookingData& data)
|
||||
bool PrecompileAssembliesStep::Perform(CookingData& data)
|
||||
{
|
||||
const DotNetAOTModes aotMode = data.Tools->UseAOT();
|
||||
if (aotMode == DotNetAOTModes::None)
|
||||
if (aotMode == DotNetAOTModes::None ||
|
||||
aotMode == DotNetAOTModes::NoDotnet)
|
||||
return false;
|
||||
const auto& buildSettings = *BuildSettings::Get();
|
||||
if (buildSettings.SkipDotnetPackaging && data.Tools->UseSystemDotnet())
|
||||
|
||||
@@ -573,6 +573,7 @@ bool Scripting::Load()
|
||||
auto* flaxEngineModule = (NativeBinaryModule*)GetBinaryModuleFlaxEngine();
|
||||
if (!flaxEngineModule->Assembly->IsLoaded())
|
||||
{
|
||||
#if USE_CSHARP
|
||||
String flaxEnginePath = Globals::BinariesFolder / TEXT("FlaxEngine.CSharp.dll");
|
||||
#if USE_MONO_AOT
|
||||
if (!FileSystem::FileExists(flaxEnginePath))
|
||||
@@ -583,6 +584,7 @@ bool Scripting::Load()
|
||||
LOG(Error, "Failed to load FlaxEngine C# assembly.");
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
flaxEngineModule->CanReload = false;
|
||||
flaxEngineModule->Assembly->_canReload = false;
|
||||
onEngineLoaded(flaxEngineModule->Assembly);
|
||||
|
||||
@@ -33,6 +33,11 @@ namespace Flax.Build
|
||||
/// Use Mono AOT to cross-compile all used C# assemblies into native platform static libraries which can be linked into a single shared library.
|
||||
/// </summary>
|
||||
MonoAOTStatic,
|
||||
|
||||
/// <summary>
|
||||
/// Target platform doesn't support .NET or it has been disabled.
|
||||
/// </summary>
|
||||
NoDotnet,
|
||||
}
|
||||
|
||||
partial class Configuration
|
||||
|
||||
Reference in New Issue
Block a user