Skip to content

Commit 27f8d9e

Browse files
build,win: enable pch for clang-cl
Fixes: #55208 PR-URL: #55249 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 82dab76 commit 27f8d9e

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

node.gypi

+5-9
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,11 @@
6565
'NODE_PLATFORM="win32"',
6666
'_UNICODE=1',
6767
],
68-
'conditions': [
69-
['clang==0', {
70-
'msvs_precompiled_header': 'tools/msvs/pch/node_pch.h',
71-
'msvs_precompiled_source': 'tools/msvs/pch/node_pch.cc',
72-
'sources': [
73-
'<(_msvs_precompiled_header)',
74-
'<(_msvs_precompiled_source)',
75-
],
76-
}],
68+
'msvs_precompiled_header': 'tools/msvs/pch/node_pch.h',
69+
'msvs_precompiled_source': 'tools/msvs/pch/node_pch.cc',
70+
'sources': [
71+
'<(_msvs_precompiled_header)',
72+
'<(_msvs_precompiled_source)',
7773
],
7874
}, { # POSIX
7975
'defines': [ '__POSIX__' ],

tools/gyp/pylib/gyp/generator/msvs.py

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

tools/v8_gypfiles/v8.gyp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
'type': 'none',
4949
'toolsets': ['host', 'target'],
5050
'conditions': [
51-
['OS=="win" and clang==0', {
51+
['OS=="win"', {
5252
'direct_dependent_settings': {
5353
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
5454
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',

0 commit comments

Comments
 (0)