C++ Logo

sg15

Advanced search

Re: [Modules] Should the compiler try to build std module implicitly?

From: Olga Arkhipova <olgaark_at_[hidden]>
Date: Tue, 12 Dec 2023 19:03:11 +0000
>> I am convinced such a tool will sooner rather than later contain a substantial chunk of a real-world build system.
Define substantial 😊Have cl.exe or clang.exe abilities to build an exe expanded over years?
And no, I don't think this tool need to do any up-to date checks of do smart searches of the tools. It should rely on the environment to get all locations it needs, same as compilers.

-----Original Message-----
From: Boris Kolpackov <boris_at_codesynthesis.com>
Sent: Tuesday, December 12, 2023 7:57 AM
To: Olga Arkhipova <olgaark_at_[hidden]>
Cc: sg15_at_lists.isocpp.org; Tom Honermann <tom_at_honermann.net>
Subject: Re: [SG15] [Modules] Should the compiler try to build std module implicitly?

Olga Arkhipova <olgaark_at_microsoft.com> writes:

> The tool invokes the compiler to scan the sources, constructs the
> dependency graph and builds all given c++ sources and header units.

I am convinced such a tool will sooner rather than later contain a substantial chunk of a real-world build system.

Take the `import std;` support as an example. I have it implemented in build2 for MSVC and Clang/libc++. Here are the extras I needed to do that:

1. Detect the compiler id and version (to check the requested
   functionality is available).

2. Detect the standard library being used (to detect libc++).

3. Detect the header search paths used by the compiler (to find the std
   module for MSVC).

4. Detect the standard library variant being linked (-static-libstdc++,
   /MT[d] or /MD[d]) in order to build the corresponding BMI.

5. Unless the plan is to rebuilt the std module on every invocation (and
   endure several second compilation times for hello-world programs),
   extract headers (/M*, /showIncludes) and track changes since the
   std modules for both implementations include headers.

Received on 2023-12-12 19:03:15