From 0205fd976ea7616fab35db3403f65da048b90a41 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 8 Feb 2024 21:23:40 +0800 Subject: [PATCH] fix(cli): setup cxx env while using napi-cross (#1942) --- cli/src/api/build.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cli/src/api/build.ts b/cli/src/api/build.ts index dfcd0a08..a95d20df 100644 --- a/cli/src/api/build.ts +++ b/cli/src/api/build.ts @@ -248,6 +248,18 @@ class Builder { `${this.target.triple}-gcc`, ) } + if (!process.env.CXX && !process.env.TARGET_CXX) { + this.envs[`CXX`] = join( + toolchainPath, + 'bin', + `${this.target.triple}-g++`, + ) + this.envs[`TARGET_CXX`] = join( + toolchainPath, + 'bin', + `${this.target.triple}-g++`, + ) + } if ( (process.env.CC === 'clang' && (process.env.TARGET_CC === 'clang' || !process.env.TARGET_CC)) ||