1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-10 16:21:40 +08:00

17 Commits

Author SHA1 Message Date
Ben Boeckel
9e2f31ec23 cmCxxModuleMapper: add a query for the open mode for the modmap
GCC (MinGW) wants to use `\n` on Windows too.

Fixes: #25974
2024-05-16 09:54:16 -04:00
Ben Boeckel
3f8a59a05c cxxmodules: return failure from the collator when private usage is found 2024-02-14 20:26:59 -05:00
namniav
e9b0dcbbfa cmCxxModuleMapper: Fix transitive requirements computation
Previously CMake may generate incomplete transitive requirements in
CMakeFiles/<target>.dir/CXXModules.json and therefore in module mapper
for compiler, when source files were listed in CMakeList.txt in a
certain order.

This commit fixes the problem by correctly tracking unfinished
transitive requirements computation of module units.

There have been a simple circular test case whose circular dependency
was reported by build system. Now with this correct implementation it's
reported by CMake generating module mappers.

Add two test cases for transitive requirements computation, one with
adding source files in hardcoded order, and the other in randomized
order.

Fixes: #25465
2023-12-05 10:26:10 -05:00
Ben Boeckel
7b05724ac8 cmCxxModuleMapper: give transitive usages to Clang as well
In the future, Clang plans to require transitive module usage to be
specified on the command line. This is in order to keep BMI files more
reproducible. Handily, MSVC has already required this, so the logic can
be reused for Clang easily.

See: e22fa1d4c6
See: https://github.com/llvm/llvm-project/issues/62707
See: https://discourse.llvm.org/t/c-20-modules-should-the-bmis-contain-paths-to-their-dependent-bmis/70422
2023-07-13 08:40:22 -04:00
Ben Boeckel
c9df4568da cmCxxModuleMapper: factor out transitive usage computation
Clang will need this in the future.
2023-07-13 08:40:22 -04:00
Ben Boeckel
e39b6ebc19 cmCxxModuleMapper: use a char for streaming single bytes 2023-07-13 08:40:22 -04:00
Ben Boeckel
18f87c87f8 cmCxxModuleMapper: track whether modules are private or not
This allows collation to give a useful error message when it finds usage
of a private module rather than collation just not informing the
compilation and the compiler erroring out about not being able to import
unknown modules (which exists, but it was not told about due to
visibility).

Fixes: #24652
2023-05-18 08:34:31 -04:00
Ben Boeckel
56f7d6f827 cmCxxModuleMapper: add a structure to represent BMI locations
This structure allows representing whether a module is private in order
to give a more useful error message when its usage is attempted from
another target.
2023-05-18 08:32:07 -04:00
Brad King
f79817fcf0 cmCxxModuleMapper: Use value semantics in path conversion callback
The call site already owns a path it doesn't need when the callback
returns.  Hand ownership to the callback so it can optionally mutate
the path without necessarily allocating.
2023-03-18 11:52:41 -04:00
Brad King
5ab002ea11 cmCxxModuleMapper: Remove redundant path conversion callbacks
Two calls to `PathForGenerator` were applied to values returned by
`BmiGeneratorPathForModule`, that already calls `PathForGenerator`.
2023-03-18 11:52:41 -04:00
Chuanqi Xu
195ee13710 cmCxxModuleMapper: Specify clang's BMI dependency with new form 2023-02-17 12:27:37 -05:00
Ben Boeckel
e84fcbcb0b cxxmodules: support new round of Clang patches
These patches now support the `-MF` output, so remove the `none` support
added just for the old patchset which did not use it.

Also update the flag name to `-fmodule-output=`.

Due to the new Clang module mapper flag, use a new experimental support
UUID as well.
2022-12-15 18:43:47 -05:00
Ben Boeckel
21b9fb1e8c cmCxxModuleMapper: support the clang module map format 2022-12-02 13:01:21 -05:00
Ben Boeckel
297e0f4dce cmCxxModuleMapper: support MSVC module map format
THis is a set of flags stored in a response file which informs the
compiler about where to place output BMI files as well as find the
required BMIs.
2022-08-02 10:53:38 -04:00
Ben Boeckel
b3c2880cb2 cmCxxModuleMapper: track transitive modules for MSVC
MSVC needs the transitive closure of module usage to compile.
2022-08-02 10:53:38 -04:00
Ben Boeckel
b43bdaff3c cmCxxModuleMapper: implement support for GCC's module map format 2022-06-16 10:28:34 -04:00
Ben Boeckel
02d0f0e752 cmCxxModuleMapper: add source to handle module mapper contents
This will allow all generators to share an implementation for actually
writing out the module map formats.
2022-06-16 10:28:34 -04:00