在我的项目中,我有几个依赖于单个模块的插件,其中包含Group类似于以下内容的项目:
Group {
name: "group"
qbs.install: true
qbs.installDir: "../"
files: <filename>
}
但是编译失败并出现“错误:无法将文件'文件名'和'文件名'安装到同一位置'位置'”。基本上,qbs 不能将同一个文件复制到同一个位置两次(对我来说似乎不合逻辑)
如何解决此错误或是否有任何优雅的解决方法?
在我的项目中,我有几个依赖于单个模块的插件,其中包含Group类似于以下内容的项目:
Group {
name: "group"
qbs.install: true
qbs.installDir: "../"
files: <filename>
}
但是编译失败并出现“错误:无法将文件'文件名'和'文件名'安装到同一位置'位置'”。基本上,qbs 不能将同一个文件复制到同一个位置两次(对我来说似乎不合逻辑)
如何解决此错误或是否有任何优雅的解决方法?
这是qbs.installSourceBase物业的工作。基本上,您将其设置为包含组中文件的基本目录,Qbs 将qbs.installDir根据它们相对于上述基本目录的路径将列出的文件分层安装。
例如,给定以下组:
// defined in /source/myproject/myproject.qbs
Group {
qbs.install: true
qbs.installDir: "share/stuff"
qbs.installSourceBase: "." // relative to /source/myproject
files: [
"fileA.txt",
"fileB.txt",
"subdir/fileB.txt",
]
}
和以下命令行调用:
$ qbs [...] --install-root /sample/some-root
将产生以下文件系统层次结构:
/sample/some-root/share/stuff/fileA.txt
/sample/some-root/share/stuff/fileB.txt
/sample/some-root/share/stuff/subdir/fileB.txt
有关详细信息,请参阅 Qbs安装属性文档。
有一种解决方法,可能需要对项目进行一些重组:
代替:
Module {
name: "somemodule"
// module properties set to dependant products
Group {
// files to install
qbs.install: true
}
}
我们可以用:
Product {
name: "somemodule"
Group {
// files to install
qbs.install: true
}
Export {
// module properties set to dependant products
}
}
这样,文件只在mymodule运行步骤时安装一次,从而消除了冲突。Export通过Item导出的模块属性与通过Module.
限制:
Product必须添加references到Project项目Modules不能依赖ProductItems,这可能需要将所有依赖模块重组为Project/Export对