diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ae41a96..e46fde8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [windows-latest, ubuntu-latest, macos-latest] + os: [windows-latest, ubuntu-latest, macos-latest, ubuntu-22.04-arm] fail-fast: false steps: - name: Expose GitHub Runtime diff --git a/build/Build.csproj b/build/Build.csproj index 646f1ad..0f56c9a 100644 --- a/build/Build.csproj +++ b/build/Build.csproj @@ -22,6 +22,7 @@ + diff --git a/build/BuildLinuxTask.cs b/build/BuildLinuxTask.cs index 1d1808f..d1eedde 100644 --- a/build/BuildLinuxTask.cs +++ b/build/BuildLinuxTask.cs @@ -9,11 +9,12 @@ public sealed class BuildLinuxTask : FrostingTask public override void Run(BuildContext context) { + var arch = RuntimeInformation.OSArchitecture; // Absolute path to the artifact directory is needed for flags since they don't allow relative path var artifactDir = context.MakeAbsolute(new DirectoryPath(context.ArtifactsDir)); - var dependencyDir = context.MakeAbsolute(new DirectoryPath($"{context.ArtifactsDir}/../dependencies-linux-x64")); + var dependencyDir = context.MakeAbsolute(new DirectoryPath($"{context.ArtifactsDir}/../dependencies-linux-{(arch == Architecture.Arm64 ? "arm64" : "x64")}")); var prefixFlag = $"--prefix=\"{dependencyDir}\""; - var hostFlag = "--host=\"x86_64-linux-gnu\""; + var hostFlag = arch == Architecture.Arm64 ? "--host=\"aarch64-linux-gnu\"" : "--host=\"x86_64-linux-gnu\""; var binDirFlag = $"--bindir=\"{artifactDir}\""; var envVariables = new Dictionary @@ -83,7 +84,8 @@ private static string GetFFMpegConfigureFlags(BuildContext context) { var ignoreCommentsAndNewLines = (string line) => !string.IsNullOrWhiteSpace(line) && !line.StartsWith('#'); var configureFlags = context.FileReadLines("ffmpeg.config").Where(ignoreCommentsAndNewLines); - var osConfigureFlags = context.FileReadLines($"ffmpeg.linux-x64.config").Where(ignoreCommentsAndNewLines); + var osConfigFile = RuntimeInformation.OSArchitecture == Architecture.Arm64 ? "ffmpeg.linux-arm64.config" : "ffmpeg.linux-x64.config"; + var osConfigureFlags = context.FileReadLines(osConfigFile).Where(ignoreCommentsAndNewLines); return string.Join(' ', configureFlags) + " " + string.Join(' ', osConfigureFlags); } } diff --git a/ffmpeg.linux-arm64.config b/ffmpeg.linux-arm64.config new file mode 100644 index 0000000..05e90e6 --- /dev/null +++ b/ffmpeg.linux-arm64.config @@ -0,0 +1,10 @@ +######################################################################################################################## +### Toolchain Options +######################################################################################################################## +--arch=aarch64 +--target-os=linux + +######################################################################################################################## +### Optimization Options +######################################################################################################################## +--enable-neon