Skip to content

Commit

Permalink
[native_toolchain_c] Setup Android RISCV64 toolchain. (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmacnak-google authored Nov 28, 2023
1 parent aa58de6 commit 50b6a78
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ class RunCBuilder {
// See https://github.com/dart-lang/native/issues/171.
late final int targetAndroidNdkApi;
if (target.os == OS.android) {
targetAndroidNdkApi = max(buildConfig.targetAndroidNdkApi!, 21);
final minimumApi = target == Target.androidRiscv64 ? 35 : 21;
targetAndroidNdkApi = max(buildConfig.targetAndroidNdkApi!, minimumApi);
}

await runProcess(
Expand Down Expand Up @@ -294,6 +295,7 @@ class RunCBuilder {
Target.androidArm64: 'aarch64-linux-android',
Target.androidIA32: 'i686-linux-android',
Target.androidX64: 'x86_64-linux-android',
Target.androidRiscv64: 'riscv64-linux-android',
};

static const appleClangMacosTargetFlags = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,24 @@ void main() {
Target.androidArm64,
Target.androidIA32,
Target.androidX64,
// TODO(rmacnak): Enable when stable NDK 27 is available.
// Target.androidRiscv64,
];

const readElfMachine = {
Target.androidArm: 'ARM',
Target.androidArm64: 'AArch64',
Target.androidIA32: 'Intel 80386',
Target.androidX64: 'Advanced Micro Devices X86-64',
Target.androidRiscv64: 'RISC-V',
};

const objdumpFileFormat = {
Target.androidArm: 'elf32-littlearm',
Target.androidArm64: 'elf64-littleaarch64',
Target.androidIA32: 'elf32-i386',
Target.androidX64: 'elf64-x86-64',
Target.androidRiscv64: 'elf64-littleriscv',
};

/// From https://docs.flutter.dev/reference/supported-platforms.
Expand Down

0 comments on commit 50b6a78

Please sign in to comment.