From 895e4caf952de3dbe4989435fdb566088c801c30 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 3 Jan 2023 21:02:13 +0800 Subject: [PATCH] fix(cli): android cmake build --- cli/src/build.ts | 3 +-- cli/src/new/cargo-config.ts | 9 +-------- cli/src/new/index.ts | 5 +---- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/cli/src/build.ts b/cli/src/build.ts index 9adc46e7..ad6dce52 100644 --- a/cli/src/build.ts +++ b/cli/src/build.ts @@ -435,8 +435,7 @@ export class BuildCommand extends Command { CC: `${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/${targetArch}-linux-${targetPlatform}-clang`, CXX: `${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/${targetArch}-linux-${targetPlatform}-clang++`, AR: `${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar`, - CMAKE_TOOLCHAIN_FILE_armv7_linux_androideabi: `${ANDROID_NDK_LATEST_HOME}/build/cmake/android.toolchain.cmake`, - CMAKE_TOOLCHAIN_FILE_aarch64_linux_android: `${ANDROID_NDK_LATEST_HOME}/build/cmake/android.toolchain.cmake`, + ANDROID_NDK: ANDROID_NDK_LATEST_HOME, PATH: `${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${process.env.PATH}`, }) } diff --git a/cli/src/new/cargo-config.ts b/cli/src/new/cargo-config.ts index c97e6b28..6224eb16 100644 --- a/cli/src/new/cargo-config.ts +++ b/cli/src/new/cargo-config.ts @@ -1,16 +1,9 @@ -export const createCargoConfig = ( - enableLinuxArm7: boolean, - enableLinuxArm8Musl: boolean, -) => { +export const createCargoConfig = (enableLinuxArm8Musl: boolean) => { const result: string[] = [] if (enableLinuxArm8Musl) { result.push(`[target.aarch64-unknown-linux-musl] linker = "aarch64-linux-musl-gcc" rustflags = ["-C", "target-feature=-crt-static"]`) - } - if (enableLinuxArm7) { - result.push(`[target.armv7-unknown-linux-gnueabihf] -linker = "arm-linux-gnueabihf-gcc"`) } return result.join('\n') } diff --git a/cli/src/new/index.ts b/cli/src/new/index.ts index a4fc587b..85d54ca5 100644 --- a/cli/src/new/index.ts +++ b/cli/src/new/index.ts @@ -179,10 +179,7 @@ test('sum from native', (t) => { const enableLinuxArm8Musl = this.targets!.includes( 'aarch64-unknown-linux-musl', ) - const enableLinuxArm7 = this.targets!.includes( - 'armv7-unknown-linux-gnueabihf', - ) - const cargoConfig = createCargoConfig(enableLinuxArm7, enableLinuxArm8Musl) + const cargoConfig = createCargoConfig(enableLinuxArm8Musl) if (cargoConfig.length) { const configDir = join(process.cwd(), this.dirname!, '.cargo') if (!this.dryRun) {