fix(natives): routed msvc sse flags through plain CFLAGS for cargo-xwin
cargo-xwin overwrites CFLAGS_<target> on the cargo it spawns and only appends plain CFLAGS/CXXFLAGS into it, so the sse4 override must use those.
This commit is contained in:
@@ -376,11 +376,15 @@ if (crossTarget) {
|
||||
// enforces per-function target features: opus' silk/x86 SSE4.1 units fail to
|
||||
// build without the feature enabled globally. The win32 x64 addon floor is
|
||||
// x86-64-v2 (SSE4.2 inclusive), so enabling it for all C deps is safe.
|
||||
// cargo-xwin overwrites `CFLAGS_<target>` on the cargo it spawns but appends
|
||||
// the plain `CFLAGS`/`CXXFLAGS` values into it, so those are the only knobs
|
||||
// that survive.
|
||||
if (crossTarget.endsWith("-msvc") && targetArch === "x64") {
|
||||
const envKey = `CFLAGS_${bareTriple.replace(/-/g, "_")}`;
|
||||
const existing = process.env[envKey] ?? "";
|
||||
const sseFlags = "-msse4.1 -msse4.2";
|
||||
process.env[envKey] = existing ? `${existing} ${sseFlags}` : sseFlags;
|
||||
for (const envKey of ["CFLAGS", "CXXFLAGS"]) {
|
||||
const existing = process.env[envKey] ?? "";
|
||||
const sseFlags = "-msse4.1 -msse4.2";
|
||||
process.env[envKey] = existing ? `${existing} ${sseFlags}` : sseFlags;
|
||||
}
|
||||
}
|
||||
// napi 3.7.0 resolves the built artifact from the FULL `--target` directory,
|
||||
// but cargo-zigbuild writes under the bare triple; bridge the two so napi's
|
||||
|
||||
Reference in New Issue
Block a user