Skip to content

Commit

Permalink
feat(cli): add --zig-link-only option (#1400)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Dec 19, 2022
1 parent 1bcb3a3 commit bc41c97
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cli/src/build.ts
Expand Up @@ -191,6 +191,10 @@ export class BuildCommand extends Command {
)} ${chalk.green('--zig-abi-suffix=2.17')}`,
})

zigLinkOnly = Option.Boolean(`--zig-link-only`, false, {
description: `Only link the library with ${chalk.green('zig')}`,
})

isStrip = Option.Boolean(`--strip`, false, {
description: `${chalk.green('Strip')} the library for minimum file size`,
})
Expand Down Expand Up @@ -402,12 +406,14 @@ export class BuildCommand extends Command {
},
)
const envTarget = triple.raw.replaceAll('-', '_').toUpperCase()
Object.assign(additionalEnv, {
CC: CCWrapperShell,
CXX: CXXWrapperShell,
TARGET_CC: CCWrapperShell,
TARGET_CXX: CXXWrapperShell,
})
if (!this.zigLinkOnly) {
Object.assign(additionalEnv, {
CC: CCWrapperShell,
CXX: CXXWrapperShell,
TARGET_CC: CCWrapperShell,
TARGET_CXX: CXXWrapperShell,
})
}
additionalEnv[`CARGO_TARGET_${envTarget}_LINKER`] = linkerWrapperShell
}
debug(`Platform: ${JSON.stringify(triple, null, 2)}`)
Expand Down

0 comments on commit bc41c97

Please sign in to comment.