refactor(napi): use libloading on Windows

This commit is contained in:
LongYinan 2022-05-06 21:16:35 +08:00
parent 4f120ba8ff
commit 1bf072ad7d
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7
24 changed files with 1266 additions and 1157 deletions
cli/src

View file

@ -150,7 +150,7 @@ export class BuildCommand extends Command {
// https://github.com/napi-rs/napi-rs/issues/297
disableWindowsX32Optimize?: boolean = Option.Boolean(
'--disable-windows-x32-optimize',
true,
false,
{
description: `Disable windows x32 ${chalk.green(
'lto',
@ -262,18 +262,6 @@ export class BuildCommand extends Command {
const intermediateTypeFile = join(tmpdir(), `type_def.${Date.now()}.tmp`)
debug(`Run ${chalk.green(cargoCommand)}`)
const additionalEnv = {}
if (
triple.arch === 'ia32' &&
triple.platform === 'win32' &&
triple.abi === 'msvc' &&
this.disableWindowsX32Optimize
) {
Object.assign(additionalEnv, {
CARGO_PROFILE_DEBUG_CODEGEN_UNITS: 256,
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 256,
CARGO_PROFILE_RELEASE_LTO: false,
})
}
const rustflags = process.env.RUSTFLAGS
? process.env.RUSTFLAGS.split(' ')