我试图让xmake支持gcc-11构建c++20模块,但我有一些问题。
默认情况下,gcc-11将在当前目录中生成gcm.cache目录.如何将此默认路径修改到指定的其他目录?
我知道clang有一个-fmodules-cache-path=选项来修改模块的缓存路径,但是我没有为gcc找到类似的选项。
有人知道吗?谢谢
发布于 2022-11-06 01:46:57
对于我来说,这在ubuntu22.04 (Makefile片段)上起了作用:
MAPPER_DIR := /path/to/obj/dir
CXXFLAGS += -fmodules-ts '-fmodule-mapper=|@g++-mapper-server -r'$(MAPPER_DIR)我遇到的警告是,g++-mapper-server不会创建根目录,所以请确保首先创建它。您仍然需要计算出依赖项,以便在编译导入代码之前创建/更新gcm。
解释是|通过管道调用映射进程,@从gcc工具目录(cf gcc手册)解析进程名。-r选项设置根目录。注意保护空间和|不受make和shell的影响。
默认的映射服务器使用参数--您可以调整并使用它--以下是我的版本中的选项:
$ /usr/lib/gcc/x86_64-linux-gnu/11/g++-mapper-server --help
Usage: g++-mapper-server [OPTION...] [CONNECTION] [MAPPINGS...]
C++ Module Mapper.
-a, --accept Netmask to accept from
-f, --fallback Use fallback for missing mappings
-h, --help Print this help, then exit
-n, --noisy Print progress messages
-1, --one One connection and then exit
-r, --root DIR Root compiled module directory
-s, --sequential Process connections sequentially
-v, --version Print version number, then exit
Send SIGTERM(15) to terminate
For bug reporting instructions, please see:
<file:///usr/share/doc/gcc-11/README.Bugs>.https://stackoverflow.com/questions/69549286
复制相似问题