-
-
Notifications
You must be signed in to change notification settings - Fork 774
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
Distinguish config and component #1364
Comments
这个之前也有人提过,内部还区分子模块,这么搞法,过于复杂,会把 package 的内部逻辑越整越复杂,不好维护,也容易出更多的问题。。 尽量复用现有的包结构,可以把子模块展开成独立的 package ,既可以保证每个包还是现有的模式处理,也方便维护。。 通过子模块主要是为了解决下面几个问题:
问题1, 现有版本通过 既然之前已经支持了 可以采用类似的方式解决,比如下面这样: package("boost-context")
add_deps("boost", {private = true, configs = {all = true}})
on_fetch(function (package, opt)
local boost = package:dep("boost"):fetch()
if boost then
return table.join(boost, {links = "boost_context-mt"})
end
end)
package_end()
add_requires("boost-context")
target("test")
set_kind("binary")
add_files("src/*.cpp")
add_packages("boost-context") 通过 然后,你自己项目定义需要的子模块包,复用 boost/all 里面的 linkdirs/includedirs,在 fetch 阶段,仅仅开启部分 links 就行了。。 完全复用之前安装的所有文件,并不会重复安装。 你可以分成多个 比如: add_requires("boost-components", {context = true})
add_requires("boost-components", {system = true}) 都不会重复编译安装。 注:需要最新 dev 版本,依赖一些 patch 修复。 |
感谢回复,还有两个问题:
|
就按我刚说的方式,实际上都是共用的 boost all那一个包
也通过 add_configs 和 package:config 判断 另外,也可以直接改进boost package定义,如果走 all,就直接装,如果走部分配置,就加private all 的boost deps,走切片fetch,既不会deadloop,而且一个包就能搞定,对用户完全透明,前提是 得用最新的 xmake 版本,得根据版本兼容下 |
你在什么场景下需要该功能?
现在组件的管理是用config管理的。我先安装了
boost{configs={filesystem=true,system=true,regex=true,....}}
然后一个包需求是boost{configs={filesystem=true,system=true}}
,则这个包不会使用现有的boost而是重新安装仅含两个组件的boost,考虑到boost组件众多、安装时间比较长、占用空间也比较大,这样的管理方式缺乏效率描述可能的解决方案
对components,每一个component视为独立的组件,在匹配的时候只要匹配上需要的components同时其他设置都一样,那就可以复用。
在
on_fetch
里面也要处理找到的component,暂时没想到好的处理方式描述你认为的候选方案
同时因为component只有有/没有或者需要/不需要两种状态,指定时不需要和config一样麻烦,对于component可以采用更方便的处理方式
The text was updated successfully, but these errors were encountered: