如何设置所有目标的输出路径? #3054
Unanswered
SineStriker
asked this question in
Q&A
如何设置所有目标的输出路径?
#3054
Replies: 1 comment
-
查了下源码似乎用这种方式可以实现? rule("bin")
on_load(function (target)
local kind = target:kind()
if kind == "static" then
target:set("targetdir", get_config("xmake_library_output_dir"))
elseif kind == "shared" then
if os.host() == "windows" then
target:set("targetdir", get_config("xmake_runtime_output_dir"))
else
target:set("targetdir", get_config("xmake_library_output_dir"))
end
elseif kind == "binary" then
target:set("targetdir", get_config("xmake_runtime_output_dir"))
end
end)
rule_end() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
我目前想法是用
add_rules
,先定义一个规则,在所有目标声明中使用这个规则,但是set_targetdir
不能在规则中使用。就感觉有点奇怪,set_xxx或者add_xxx为什么有些能在options或者rules中使用,有些不能,文档也没说。我也没有搞懂rules和options有什么区别,但是如果当前想法替换成option,xmake会直接解析不出来这个脚本。Beta Was this translation helpful? Give feedback.
All reactions