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>
This commit is contained in:
Vladimir Morozov authored and GitHub committed 2026-11-23 19:42:04 +00:00
1 parent 1a8cf165f5
commit 5cddcfc08f
1 file changed
+4 -3
+4 -3
View File
@@ -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': {