-
-
Notifications
You must be signed in to change notification settings - Fork 784
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
只获取 target:deps 自身的 syslinks,不要递归获取 target:pkgs 的 syslinks #5331
Comments
xmake/xmake/core/project/target.lua Lines 656 to 696 in c90b483
|
Title: Only get the syslinks of target:deps itself, do not recursively get the syslinks of target:pkgs |
怎么跳过 dep 的 packages 呢?只希望获取 project 内部的 dep 的 links,不要递归返回 package 的 links |
|
好像可以通过对 source 做过滤,出现 package:: 就跳过,但不是太优雅 |
It seems that you can filter the source and skip it if package:: appears, but it is not too elegant. |
dep:get_from("links", "self") |
试了一下,过滤 local values, sources = target:get_from("syslinks", "dep::localization.initialization_localization.reflector_detection")
for idx, value in ipairs(values) do
local source = sources[idx]
print(source)
print(value)
end |
I tried it, but filtering local values, sources = target:get_from("syslinks", "dep::localization.initialization_localization.reflector_detection")
for idx, value in ipairs(values) do
local source = sources[idx]
print(source)
print(value)
end |
不知道你说啥,反正我这可以,没法复现 add_requires("libuv")
target("foo")
set_kind("static")
add_packages("libuv")
add_syslinks("z")
target("test")
set_kind("binary")
add_deps("foo")
add_files("src/*.cpp")
on_config(function (target)
print("1111", target:dep("foo"):get("syslinks"))
print("2222", (target:get_from("syslinks", "dep::*")))
end) 1111 z
2222 {
"z",
{
"pthread",
"dl"
}
} target:get("syslinks") 原本就只会仅仅 get target 里面的 syslinks ,不会从 packages 里面取。除非你把这些设置到了 target xmake/xmake/core/project/target.lua Line 573 in c90b483
代码里,也压根没有从 pkgs 取值的实现,只要 get_from 才有可能取到 package |
I don’t know what you’re talking about. Anyway, I can do this, but I can’t reproduce it. add_requires("libuv")
target("foo")
set_kind("static")
add_packages("libuv")
add_syslinks("z")
target("test")
set_kind("binary")
add_deps("foo")
add_files("src/*.cpp")
on_config(function (target)
print("1111", target:dep("foo"):get("syslinks"))
print("2222", (target:get_from("syslinks", "dep::*")))
end) 1111z
2222 {
"z",
{
"pthread",
"dl"
}
} target:get("syslinks") will only get the syslinks in the target, not the packages. Unless you set these to target |
是我本地 xmake 版本的问题吗?这有一个最小复现的 demo: 我希望能不把依赖库 gtest 的 syslinks 引进来 |
|
gtest only supports syslinks on Linux. It may not be reproduced on Windows. I will try using another library. |
After testing it several times, the example you gave is indeed no problem. The main problem lies in the c++ rule. Adding this line won't work: |
更新到这个 patch 再试试 #5334 |
可以的,测试过了。 |
Yes, tested. |
你在什么场景下需要该功能?
我在写一个打包的 phony target,希望将当前项目里所有的 dep 的 syslinks 和 deps 导出,但是这里的 syslinks 会把 add_packages("xx") 的 syslinks 都带上,有办法可以跳过吗,只拿 target 里面 add_syslinks 的部分。
背景是现在项目接完了,想把一些之前定制化的脚本都抽到 rule 里,需要封装一下
描述可能的解决方案
无
描述你认为的候选方案
目前没啥好的解法
其他信息
No response
The text was updated successfully, but these errors were encountered: