-
-
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
使用mingw toolchain无法检测 HAVE_INTPTR_T #4173
Comments
这只是你的编译错误,要看 xmake f -vD; xmake -vD 的 check error info 。。贴下 |
This is just your compilation error, it depends on the check error info of xmake f -vD; xmake -vD. . posted |
关键日志:
|
这个不太好搞,因为你用了 而 你用的 configvar_check_cxxtypes 是全局接口,跟 target 没有关系,因此它无法获取到 add_toolchains 的工具链信息,只能从全局平台层 获取工具链,而全局平台工具链,如果系统没有 mingw,也没 而 configvar_check_cxxtypes 内部实现走的 option,这个阶段不太可能取到 add_toolschains 的信息,即使后期想支持也不好实现 如果想要在自动绑定 toolchains 的前提下,也能实现自动检测,得用 target 的检测接口才行。。 add_requires("mingw-w64 8.1.0")
set_toolchains("mingw@mingw-w64")
target("test")
on_config(function (target)
if target:has_cxxtypes("intptr_t", {includes = "memory"}) then
target:set("configvar", "HAVE_INTPTR_T", 1)
end
end) 其他的检测接口类似,target 层的检测接口,跟 add_toolchains 工具链绑定是同步的,而且不同 target 可以绑定 不同的 toolchains ,也不会干扰检测。。 具体见 #3522 如果觉得每个 target 都这么配置比较繁琐,可以单独搞个 check.lua 的模块,配置所有检测后,统一处理。。 独立模块可以像 cmake 那样,单独搞个 xmake 目录维护所有配置脚本,然后用 add_moduledirs + import 引入 https://xmake.io/#/zh-cn/manual/global_interfaces?id=add_moduledirs
add_moduledirs("xmake")
-- 全局配置,所有 target 生效
on_config(function (target)
import("check")
check(target)
end)
target("test1")
target("test2") check.lua function main(target)
-- check cxxtypes
-- check includes
-- check functions ...
end |
感谢,已成功配置:XmacsLabs/lolly#137 |
在target进行的检测可以缓存吗? |
Can detection performed at target be cached? The |
没有, on_config 每次配置都会被执行,不过 dev 我刚加了个 recheck 状态,你可以根据这个来判断是否需要检测 on_config(target, opt)
if opt.recheck and target:has_cfuncs(...) then
end
end |
No, on_config will be executed every time the configuration is configured, but I just added a recheck status to dev. You can use this to determine whether detection is needed. on_config(target, opt)
if opt.recheck and target:has_cfuncs(...) then
end
end |
参考这个 patch, tboox/tbox#235 |
Refer to this patch, tboox/tbox#235 |
Xmake 版本
dev and 2.8.2
操作系统版本和架构
Windows 11
描述问题
无法检测
在手动将mingw相关路径加入之后,可以检测到 HAVE_INTPTR_T,比如 https://github.com/XmacsLabs/lolly/blob/main/bin/config_mingw
期待的结果
HAVE_INTPTR_T能够被检测到
工程配置
附加信息和错误日志
xmake config的关键信息
出错信息(和lolly仓库有关)
The text was updated successfully, but these errors were encountered: