Merge pull request #1025 from napi-rs/support-zig-abi-flag
fix(cli): missing zig-abi-suffix support
This commit is contained in:
commit
ee3e68adec
1 changed files with 11 additions and 1 deletions
|
@ -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() {
|
async execute() {
|
||||||
const cwd = this.cargoCwd
|
const cwd = this.cargoCwd
|
||||||
? join(process.cwd(), this.cargoCwd)
|
? join(process.cwd(), this.cargoCwd)
|
||||||
|
@ -208,7 +216,9 @@ export class BuildCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.useZig) {
|
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) {
|
if (!zigTarget) {
|
||||||
throw new Error(`${triple.raw} can not be cross compiled by zig`)
|
throw new Error(`${triple.raw} can not be cross compiled by zig`)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue