-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
support toolchains for other platforms #2117
Conversation
waruqi
commented
Mar 1, 2022
- Before adding new features and new modules, please go to issues to submit the relevant feature description first.
- Write good commit messages and use the same coding conventions as the rest of the project.
- Please commit code to dev branch and we will merge into master branch in feature
- Ensure your edited codes with four spaces instead of TAB.
- 增加新特性和新模块之前,请先到issues提交相关特性说明,经过讨论评估确认后,再进行相应的代码提交,避免做无用工作。
- 编写友好可读的提交信息,并使用与工程代码相同的代码规范,代码请用4个空格字符代替tab缩进。
- 请提交代码到dev分支,如果通过,我们会在特定时间合并到master分支上。
- 为了规范化提交日志的格式,commit消息,不要用中文,请用英文描述。
@@ -503,7 +503,8 @@ function _get_configs(package, configs, opt) | |||
_get_configs_for_appleos(package, configs, opt) | |||
elseif package:is_plat("mingw") then | |||
_get_configs_for_mingw(package, configs, opt) | |||
elseif not package:is_plat(os.subhost()) then | |||
elseif not package:is_plat(os.subhost()) or | |||
package:config("toolchains") then -- we need pass toolchains |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请教下 os.subhost()
是什么含义?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.host 主机pc平台,跟编译的目标平台无关
windows上有 cygwin, msys 等一些子系统环境,用 os.subhost 细分标识
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is problematic for me as some of my packages can't be built with my custom toolchain (hfuzz-clang).
https://github.com/DigitalPulseSoftware/NazaraEngine/runs/5427326167?check_suite_focus=true
is there a way (maybe using add_requiresconf) to compile them with the regular toolchain and then use them with my custom toolchain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you show me the configuration and use of custom toolchains in your xmake.lua?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the toolchain file: https://github.com/DigitalPulseSoftware/NazaraEngine/blob/master/xmake/toolchains/hfuzz-clang/xmake.lua
It's directly used as a commandline parameter: https://github.com/DigitalPulseSoftware/NazaraEngine/blob/ea8156f0b4ad74ac3d05568146f11ee3d2573caf/.github/workflows/linux-build-sanitizer.yml#L83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use add_requires("xxx",{configs ={toolchains="gcc"})
to modify toolchains. But automatically use the internal host toolchain, I still need to look at it and maybe make some changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try set_policy("package.inherit_external_configs", false)
in project xmake.lua? dev version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/DigitalPulseSoftware/NazaraEngine/runs/5437929209?check_suite_focus=true
doesn't seem to work
here's how I'm using it:
elseif is_mode("fuzz") then
-- we don't want packages to require compilation with fuzz toolchain
set_policy("package.inherit_external_configs", false)
确认下,这个改动是不是意味着仅指定 --toolchain 的情况下,工具链参数也会透传? |
会了,但目前还不保证可靠 |
试了下编译 cmake 构建的 gflags,看起来没啥问题。 我测试的系统上现在同时有 cross 和非 cross,且指定 toolchain 的 gflags 存在。 > xrepo scan gflags
scanning packages ..
gflags-v2.2.2:
-> 0f545414272c459b907061d5e923ed20: linux, x86_64
-> {debug=false,mt=true,pic=true,shared=false}
-> 3ade623b6e544d9e8dcb3afef4935297: linux, x86_64
-> {debug=false,mt=true,pic=true,shared=true,toolchains="clang"}
-> 6adb17d9c25e4046bd8ef924b9c36766: linux, x86_64
-> {debug=false,mt=true,pic=true,shared=false,toolchains="clang"}
-> f88016fe19ef4cbc854cc24668f1c26e: cross, none, unused
-> {debug=true,mt=true,pic=true,shared=true,toolchains="clang"}
-> ab162611d90c4693ba8ef9334c8bc872: cross, none, unused
-> {debug=true,mt=true,pic=true,shared=true,toolchains="gcc"} |
如果没问题,你也可以试用着,我之前测试 openssl 似乎不行,后来还没细看。。而且目前 xmake-repo ci上没对这块做测试。。但是 cross 的有严格测试 |
嗯,我回头试试看 openssl。 如果 autoconf 和 cmake 都没什么问题的话,我想把 xrepo-cmake 里指定 toolchain 后自动设置 platform 为 cross 的逻辑去掉。不然非 cross 平台透传 toolchain 在那边用不上。 我这边只是需要同系统上 clang, gcc-4.8, gcc-9 之间切换,CI 里已经有多个系统和不同编译器覆盖了,猜想应该不会有太多问题。 |
这边真要支持,就不能只考虑 linux + clang/gcc 的。。ci 上肯定也要加 clang 单独测试的。。不然不可靠 至少还得加个 linux + clang 的 ci |
测试环境是 ArchWsl,系统默认编译器是 gcc-11,安装了 clang-13。 看日志 b2 是在用 clang 编译,但遇到了 |
装下 libc++-dev |
|