可以根据不同架构切换使用不同的Qt路径吗 #5294
可以根据不同架构切换使用不同的Qt路径吗
#5294
-
指windows下x86和x64的路径切换,自己写个包描述可行?但是不知道该怎么写 |
Beta Was this translation helpful? Give feedback.
Answered by
waruqi
Jul 8, 2024
Replies: 3 comments 4 replies
-
试试
option("qt_path", default = nil)
if has_config("qt_path") then
set_config("qt", path.join(get_config("qt_path"), get_config("arch")))
end |
Beta Was this translation helpful? Give feedback.
1 reply
-
我又试了好多方法,感觉还是卡住了,我希望的是,实际工程只需要设置一个公共目录的 option ,就可以根据 option 来导入一个 rule ,这个 rule 里面根据架构判断使用公共目录的 x64 的 qt 还是 x86 的 qt ,比如是这样的 -- myqt.lua
rule("myqt")
on_load(function (target)
if target:is_arch("x86") then
target:set_config("qt", path.join("$(Public)", "msvc2013_opengl"))
else
target:set_config("qt", path.join("$(Public)", "msvc2013_64_opengl"))
end
end)
rule_end() -- xmake.lua
option("Public")
set_default("$(env Public)")
option_end()
includes("$(Public)/rules/myqt.lua")
add_rules("myqt") 但是 includes 不识别 |
Beta Was this translation helpful? Give feedback.
3 replies
-
ok可以了,写了个包描述 |
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
你可以尝试重新定义 qt.env rule 来重写查找规则。。不过就是有些 hack ,以后有可能会被 break
https://github.com/xmake-io/xmake/blob/dev/xmake/rules/qt/env/xmake.lua
或者参考 xmake-repo 的 qt 包,qtbase,qtgui ,... 做些定制
https://github.com/xmake-io/xmake-repo/tree/dev/packages/q/qtbase