@@ -52,6 +52,45 @@ Release
5252 settings, though without PGO.
5353
5454
55+ Building Python using Clang/LLVM
56+ --------------------------------
57+
58+ See https://learn.microsoft.com/cpp/build/clang-support-msbuild
59+ for how to install and use clang-cl bundled with Microsoft Visual Studio.
60+ You can use the IDE to switch to clang-cl for local development,
61+ but because this alters the *.vcxproj files, the recommended way is
62+ to use build.bat:
63+
64+ build.bat "/p:PlatformToolset=ClangCL"
65+
66+ All other build.bat options continue to work as with MSVC, so this
67+ will create a 64bit release binary.
68+
69+ You can also use a specific version of clang-cl downloaded from
70+ https://github.com/llvm/llvm-project/releases, e.g.
71+ clang+llvm-18.1.8-x86_64-pc-windows-msvc.tar.xz.
72+ Given you have extracted that to <my-clang-dir>, you can use it like so
73+ build.bat --pgo "/p:PlatformToolset=ClangCL" "/p:LLVMInstallDir=<my-clang-dir> "/p:LLVMToolsVersion=18"
74+
75+ Setting LLVMToolsVersion to the major version is enough, although you
76+ can be specific and use 18.1.8 in the above example, too.
77+
78+ Use the --pgo option to build with PGO (Profile Guided Optimization).
79+
80+ However, if you want to run the PGO task
81+ on a different host than the build host, you must pass
82+ "/p:CLANG_PROFILE_PATH=<relative-path-to-instrumented-dir-on-remote-host>"
83+ in the PGInstrument step to make sure the profile data is generated
84+ into the instrumented directory when running the PGO task.
85+ E.g., if you place the instrumented binaries into the folder
86+ "workdir/instrumented" and then run the PGO task using "workdir"
87+ as the current working directory, the usage is
88+ "/p:CLANG_PROFILE_PATH=instrumented"
89+
90+ Like in the MSVC case, after fetching (or manually copying) the instrumented
91+ folder back into your build tree, you can continue with the PGUpdate
92+ step with no further parameters.
93+
5594Building Python using the build.bat script
5695----------------------------------------------
5796
0 commit comments