Skip to content

Commit

Permalink
build,win: enable pch for clang-cl
Browse files Browse the repository at this point in the history
Fixes: #55208
PR-URL: #55249
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
StefanStojanovic authored Oct 11, 2024
1 parent 82dab76 commit 27f8d9e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 5 additions & 9 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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__' ],
Expand Down
6 changes: 5 additions & 1 deletion tools/gyp/pylib/gyp/generator/msvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 27f8d9e

Please sign in to comment.