-
-
Notifications
You must be signed in to change notification settings - Fork 810
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
Simplifying boolean value configs #5727
Comments
In what scenario do you need this function?For packages with many components/settings, specifying them one by one is cumbersome.
Describe possible solutionsIt is hoped that the settings can be simplified in 3.0 and supported add_requires("boost[iostreams,system,thread] >=1.78.0") Equivalent to appending Describe your alternativesadd_requires("boost >=1.78.0", {configs = ["iostreams", "system", "thread"]) If a list is passed in, it is considered to be the config name; this method is less flexible than the previous one, but it has less changes to the existing syntax. Other informationNo response |
add_requires("thorvg", {configs = {
loaders = {"svg", "png"},
tools = {"svg2png"}
}}) |
这么写就更复杂了,尤其是90%的情况只需要一个配置xxx=true |
Writing this way is more complicated, especially in 90% of cases only one configuration xxx=true is needed |
1 similar comment
Writing this way is more complicated, especially in 90% of cases only one configuration xxx=true is needed |
可以考虑 ,还可以带上string值。复杂的,array values 这种,就用 configs = {} 配。 add_requires("boost[iostreams,system,thread,key=value] >=1.78.0")
add_requires("boost[iostreams=y,thread=n] >=1.78.0") xrepo install boost[iostreams,system,thread,key=value] |
这个实现比较简单,并且没啥副作用,可以提前进去,试试这个 patch #5736 |
改进了下,还能支持 array values xrepo install ffmpeg[shared,debug,codecs=[foo,bar,zoo]] |
反对一个功能有多种写法,这会给以后交流学习,教程编写带来分歧,会进一步误导新手。 add_requires("boost >=1.78.0", {configs = {iostreams = true, system = true, thread = true}}) 复制不就行了,难道真手敲? |
It is against having multiple ways to write a function, which will cause differences in future communication and learning, and tutorial writing, and will further mislead novices. add_requires("boost >=1.78.0", {configs = {iostreams = true, system = true, thread = true}}) Isn’t it enough to just copy it? Is it possible to type it by hand? |
目前限制仅对 xmake 包生效,三方包不启用,因为 vcpkg::boost[core] 等三方包有自己的包名格式,会冲突 |
The current restriction only takes effect for the xmake package. Third-party packages are not enabled because third-party packages such as vcpkg::boost[core] have their own package name formats and will conflict. |
都写c++了,一种功能多种写法应该习惯了,自己选择吧 |
I've all written C++, so I should be used to writing one function in multiple ways. You can make your own choice. |
你在什么场景下需要该功能?
对于有很多组件/设置的包,一个个指定比较繁琐
描述可能的解决方案
#5527
希望3.0中可以简化设置,支持
等价于在原有configs后追加
iostreams = true, system = true, thread = true
描述你认为的候选方案
若传入list则认为是config名称;这种做法灵活性比上一种差,但对现有语法变动小
其他信息
No response
The text was updated successfully, but these errors were encountered: