[libcxx-commits] [PATCH] D144994: [Draft][libc++][modules] Adds std module.

Chuanqi Xu via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 13 01:30:34 PDT 2023


ChuanqiXu added inline comments.


================
Comment at: libcxx/docs/Modules.rst:65
+   to discuss that approach before spending effort in it.
+ * Currently the ``cppm`` file and the generated ``CMakeLists.txt`` are not
+   installed. Before doing that it would be good to determine what the best
----------------
ChuanqiXu wrote:
> h-vetinari wrote:
> > Mordante wrote:
> > > aaronmondal wrote:
> > > > We intend to distribute all `.cppm` files, i.e. the partitions as well, right?
> > > Yes I want to distribute them, in fact we must distribute them else users can't use modules.
> > > 
> > > But we need to find the "proper" location to store them. Since this is something new this probably needs some involvement of our packagers. I don't expect the Linux Standard Base has an entry for C++20 modules.
> > > But we need to find the "proper" location to store them. Since this is something new this probably needs some involvement of our packagers. I don't expect the Linux Standard Base has an entry for C++20 modules.
> > 
> > As mentioned already, I think there are strong parallels with distributing headers. The bare minimum should be that they are automatically discoverable by the toolchain that produced them (should be somewhere under INSTALL_PREFIX obviously), but ideally it's in a standard location that's uniform across toolchains (again, relative to a PREFIX), like the headers and libs are too. I'm not sure if SG21 has had discussions about this, or if CMake has already thought about this.
> > 
> > Personally, I think the best might be a separate folder like `$PREFIX/something_module_related/foo.cppm`, but I wouldn't care much or at all if it's under `$PREFIX/include/something_module_related/foo.cppm` or `$PREFIX/lib/<libname>/foo.cppm`, etc., as long as it's discoverable and works.
> > 
> > CC @mgorny as another packager & @ben.boeckel for the CMake side.
> > I'm not sure if SG21 has had discussions about this, or if CMake has already thought about this.
> 
> As far as I know, sg15 has discussed this for a long time. (If I recall this correctly,) sg15 don't get the final consensus yet. But @ruoso has already made a lot of proposals. We can look at them later.
> 
> > Personally, I think the best might be a separate folder like $PREFIX/something_module_related/foo.cppm, but I wouldn't care much or at all if it's under $PREFIX/include/something_module_related/foo.cppm or $PREFIX/lib/<libname>/foo.cppm, etc., as long as it's discoverable and works.
> 
> I think we need to discuss this in the discourse. Because the patch is going to be a large patch and the topic about distribution is another big topic. It looks not good to discuss two big things in the same page. The direction may be lost.
I created https://discourse.llvm.org/t/rfc-about-the-default-location-for-std-modules/69191 and let's discuss this there.


================
Comment at: libcxx/stdmodules/CMakeLists.txt.in:71-75
+add_library(std)
+target_sources(std
+  PUBLIC FILE_SET cxx_modules TYPE CXX_MODULES FILES
+    @LIBCXX_SOURCES_MODULE_STD@
+)
----------------
This is what I did in the downstream. I imaged that we will merge this one with libc++.so in the upstream. But maybe I am wrong.
I feel we need to give it another name like `libc++-modules`. Otherwise it may be conflict with the std modules provided by libstdc++ later.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144994/new/

https://reviews.llvm.org/D144994



More information about the libcxx-commits mailing list