From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id 5ECBD3858D39 for ; Tue, 19 Oct 2021 22:48:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5ECBD3858D39 Received: by mail-wm1-x32f.google.com with SMTP id 63-20020a1c0042000000b0030d60716239so6103670wma.4 for ; Tue, 19 Oct 2021 15:48:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+WpIcZuvIPlgbt6G1T4wo5tO+IxHxr580TwOfL0mQ8A=; b=3WFlULb+4mKTsNjPK1oMZ3FUmoVdlFHwUNmfTNphkzR2lfrACGdimvB6SN1z3Ctggj 1mDRorGqdjynxuHjGAsoUnw5x79kx6iEDgp7LKoRvFm67QDFM0/HlLBGXYaY3ECdjRvK zhwFNRgp9WvP0kqL2KW1fBBP08BIhTCt8o9ci7erFflgLi8ggFoLniyzyYIY86T3alkY fdriTtHUF2hVDJjpSny1Tej7Tke6PF1neJJXlEp56igHJ/02UZ7ZzK7GaoL+r41AcjGn kd5eHMkjD2wmqkhShwRxls1vj52UTMlHmMdN+W2aLeCJpi0F0I3V74nhEAyKbxc8p0Sc QzuA== X-Gm-Message-State: AOAM532na2LtC4u62hRKqe/gUv+8PDhc6W8Gm8us1vMNxyfG+bFu7ypW s8D9kbcrtOUFqjy/0IP4z1E9Z0fJt0hSg48GLVg= X-Google-Smtp-Source: ABdhPJzAI6W3GQddJIVdjdhdfcTVjei/PYCvWcECz/tP4PfVfV5KYxnnf/yfBo3TkSZc1PRKAzKxlW3A4X5aplKjCWA= X-Received: by 2002:a1c:e90a:: with SMTP id q10mr9418163wmc.108.1634683715080; Tue, 19 Oct 2021 15:48:35 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andrew Jones Date: Tue, 19 Oct 2021 23:48:24 +0100 Message-ID: Subject: Re: C++20 module mapper To: Alexander Christensen Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Oct 2021 22:48:37 -0000 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 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 > Sendt: 19. oktober 2021 18:45 > Til: Alexander Christensen > Cc: 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 > 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 > >