build,win: enable pch for clang-cl

Fixes: https://github.com/nodejs/node/issues/55208
PR-URL: https://github.com/nodejs/node/pull/55249
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
Stefan Stojanovic 2024-10-11 12:28:55 +02:00 committed by GitHub
parent 82dab76d63
commit 27f8d9e9d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 11 deletions

View File

@ -65,15 +65,11 @@
'NODE_PLATFORM="win32"',
'_UNICODE=1',
],
'conditions': [
['clang==0', {
'msvs_precompiled_header': 'tools/msvs/pch/node_pch.h',
'msvs_precompiled_source': 'tools/msvs/pch/node_pch.cc',
'sources': [
'<(_msvs_precompiled_header)',
'<(_msvs_precompiled_source)',
],
}],
'msvs_precompiled_header': 'tools/msvs/pch/node_pch.h',
'msvs_precompiled_source': 'tools/msvs/pch/node_pch.cc',
'sources': [
'<(_msvs_precompiled_header)',
'<(_msvs_precompiled_source)',
],
}, { # POSIX
'defines': [ '__POSIX__' ],

View File

@ -3412,7 +3412,11 @@ def _FinalizeMSBuildSettings(spec, configuration):
)
# Turn on precompiled headers if appropriate.
if precompiled_header:
precompiled_header = os.path.split(precompiled_header)[1]
# While MSVC works with just file name eg. "v8_pch.h", ClangCL requires
# the full path eg. "tools/msvs/pch/v8_pch.h" to find the file.
# P.S. Only ClangCL defines msbuild_toolset, for MSVC it is None.
if configuration.get("msbuild_toolset") != 'ClangCL':
precompiled_header = os.path.split(precompiled_header)[1]
_ToolAppend(msbuild_settings, "ClCompile", "PrecompiledHeader", "Use")
_ToolAppend(
msbuild_settings, "ClCompile", "PrecompiledHeaderFile", precompiled_header

View File

@ -48,7 +48,7 @@
'type': 'none',
'toolsets': ['host', 'target'],
'conditions': [
['OS=="win" and clang==0', {
['OS=="win"', {
'direct_dependent_settings': {
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',