* C++20 module mapper @ 2021-10-19 15:58 Alexander Christensen 2021-10-19 16:45 ` Andrew Jones 0 siblings, 1 reply; 3+ messages in thread From: Alexander Christensen @ 2021-10-19 15:58 UTC (permalink / raw) To: gcc-help Hi, I hope I write to the right place. I would like to know how to use the module mapper, documented here https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Module-Mapper.html, to change the location of the expected gcm.cache directory. Given an example project layout: src/ Makefile project_1/ // .cpp source files Makefile project_2/ // .cpp source files Makefile Compiling from inside project_1 and project_2 folders does not work with the default module mapper, as gcc expects the module cache to be located in current working directory, which is a problem if project_2 references modules built in project_1. However, I can specify a module-mapping file. But I can't get it to work. What would be the correct syntax for such a file, located in project_2, to override the default module cache to read from modules in src/gcm.cache/ and NOT src/project_2/gcm.cache/ ? This does not work: // module_mapping.txt '$root' ../gcm.cache/ And I do not want to prepend "cd .. && " to all build commands in src/project_2/Makefile. Sincerely, Alexander ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: C++20 module mapper 2021-10-19 15:58 C++20 module mapper Alexander Christensen @ 2021-10-19 16:45 ` Andrew Jones [not found] ` <AM0PR09MB4291BC30DF53A60DBAA2FED9D4BD9@AM0PR09MB4291.eurprd09.prod.outlook.com> 0 siblings, 1 reply; 3+ messages in thread From: Andrew Jones @ 2021-10-19 16:45 UTC (permalink / raw) To: Alexander Christensen; +Cc: gcc-help Hi Alexander, Actually, I've done some work on this: https://github.com/andrewvaughanj/cpp20_module_examples and more specifically: https://github.com/andrewvaughanj/cpp20_module_examples/blob/main/do_gcc.sh Please take a look and feel free to ask if you have any questions -- cheers, Andrew On Tue, Oct 19, 2021 at 4:58 PM Alexander Christensen via Gcc-help <gcc-help@gcc.gnu.org> wrote: > > Hi, I hope I write to the right place. > > I would like to know how to use the module mapper, documented here https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Module-Mapper.html, > to change the location of the expected gcm.cache directory. Given an example project layout: > > src/ > Makefile > project_1/ > // .cpp source files > Makefile > project_2/ > // .cpp source files > Makefile > > Compiling from inside project_1 and project_2 folders does not work with the default module mapper, as gcc expects the module cache > to be located in current working directory, which is a problem if project_2 references modules built in project_1. > However, I can specify a module-mapping file. But I can't get it to work. > > What would be the correct syntax for such a file, located in project_2, to override the default module cache to read from modules in > src/gcm.cache/ and NOT src/project_2/gcm.cache/ ? This does not work: > > // module_mapping.txt > '$root' ../gcm.cache/ > > And I do not want to prepend "cd .. && " to all build commands in src/project_2/Makefile. > > > Sincerely, > Alexander > ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <AM0PR09MB4291BC30DF53A60DBAA2FED9D4BD9@AM0PR09MB4291.eurprd09.prod.outlook.com>]
* Re: C++20 module mapper [not found] ` <AM0PR09MB4291BC30DF53A60DBAA2FED9D4BD9@AM0PR09MB4291.eurprd09.prod.outlook.com> @ 2021-10-19 22:48 ` Andrew Jones 0 siblings, 0 replies; 3+ messages in thread From: Andrew Jones @ 2021-10-19 22:48 UTC (permalink / raw) To: Alexander Christensen; +Cc: gcc-help Hi Alexander, (re-added gcc-help in case this response piques any wider interests) Ah, sorry, I'd misunderstood your original question then; I've never used `-fmodules-cache-path` with `clang` -- does this allow you specify where the `.pcm`s go (rather than the current working directory)? That is, that `-emit-module-interface` automatically emits into `-fmodules-cache-path`? If so, with what name? Nonetheless, I am unaware of any such functionality inside of gcc to match this, without, of course, writing your own mapper (which you don't want to do). What you've done with symlinks clearly achieves it, but I'm not sure if that's better/worse than writing to a mapper file. As far as I know, making the mapper file is also the approach that CMake takes: https://github.com/Kitware/CMake/blob/master/Help/dev/experimental.rst Cheers, Andrew On Tue, Oct 19, 2021 at 6:24 PM Alexander Christensen <alex_c007@hotmail.com> wrote: > > Hi Andrew, > > Thank you for the fast reply, and helpful source. > Though that did not actually answer my question. > > I wanted to know if we could use the module mapping file with gcc to simulate what the flag "-fmodules-cache-path" > (presumable) does for clang? > > The syntax "<$root ??> ../gcm.cache" (or permutations thereof) seems to have no effect. > And I do not want to specify explicit mapping for each module. > Much rather, I would like to use the default cache, but at a different location, both for reading and writing. > > My current hack involves symlinks as here: https://github.com/alexpanter/modules_testing/blob/master/gcc-testing/test_07_gameengine/init.sh > > Would you happen to know about that? > > Kind regards, > Alexander > > ________________________________ > Fra: Andrew Jones <andrewvaughanj@gmail.com> > Sendt: 19. oktober 2021 18:45 > Til: Alexander Christensen <alex_c007@hotmail.com> > Cc: gcc-help@gcc.gnu.org <gcc-help@gcc.gnu.org> > Emne: Re: C++20 module mapper > > Hi Alexander, > > Actually, I've done some work on this: > > https://github.com/andrewvaughanj/cpp20_module_examples > > and more specifically: > > https://github.com/andrewvaughanj/cpp20_module_examples/blob/main/do_gcc.sh > > Please take a look and feel free to ask if you have any questions -- cheers, > > Andrew > > On Tue, Oct 19, 2021 at 4:58 PM Alexander Christensen via Gcc-help > <gcc-help@gcc.gnu.org> wrote: > > > > Hi, I hope I write to the right place. > > > > I would like to know how to use the module mapper, documented here https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Module-Mapper.html, > > to change the location of the expected gcm.cache directory. Given an example project layout: > > > > src/ > > Makefile > > project_1/ > > // .cpp source files > > Makefile > > project_2/ > > // .cpp source files > > Makefile > > > > Compiling from inside project_1 and project_2 folders does not work with the default module mapper, as gcc expects the module cache > > to be located in current working directory, which is a problem if project_2 references modules built in project_1. > > However, I can specify a module-mapping file. But I can't get it to work. > > > > What would be the correct syntax for such a file, located in project_2, to override the default module cache to read from modules in > > src/gcm.cache/ and NOT src/project_2/gcm.cache/ ? This does not work: > > > > // module_mapping.txt > > '$root' ../gcm.cache/ > > > > And I do not want to prepend "cd .. && " to all build commands in src/project_2/Makefile. > > > > > > Sincerely, > > Alexander > > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-19 22:48 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-10-19 15:58 C++20 module mapper Alexander Christensen 2021-10-19 16:45 ` Andrew Jones [not found] ` <AM0PR09MB4291BC30DF53A60DBAA2FED9D4BD9@AM0PR09MB4291.eurprd09.prod.outlook.com> 2021-10-19 22:48 ` Andrew Jones
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).