-
-
Notifications
You must be signed in to change notification settings - Fork 477
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
feat: add openharmony support #1702
Conversation
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.
You should also explicitly set that we depend on raw-window-handle 0.6.2
, since the build will break otherwise.
Should i update the |
open harmony was added in 0.6.2, so you should explicitly specify 0.6.2 |
Done |
@@ -5,11 +5,12 @@ fn main() { | |||
cfg_aliases! { | |||
// Systems. | |||
android_platform: { target_os = "android" }, | |||
ohos_platform: { target_env = "ohos" }, |
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.
Glutin's CI is quite extensive. @richerfu would you be up for adding one or two ohos
target triples to our CI with the egl
feature, so that we can always build-test this functionality and make sure this target environment is not accidentally broken in the future?
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.
OpenHarmony currently has no environment to directly run cargo test
, and all code testing is forcibly dependent on real machines. So there is no way to do some testing or verification in the CI environment for the time being. According to official news, this capability will be supported as early as Q1 2025.
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.
@richerfu I don't think we need run-time tests, just build-testing (i.e. cargo check/build/clippy
) is enough for now to at least guarantee a minimum level of source compatibility. We can incrementally move towards testing on real machines if that possibility is provided.
For example, this works for me:
$ rustup target add x86_64-unknown-linux-ohos
$ cargo clippy --all-features --target x86_64-unknown-linux-ohos -p glutin
And if I make a silly change, like commenting out a Self::Ohos
match
arm, the compiler/CI could complain that the ohos
target no longer even compiles:
$ cargo clippy --all-features --target x86_64-unknown-linux-ohos -p glutin
error[E0004]: non-exhaustive patterns: `api::egl::surface::NativeWindow::Ohos(_)` not covered
--> glutin/src/api/egl/surface.rs:541:15
|
541 | match *self {
| ^^^^^ pattern `api::egl::surface::NativeWindow::Ohos(_)` not covered
|
note: `api::egl::surface::NativeWindow` defined here
--> glutin/src/api/egl/surface.rs:446:6
|
446 | enum NativeWindow {
| ^^^^^^^^^^^^
...
460 | Ohos(*mut ffi::c_void),
| ---- not covered
= note: the matched value is of type `api::egl::surface::NativeWindow`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
541 ~ match *self {
542 + api::egl::surface::NativeWindow::Ohos(_) => todo!(),
543 + }
|
For more information about this error, try `rustc --explain E0004`.
error: could not compile `glutin` (lib) due to 1 previous error
(Which may be useful if we edit some code elsewhere or add new match
blocks in the future, etc..)
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.
Ok, i'll try to add some code and upgrade CI config later.
CHANGELOG.md
if knowledge of this change could be valuable to usersAdd openharmony platform support, now we can build it successfully with XComponent. It doesn't effect any other code, so i think i needn't to add more docs or tests.
And you can find a full example with example. If you want more info, please let me know, thanks !