diff --git a/node.gypi b/node.gypi index 44780fe3b1211c..9c989022a9ad36 100644 --- a/node.gypi +++ b/node.gypi @@ -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__' ], diff --git a/tools/gyp/pylib/gyp/generator/msvs.py b/tools/gyp/pylib/gyp/generator/msvs.py index 92bf078ae86e40..bea6e643488ad1 100644 --- a/tools/gyp/pylib/gyp/generator/msvs.py +++ b/tools/gyp/pylib/gyp/generator/msvs.py @@ -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 diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index c680132f80617e..3b456a7e5c1837 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -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',