Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译安装c++module之后遇到不同目录下相同文件名被意外覆盖了 #3730

Closed
masx200 opened this issue May 10, 2023 · 6 comments

Comments

@masx200
Copy link

masx200 commented May 10, 2023

Xmake 版本

2.7.8

操作系统版本和架构

linux aarch64

描述问题

编译安装c++module之后遇到不同目录下相同文件名被意外覆盖了

源码文件的模块名都不相同

期待的结果

编译安装c++module之后遇到不同目录下相同文件名被意外覆盖了
应该按照模块名称来给文件重命名才对啊,防止同名文件被覆盖

工程配置

set_languages("c17", "cxx20");
add_repositories("masx200/xmake-repo https://gitee.com/masx200/xmake-repo.git");
add_repositories(
    "masx200/xmake-repo https://ghproxy.com/https://github.com/masx200/xmake-repo.git");
add_requires("leetcode-treenode-cpp 1.1.6");
target('leetcode-test')
set_languages("c++20");
set_kind('static')
set_policy("build.c++.modules", true);
add_files('*/*.ixx', {install = true})
add_packages("leetcode-treenode-cpp");
target_end()

附加信息和错误日志

源码文件

 add-two-integers/index.ixx
 animal-shelter-lcci/index.ixx
 calculate-delayed-arrival-time/index.ixx
 check-if-it-is-a-good-array/index.ixx
 complement-of-base-10-integer/index.ixx
 construct-quad-tree/Node.ixx
 construct-quad-tree/index.ixx
 design-linked-list/index.ixx
 design-skiplist/index.ixx
 fibonacci-number/index.ixx
 frog-jump-ii/index.ixx
 implement-trie-prefix-tree/index.ixx
 insert-into-a-binary-search-tree/EqualTreeNode.ixx
 insert-into-a-binary-search-tree/HashTreeNode.ixx
 insert-into-a-binary-search-tree/PostOrderTraversal.ixx
 insert-into-a-binary-search-tree/debugTreeNode.ixx
 insert-into-a-binary-search-tree/index.ixx
 insert-into-a-binary-search-tree/printTreeNode.ixx
 insufficient-nodes-in-root-to-leaf-paths/debugTreeNode.ixx
 insufficient-nodes-in-root-to-leaf-paths/index.ixx
 insufficient-nodes-in-root-to-leaf-paths/printTreeNode.ixx
 largest-rectangle-in-histogram/index.ixx
 maximum-sum-with-exactly-k-elements/index.ixx
 number-complement/index.ixx

安装文件

 EqualTreeNode.ixx
 EqualTreeNode.ixx.meta-info
 HashTreeNode.ixx                                  
  HashTreeNode.ixx.meta-info                        
  Node.ixx                                         
   Node.ixx.meta-info                                  
PostOrderTraversal.ixx
 PostOrderTraversal.ixx.meta-info                    
debugTreeNode.ixx
 debugTreeNode.ixx.meta-info                       
  index.ixx                                          
 index.ixx.meta-info                               
  printTreeNode.ixx                                 
  printTreeNode.ixx.meta-info
@masx200 masx200 added the bug label May 10, 2023
@masx200
Copy link
Author

masx200 commented May 11, 2023

@waruqi

@waruqi
Copy link
Member

waruqi commented May 11, 2023

不要催,我很忙。。有空我会看的

@masx200
Copy link
Author

masx200 commented May 11, 2023

@Arthapz
@OpportunityLiu

@masx200
Copy link
Author

masx200 commented May 12, 2023

local metafilepath = path.join(outputdir, path.filename(cppfile) .. ".meta-info")

local metafilepath = path.join(outputdir, path.filename(cppfile) .. ".meta-info")

local metafilepath = path.join(outputdir, path.filename(cppfile) .. ".meta-info")

function install_module_target(target)

function generate_meta_module_info(target, name, sourcefile, requires)

@waruqi
Copy link
Member

waruqi commented May 12, 2023

你可以先自己调下,或者来个 pr 我暂时没时间看这个。

@waruqi
Copy link
Member

waruqi commented May 13, 2023

应该按照模块名称来给文件重命名才对啊,防止同名文件被覆盖

这个模块名没关系,是安装没保留路径层次结构的问题,你改成模块名也没用,一个模块也许会会拆分到多个文件定义,总不可能多个文件,改成同一个文件名,也会冲突。

但直接保留路径层次,会有一些问题:1. win长路径限制,2. 只能处理相对路径,绝对路径无法处理 3. 层次跨度大会有 ../../../../ 等问题,跑出安装根目录外面。

modules 分支我改进了下,用 module hash 也唯一标识维护区分,将层级拉平且不冲突。

#3739

先通过这个更新测试。

xmake update -s dev

注:由于安装结构变动,测试前,先删除 build 目录,并且重新安装所有带module的包。

rm -rf build
xmake f -cvD

@waruqi waruqi added this to the v2.7.9 milestone May 13, 2023
waruqi added a commit that referenced this issue May 14, 2023
@masx200 masx200 closed this as completed May 14, 2023
waruqi added a commit that referenced this issue Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants