Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): add --zig-link-only option #1400

Merged
merged 1 commit into from Dec 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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