Skip to content

Commit

Permalink
fix(cli): missing zig-abi-suffix support
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jan 13, 2022
1 parent 20df7be commit 472ac10
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cli/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ export class BuildCommand extends Command {
)}`,
})

zigABIVersion = Option.String(`--zig-abi-suffix`, {
description: `The suffix of the ${chalk.green(
'zig --target',
)} ABI version. Eg. ${chalk.cyan(
'--target x86_64-unknown-linux-gnu',
)} ${chalk.green('--zig-abi-suffix=2.17')}`,
})

async execute() {
const cwd = this.cargoCwd
? join(process.cwd(), this.cargoCwd)
Expand Down Expand Up @@ -208,7 +216,9 @@ export class BuildCommand extends Command {
}

if (this.useZig) {
const zigTarget = ZIG_PLATFORM_TARGET_MAP[triple.raw]
const zigTarget = `${ZIG_PLATFORM_TARGET_MAP[triple.raw]}${
this.zigABIVersion ? `.${this.zigABIVersion}` : ''
}`
if (!zigTarget) {
throw new Error(`${triple.raw} can not be cross compiled by zig`)
}
Expand Down

0 comments on commit 472ac10

Please sign in to comment.