Commit Graph

211 Commits

Author SHA1 Message Date
Ben Boeckel
fddd44c897 cmNinjaTargetGenerator: write out BMI install information for the collator 2022-07-06 10:15:23 -04:00
Ben Boeckel
95402a0bd7 cmNinjaTargetGenerator: write out export information for the collator
The collator will use this to know where the target's export information
needs to go so that module properties may be provided.
2022-07-06 10:15:23 -04:00
Ben Boeckel
d3e2e61bcd cmNinjaTargetGenerator: write out fileset information for the collator
The collator will use this to generate property settings for the
imported targets in the build and install export sets.
2022-07-06 10:15:23 -04:00
Ben Boeckel
ffd40c6b6e Tests/RunCMake/CXXModules: add a json comparison script 2022-07-06 10:15:23 -04:00
Ben Boeckel
48502a3781 cmExperimental: update CXX_MODULE_CMAKE_API UUID
The set of features available has been expanded, so update the UUID.
2022-07-06 10:15:23 -04:00
Ben Boeckel
3526b8c123 cmExport*FileGenerator: support exporting C++ module properties
C++ module properties will be generated at build time, so generate code
that includes the files actually responsible for the information.
2022-07-06 10:15:23 -04:00
Ben Boeckel
29118091dc install: support CXX_MODULES_BMI installation bits 2022-07-06 10:15:23 -04:00
Ben Boeckel
f3cfde394a cmTargetSourcesCommand: allow INTERFACE C++ modules when imported
`PUBLIC` filesets become `INTERFACE` upon installation. Allow
`INTERFACE` scopes for C++ modules when the target is imported.
2022-07-06 10:15:23 -04:00
Raul Tambre
e1adddc74e RunCMake/CXXModules/NoCXX20: Force older standard
Compile features ensure a compiler is aware of a standard version, but the one
actually used may be newer. The test relies on the standard chosen being
pre-C++20, so force C++17 explicitly.

This was exposed by a nightly bot that has a compiler defaulting to C++23. The
test would've broken anyway in a few years once GCC or Clang upped their
default.
2022-06-28 09:27:29 -04:00
Ben Boeckel
8c5a53096a Tests/RunCMake/CXXModules: add module-using examples
This includes a number of examples that should work for various levels
of support in a compiler.

There are a number of tests which are gated on various features in the
compilers. To enable the tests, set `CMake_TEST_MODULE_COMPILATION` to a
comma-separated (to avoid `;`-escaping problems) to the list of features
which are supported:

  - `named`: Named modules are supported.
  - `shared`: Shared libraries with module usage at the API boundary are
    supported.
  - `partitions`: Named module partitions are supported.
  - `internal_partitions`: Named module internal partitions are
    supported.

Additionally, a `CMake_TEST_MODULE_COMPILATION_RULES` file must be
passed which contains the rules for how to build modules using the
provided compiler. It will be included in the tests to provide these
rules. To verify that the file provided works as intended, it must set
`CMake_TEST_CXXModules_UUID` to a specific version to indicate that it
is an expected file.
2022-06-16 10:28:34 -04:00
Ben Boeckel
386465bf83 cmTarget: add support for C++ module fileset types
C++ modules have two variants which are of importance to CMake:

  - `CXX_MODULES`: interface modules (those using `export module M;`,
    `export module M:part;`, or `module M:internal_part;`)
  - `CXX_MODULE_HEADER_UNITS`: importable header units

Creating C++ modules or partitions are *not* supported in any other
source listing. This is because the source files must be installed (so
their scope matters), but not part of usage requirements (what it means
for a module source to be injected into a consumer is not clear at this
moment). Due to the way `FILE_SET` works with scopes, they are a perfect
fit as long as `INTERFACE` is not allowed (which it is not).
2022-06-16 10:28:34 -04:00