Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support clang-cl from Windows.Clang.toolchain.cmake #87

Merged
merged 5 commits into from
Oct 12, 2023

Conversation

MarkSchofield
Copy link
Owner

'Windows.Clang.toolchain.cmake' uses Clang with a GCC front-end, which seems like a great Clang default experience. But as a 'drop-in' replacement for MSVC, or to be able to run clang-tidy on an MSVC codebase, adding clang-cl support would be great. And that's what this PR does. The change:

  1. Add support for 'CMAKE_CXX_COMPILER_FRONTEND_VARIANT' to select the clang frontend variant - The crux of the change. 'Windows.Clang.toolchain.cmake' continues to default to a GCC frontend, but by setting CMAKE_C_COMPILER_FRONTEND_VARIANT or CMAKE_CXX_COMPILER_FRONTEND_VARIANT to MSVC will select clang-cl.exe.
  2. Convert UTF-16LE files with UTF8 - clang-cl.exe won't parse UTF-16E files, so converting them to UTF8 which Clang-cl and MSVC can load.
  3. Add 'clangcl' presets to compile with clang-cl.exe - Adding presets for clang-cl.exe allows the examples to be built with clang-cl.exe.
  4. Include 'clangcl' presets in .github/workflows/ci.yaml - Updating the CI definition to run the clangcl presets.

@MarkSchofield MarkSchofield merged commit 2b72525 into main Oct 12, 2023
17 checks passed
@MarkSchofield MarkSchofield deleted the mschofie/clang branch October 12, 2023 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant