From 5cddcfc08f0dda8280914db1fc043d9bc21b4efa Mon Sep 17 00:00:00 2001 From: Vladimir Morozov Date: Mon, 23 Nov 2026 11:42:04 -0800 Subject: [PATCH] build: keep PGO settings out of addon builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gate PGO generation and use flags on configuring_node so native addons do not inherit Node.js-specific profiling settings from process.config. The inherited Windows profile-use option is unquoted and breaks addon builds when their paths contain spaces. Preserve Node.js PGO flags and the Windows host-toolset exclusion. Expand configuring_node early for the Windows target condition. Refs: https://github.com/nodejs/node-addon-api/pull/1763 Signed-off-by: Vladimir Morozov Assisted-by: AI coding assistant PR-URL: https://github.com/nodejs/node/pull/67638 Reviewed-By: Chengzhong Wu Reviewed-By: Luigi Pinca Reviewed-By: Gürgün Dayıoğlu Reviewed-By: Stefan Stojanovic --- common.gypi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common.gypi b/common.gypi index ec134afceba..5a7ab699e5c 100644 --- a/common.gypi +++ b/common.gypi @@ -235,7 +235,8 @@ # frames otherwise, even with --call-graph dwarf. 'cflags': [ '-fno-omit-frame-pointer' ], }], - ['OS=="linux" or OS=="openharmony"', { + # PGO settings are specific to Node, not addons built with node-gyp. + ['(OS=="linux" or OS=="openharmony") and configuring_node', { 'conditions': [ ['enable_pgo_generate=="true"', { 'cflags': ['<(pgo_generate)'], @@ -247,7 +248,7 @@ },], ], },], - ['OS=="mac"', { + ['OS=="mac" and configuring_node', { 'conditions': [ ['enable_pgo_generate=="true"', { 'xcode_settings': { @@ -312,7 +313,7 @@ },], ], 'target_conditions': [ - ['_toolset=="target"', { + ['_toolset=="target" and <(configuring_node)', { 'conditions': [ ['enable_pgo_generate=="true"', { 'msvs_settings': {