Merge remote-tracking branch 'origin/1.6' into 1.6

This commit is contained in:
Wojtek Figat
2023-03-31 19:38:05 +02:00
9 changed files with 45 additions and 14 deletions

View File

@@ -95,8 +95,8 @@ bool CompileScriptsStep::DeployBinaries(CookingData& data, const String& path, c
Scripting::ProcessBuildInfoPath(e.NativePath, projectFolderPath);
Scripting::ProcessBuildInfoPath(e.ManagedPath, projectFolderPath);
e.NativePath = StringUtils::GetFileName(e.NativePath);
e.ManagedPath = StringUtils::GetFileName(e.ManagedPath);
e.NativePath = String(StringUtils::GetFileName(e.NativePath));
e.ManagedPath = String(StringUtils::GetFileName(e.ManagedPath));
LOG(Info, "Collecting binary module {0}", e.Name);
}

View File

@@ -115,7 +115,7 @@ bool DeployDataStep::Perform(CookingData& data)
}
for (String& version : versions)
{
version = StringUtils::GetFileName(version);
version = String(StringUtils::GetFileName(version));
if (!version.StartsWith(TEXT("7.")))
version.Clear();
}

View File

@@ -109,6 +109,8 @@ namespace FlaxEditor.Windows
switch (BuildPlatform)
{
case BuildPlatform.MacOSx64:
case BuildPlatform.MacOSARM64:
case BuildPlatform.iOSARM64:
IsSupported = false;
break;
default:
@@ -130,6 +132,7 @@ namespace FlaxEditor.Windows
switch (BuildPlatform)
{
case BuildPlatform.MacOSx64:
case BuildPlatform.MacOSARM64:
case BuildPlatform.AndroidARM64:
IsSupported = true;
break;
@@ -228,7 +231,17 @@ namespace FlaxEditor.Windows
class Mac : Platform
{
protected override BuildPlatform BuildPlatform => BuildPlatform.MacOSx64;
public enum Archs
{
[EditorDisplay(null, "arm64")]
ARM64,
[EditorDisplay(null, "x64")]
x64,
}
public Archs CPU = Archs.ARM64;
protected override BuildPlatform BuildPlatform => CPU == Archs.ARM64 ? BuildPlatform.MacOSARM64 : BuildPlatform.MacOSx64;
}
class Editor : CustomEditor

View File

@@ -572,7 +572,7 @@ int32 PlatformBase::StartProcess(const StringView& filename, const StringView& a
procSettings.WaitForEnd = waitForEnd;
procSettings.LogOutput = waitForEnd;
procSettings.ShellExecute = true;
return CreateProcess(procSettings);
return Platform::CreateProcess(procSettings);
}
int32 PlatformBase::RunProcess(const StringView& cmdLine, const StringView& workingDir, bool hiddenWindow)
@@ -581,7 +581,7 @@ int32 PlatformBase::RunProcess(const StringView& cmdLine, const StringView& work
procSettings.FileName = cmdLine;
procSettings.WorkingDirectory = workingDir;
procSettings.HiddenWindow = hiddenWindow;
return CreateProcess(procSettings);
return Platform::CreateProcess(procSettings);
}
int32 PlatformBase::RunProcess(const StringView& cmdLine, const StringView& workingDir, const Dictionary<String, String>& environment, bool hiddenWindow)
@@ -591,7 +591,7 @@ int32 PlatformBase::RunProcess(const StringView& cmdLine, const StringView& work
procSettings.WorkingDirectory = workingDir;
procSettings.Environment = environment;
procSettings.HiddenWindow = hiddenWindow;
return CreateProcess(procSettings);
return Platform::CreateProcess(procSettings);
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS

View File

@@ -360,7 +360,7 @@ String MacPlatform::GetMainDirectory()
if (path.EndsWith(TEXT("/Contents/MacOS")))
{
// If running from executable in a package, go up to the Contents
path = StringUtils::GetDirectoryName(path);
path = path.Left(path.Length() - 6);
}
return path;
}

View File

@@ -272,11 +272,18 @@ bool MCore::LoadEngine()
CallStaticMethodByName<void>(TEXT("Init"));
#ifdef MCORE_MAIN_MODULE_NAME
// MCORE_MAIN_MODULE_NAME define is injected by Scripting.Build.cs on platforms that use separate shared library for engine symbols
const StringAnsi flaxLibraryPath(Platform::GetMainDirectory() / TEXT(MACRO_TO_STR(MCORE_MAIN_MODULE_NAME)));
::String flaxLibraryPath(Platform::GetMainDirectory() / TEXT(MACRO_TO_STR(MCORE_MAIN_MODULE_NAME)));
#else
const StringAnsi flaxLibraryPath(Platform::GetExecutableFilePath());
::String flaxLibraryPath(Platform::GetExecutableFilePath());
#endif
RegisterNativeLibrary("FlaxEngine", flaxLibraryPath.Get());
#if PLATFORM_MAC
// On some platforms all native binaries are side-by-side with the app in a different folder
if (!FileSystem::FileExists(flaxLibraryPath))
{
flaxLibraryPath = ::String(StringUtils::GetDirectoryName(Platform::GetExecutableFilePath())) / StringUtils::GetFileName(flaxLibraryPath);
}
#endif
RegisterNativeLibrary("FlaxEngine", StringAnsi(flaxLibraryPath).Get());
MRootDomain = New<MDomain>("Root");
MDomains.Add(MRootDomain);

View File

@@ -345,9 +345,12 @@ bool Scripting::LoadBinaryModules(const String& path, const String& projectFolde
{
// Load library
const auto startTime = DateTime::NowUTC();
#if PLATFORM_ANDROID
// On Android all native binaries are side-by-side with the app
nativePath = String(StringUtils::GetDirectoryName(Platform::GetExecutableFilePath())) / StringUtils::GetFileName(nativePath);
#if PLATFORM_ANDROID || PLATFORM_MAC
// On some platforms all native binaries are side-by-side with the app in a different folder
if (!FileSystem::FileExists(nativePath))
{
nativePath = String(StringUtils::GetDirectoryName(Platform::GetExecutableFilePath())) / StringUtils::GetFileName(nativePath);
}
#endif
auto library = Platform::LoadLibrary(nativePath.Get());
if (!library)

View File

@@ -80,6 +80,11 @@ public class nethost : ThirdPartyModule
options.DependencyFiles.Add(Path.Combine(hostRuntime.Path, "libmonosgen-2.0.so"));
options.Libraries.Add(Path.Combine(hostRuntime.Path, "libmonosgen-2.0.so"));
break;
case TargetPlatform.iOS:
options.PublicDefinitions.Add("USE_MONO_DYNAMIC_LIB");
options.DependencyFiles.Add(Path.Combine(hostRuntime.Path, "libmonosgen-2.0.dylib"));
options.Libraries.Add(Path.Combine(hostRuntime.Path, "libmonosgen-2.0.dylib"));
break;
default: throw new InvalidPlatformException(options.Platform.Target);
}
options.DependencyFiles.Add(Path.Combine(FolderPath, "FlaxEngine.CSharp.runtimeconfig.json"));

View File

@@ -262,7 +262,10 @@ namespace Flax.Build
TryAddHostRuntime(TargetPlatform.Windows, TargetArchitecture.ARM64, "win-arm64");
TryAddHostRuntime(TargetPlatform.Mac, TargetArchitecture.x64, "osx-x64");
TryAddHostRuntime(TargetPlatform.Mac, TargetArchitecture.ARM64, "osx-arm64");
TryAddHostRuntime(TargetPlatform.Android, TargetArchitecture.ARM, "android-arm", "Runtime.Mono");
TryAddHostRuntime(TargetPlatform.Android, TargetArchitecture.ARM64, "android-arm64", "Runtime.Mono");
TryAddHostRuntime(TargetPlatform.iOS, TargetArchitecture.ARM, "ios-arm64", "Runtime.Mono");
TryAddHostRuntime(TargetPlatform.iOS, TargetArchitecture.ARM64, "ios-arm64", "Runtime.Mono");
// Found
IsValid = true;