From b6d800282315ed81962013a6558177439b58ca34 Mon Sep 17 00:00:00 2001 From: StefanStojanovic Date: Thu, 3 Oct 2024 15:51:39 +0200 Subject: [PATCH] fix: enable pch for clang on windows --- pylib/gyp/generator/msvs.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pylib/gyp/generator/msvs.py b/pylib/gyp/generator/msvs.py index 92bf078..bea6e64 100644 --- a/pylib/gyp/generator/msvs.py +++ b/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