Skip to content

Commit

Permalink
fix: build error
Browse files Browse the repository at this point in the history
  • Loading branch information
richerfu committed Jan 24, 2025
1 parent 631fa1f commit 3bd7336
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
5 changes: 4 additions & 1 deletion glutin-winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ wayland = ["glutin/wayland", "winit/wayland"]
[dependencies]
glutin = { version = "0.32.0", path = "../glutin", default-features = false }
raw-window-handle = "0.6"
winit = { version = "0.30.0", default-features = false, features = ["rwh_06"] }
# winit = { version = "0.30.0", default-features = false, features = ["rwh_06"] }
winit = { git = "https://github.com/richerfu/winit.git", branch = "feat-ohos-30", default-features = false, features = [
"rwh_06",
] }

[build-dependencies]
cfg_aliases = "0.2.1"
21 changes: 16 additions & 5 deletions glutin_examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,26 @@ glutin = { path = "../glutin", default-features = false }
glutin-winit = { path = "../glutin-winit", default-features = false }
png = { version = "0.17.6", optional = true }
raw-window-handle = "0.6"
winit = { version = "0.30.0", default-features = false, features = ["rwh_06"] }
# winit = { version = "0.30.0", default-features = false, features = ["rwh_06"] }
winit = { git = "https://github.com/richerfu/winit.git", branch = "feat-ohos-30", default-features = false, features = [
"rwh_06",
] }
drm = { version = "0.12", optional = true }

[target.'cfg(target_os = "android")'.dependencies]
winit = { version = "0.30.0", default-features = false, features = ["android-native-activity", "rwh_06"] }
# winit = { version = "0.30.0", default-features = false, features = ["android-native-activity", "rwh_06"] }
winit = { git = "https://github.com/richerfu/winit.git", branch = "feat-ohos-30", default-features = false, features = [
"rwh_06",
"android-native-activity"
] }

[target.'cfg(target_env = "ohos")'.dependencies]
openharmony_ability = { version = "0.0.1" }
openharmony_ability_derive = { version = "0.0.1" }
openharmony-ability = { version = "0.0.1" }
openharmony-ability-derive = { version = "0.0.1" }
winit = { git = "https://github.com/richerfu/winit.git", branch = "feat-ohos-30", default-features = false, features = [
"rwh_06",
] }
napi-ohos = {version = "1.0", features = ["napi8", "async"]}

[build-dependencies]
gl_generator = "0.14"
Expand All @@ -42,7 +53,7 @@ name = "android"
crate-type = ["cdylib"]

[[example]]
name = "ohos_test"
name = "ohos"
crate-type = ["cdylib"]

[[example]]
Expand Down
3 changes: 2 additions & 1 deletion glutin_examples/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ fn main() {
cfg_aliases! {
// Systems.
android_platform: { target_os = "android" },
ohos_platform: { target_env = "ohos" },
wasm_platform: { target_family = "wasm" },
macos_platform: { target_os = "macos" },
ios_platform: { target_os = "ios" },
apple: { any(ios_platform, macos_platform) },
free_unix: { all(unix, not(apple), not(android_platform)) },
free_unix: { all(unix, not(apple), not(android_platform), not(ohos_platform)) },

// Native displays.
x11_platform: { all(feature = "x11", free_unix, not(wasm_platform)) },
Expand Down
4 changes: 1 addition & 3 deletions glutin_examples/examples/ohos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ use openharmony_ability_derive::ability;
use winit::event_loop::EventLoop;
use winit::platform::ohos::EventLoopBuilderExtOpenHarmony;

mod app;

#[ability]
pub fn openharmony(openharmony_app: OpenHarmonyApp) {
let a = openharmony_app.clone();
let event_loop = EventLoop::builder().with_openharmony_app(a).build().unwrap();
app::main(event_loop).unwrap()
glutin_examples::main(event_loop).unwrap()
}
2 changes: 1 addition & 1 deletion glutin_examples/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use glutin::surface::{Surface, SwapInterval, WindowSurface};
use glutin_winit::{DisplayBuilder, GlWindow};

#[cfg(target_env = "ohos")]
use winit::platform::ohos::EventLoopBuilderExtOpenHarmony;
use winit::platform::ohos::EventLoopExtOpenHarmony;

pub mod gl {
#![allow(clippy::all)]
Expand Down

0 comments on commit 3bd7336

Please sign in to comment.