Make Godot native staging target-aware
This commit is contained in:
@@ -209,9 +209,10 @@ internal static class FfmpegMovieNative
|
||||
? "age_movie_ffmpeg.dll"
|
||||
: OperatingSystem.IsMacOS() ? "libage_movie_ffmpeg.dylib" : "libage_movie_ffmpeg.so";
|
||||
string? configured = Environment.GetEnvironmentVariable("AGE_FFMPEG_NATIVE_DIR");
|
||||
string rid = OperatingSystem.IsWindows() ? "win-x64"
|
||||
: OperatingSystem.IsMacOS() ? (RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? "osx-arm64" : "osx-x64")
|
||||
: "linux-x64";
|
||||
string rid = RuntimeIdentifierFor(
|
||||
OperatingSystem.IsWindows(),
|
||||
OperatingSystem.IsMacOS(),
|
||||
RuntimeInformation.ProcessArchitecture);
|
||||
string[] candidates =
|
||||
{
|
||||
configured == null ? "" : Path.Combine(configured, fileName),
|
||||
@@ -225,6 +226,23 @@ internal static class FfmpegMovieNative
|
||||
$"{fileName} was not found; set AGE_FFMPEG_NATIVE_DIR or package runtimes/{rid}/native");
|
||||
}
|
||||
|
||||
internal static string RuntimeIdentifierFor(
|
||||
bool isWindows,
|
||||
bool isMacOS,
|
||||
Architecture architecture)
|
||||
=> (isWindows, isMacOS, architecture) switch
|
||||
{
|
||||
(true, _, Architecture.X64) => "win-x64",
|
||||
(true, _, Architecture.Arm64) => "win-arm64",
|
||||
(false, true, Architecture.X64) => "osx-x64",
|
||||
(false, true, Architecture.Arm64) => "osx-arm64",
|
||||
(false, false, Architecture.X64) => "linux-x64",
|
||||
(false, false, Architecture.Arm64) => "linux-arm64",
|
||||
_ => throw new PlatformNotSupportedException(
|
||||
$"The FFmpeg movie backend has no reserved RID for " +
|
||||
$"{(isWindows ? "Windows" : isMacOS ? "macOS" : "Linux")}/{architecture}."),
|
||||
};
|
||||
|
||||
internal static string DecodeUtf8(byte[] buffer)
|
||||
{
|
||||
int length = Array.IndexOf(buffer, (byte)0);
|
||||
|
||||
@@ -3,8 +3,12 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
<Nullable>enable</Nullable>
|
||||
<AgeNativeRid Condition="'$(RuntimeIdentifier)' != ''">$(RuntimeIdentifier)</AgeNativeRid>
|
||||
<AgeNativeRid Condition="'$(AgeNativeRid)' == '' and '$(GodotTargetPlatform)' == 'windows'">win-x64</AgeNativeRid>
|
||||
<AgeNativeRid Condition="'$(AgeNativeRid)' == '' and '$(GodotTargetPlatform)' == 'linuxbsd'">linux-x64</AgeNativeRid>
|
||||
<AgeNativeDirectory>..\build\native\$(AgeNativeRid)</AgeNativeDirectory>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
|
||||
<PropertyGroup Condition="'$(GodotTargetPlatform)' == 'windows'">
|
||||
<DefineConstants>$(DefineConstants);AGE_WINDOWS_GDI</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
@@ -12,16 +16,28 @@
|
||||
<EmbeddedResource Include="..\build\opcodes.json"
|
||||
LogicalName="Himegari.Runtime.opcodes.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
|
||||
<ItemGroup Condition="'$(GodotTargetPlatform)' == 'windows'">
|
||||
<ProjectReference Include="..\engine\Age.Engine.Text.Windows\Age.Engine.Text.Windows.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="Exists('..\build\native\win-x64\age_movie_ffmpeg.dll')">
|
||||
<None Include="..\build\native\win-x64\*.dll"
|
||||
<ItemGroup Condition="'$(AgeNativeRid)' == 'win-x64' and Exists('$(AgeNativeDirectory)\age_movie_ffmpeg.dll')">
|
||||
<None Include="$(AgeNativeDirectory)\*.dll"
|
||||
Link="%(Filename)%(Extension)"
|
||||
CopyToOutputDirectory="PreserveNewest" />
|
||||
<None Include="..\build\native\win-x64\FFmpeg-LICENSE.txt"
|
||||
CopyToOutputDirectory="PreserveNewest"
|
||||
CopyToPublishDirectory="PreserveNewest" />
|
||||
<None Include="$(AgeNativeDirectory)\FFmpeg-LICENSE.txt"
|
||||
Link="FFmpeg-LICENSE.txt"
|
||||
CopyToOutputDirectory="PreserveNewest" />
|
||||
CopyToOutputDirectory="PreserveNewest"
|
||||
CopyToPublishDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(AgeNativeRid)' == 'linux-x64' and Exists('$(AgeNativeDirectory)\libage_movie_ffmpeg.so')">
|
||||
<None Include="$(AgeNativeDirectory)\*.so*"
|
||||
Link="%(Filename)%(Extension)"
|
||||
CopyToOutputDirectory="PreserveNewest"
|
||||
CopyToPublishDirectory="PreserveNewest" />
|
||||
<None Include="$(AgeNativeDirectory)\FFmpeg-LICENSE.txt"
|
||||
Link="FFmpeg-LICENSE.txt"
|
||||
CopyToOutputDirectory="PreserveNewest"
|
||||
CopyToPublishDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
<Target Name="RequireGeneratedRuntimeMetadata" BeforeTargets="PrepareForBuild"
|
||||
Condition="!Exists('..\build\opcodes.json')">
|
||||
|
||||
Reference in New Issue
Block a user