-
-
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
package.tools.cmake: Use newer Android toolchain and support runtimes #4917
Conversation
SirLynix
commented
Apr 1, 2024
- 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消息,不要用中文,请用英文描述。
-- https://cmake.org/cmake/help/latest/variable/CMAKE_ANDROID_STL_TYPE.html | ||
local supported_runtimes = { | ||
"none", "system", | ||
"gabi++_static", "gabi++_shared", |
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.
package:has_runtime only support
"gnustl_static", "gnustl_shared",
"c++_static", "c++_shared",
"stlport_static", "stlport_shared"
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.
I know but maybe it will be extended in the future, so I put all runtimes supported by this cmake option
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.
Please add them when xmake actually supports them. Also, the runtime names of cmake and ndk are not necessarily the same as the runtimes of xmake, and may need to be mapped, so don't add some unknown runtime names for now.
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.
Fair enough, done
if package:has_runtime(runtime) then | ||
table.insert(configs, "-DCMAKE_ANDROID_STL_TYPE=" .. runtime) | ||
break | ||
end | ||
end |
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.
I think this will be better.
local runtime = package:runtimes()
if runtime then
table.insert(configs, "-DCMAKE_ANDROID_STL_TYPE=" .. runtime)
end
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.
what if multiple runtimes have been set?
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.
only one runtime.
xmake/xmake/toolchains/ndk/xmake.lua
Line 36 in d1ee610
set_runtimes("c++_static", "c++_shared", "gnustl_static", "gnustl_shared", "stlport_static", "stlport_shared") |
set_runtimes("c++_static", "MT")
-> package:runtimes() only return c++_static
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.
I got confused by the plural form (runtimes instead of runtime).
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.
For some toolchains and platforms that support multiple runtimes, it may have multiple values, but for android/msvc, only one value is possible