Commit 5cddcfc08f0 for nodejs
commit 5cddcfc08f0dda8280914db1fc043d9bc21b4efa
Author: Vladimir Morozov <vmorozov@microsoft.com>
Date: Mon Nov 23 11:42:04 2026 -0800
build: keep PGO settings out of addon builds
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 <vmorozov@microsoft.com>
Assisted-by: AI coding assistant
PR-URL: https://github.com/nodejs/node/pull/67638
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
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': {