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

Add back MSVC C++20 Module Support #3195

Closed
laitingsheng opened this issue Nov 19, 2022 · 3 comments
Closed

Add back MSVC C++20 Module Support #3195

laitingsheng opened this issue Nov 19, 2022 · 3 comments
Labels

Comments

@laitingsheng
Copy link
Contributor

laitingsheng commented Nov 19, 2022

As introduced in #2432 and #3134, the MSVC C++20 Module support has been removed completely.

However, based on my recent observation, I think the module is actually compilable at least under VS version 17.3.6 (the version I am currently using), the only thing we need to do is to remove the enable_module function from CMakeLists.txt. MSVC will be able to find the corresponding ifc for fmt itself without extra hints.

I think now the problems fall back to the fact that numeric functions in <cmath> are not necessarily constexpr until C++23 as per the standard. The compilation failed somehow indicating that workarounds like fmt::detail::isnan etc. are not working with MSVC.

@vitaut Do you have any ideas about this?

@vitaut
Copy link
Contributor

vitaut commented Nov 24, 2022

Last time we checked module support was broken in MSVC (even workarounds didn't help) but if it works on more recent versions a PR to enable it would be welcome.

@laitingsheng
Copy link
Contributor Author

I don't have a chance to complete the PR, so I marked that one as draft. I will try to add an extra CI pipeline for testing module build later.

@DanielaE
Copy link
Contributor

I don't think there's an extra pipeline needed. The requirements are

  • a CMake that handles modules in at least some way. The last time this was the case was early v3.20, all later versions created broken build instructions for the pipeline (unless you use the Ninja generator instead of the default VS generator). CMake 3.25 claims to support modules but without documentation how to use it. This is the info I got from JetBrains last week.
  • a CMakeLists.txt that enables the build of the test module plus the module test executable, written in a CMake syntax that matches the CMake version used. I wouldn't even bother to do so with CMake versions that don't officially support modules.
  • a compiler that really can compile the {fmt} module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants