Skip to content

Commit a3c09cd

Browse files
committed
Use target_family = "wasm" instead of target_arch = "wasm32"
This allows using wasm64 as well.
1 parent 6eec0c6 commit a3c09cd

File tree

9 files changed

+17
-16
lines changed

9 files changed

+17
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Bump MSRV to Rust 1.71.
55
- Make `Context` cloneable.
66
- Added `Buffer::width()` and `Buffer::height()` getters.
7+
- Added support for `wasm64-*` targets.
78

89
# 0.4.6
910

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ objc2-quartz-core = { version = "0.3.2", default-features = false, features = [
110110
"CATransaction",
111111
] }
112112

113-
[target.'cfg(target_arch = "wasm32")'.dependencies]
113+
[target.'cfg(target_family = "wasm")'.dependencies]
114114
js-sys = "0.3.63"
115115
wasm-bindgen = "0.2.86"
116116

117-
[target.'cfg(target_arch = "wasm32")'.dependencies.web-sys]
117+
[target.'cfg(target_family = "wasm")'.dependencies.web-sys]
118118
version = "0.3.55"
119119
features = [
120120
"CanvasRenderingContext2d",
@@ -148,11 +148,11 @@ version = "0.25.0"
148148
default-features = false
149149
features = ["jpeg"]
150150

151-
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
151+
[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
152152
# Turn rayon back on everywhere else; creating the separate entry resets the features to default.
153153
rayon = "1.5.1"
154154

155-
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
155+
[target.'cfg(target_family = "wasm")'.dev-dependencies]
156156
wasm-bindgen-test = "0.3"
157157

158158
[target.'cfg(not(any(target_os = "android", target_vendor = "apple", target_os = "redox", target_family = "wasm", target_os = "windows")))'.dev-dependencies]

benches/buffer_mut.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
use criterion::{criterion_group, criterion_main, Criterion};
44

55
fn buffer_mut(c: &mut Criterion) {
6-
#[cfg(any(target_arch = "wasm32", target_arch = "wasm64"))]
6+
#[cfg(target_family = "wasm")]
77
{
88
// Do nothing.
99
let _ = c;
1010
}
1111

12-
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
12+
#[cfg(not(target_family = "wasm"))]
1313
{
1414
use criterion::black_box;
1515
use softbuffer::{Context, Surface};

examples/animation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[cfg(not(target_arch = "wasm32"))]
1+
#[cfg(not(target_family = "wasm"))]
22
use rayon::prelude::*;
33
use std::f64::consts::PI;
44
use std::num::NonZeroU32;
@@ -115,9 +115,9 @@ fn pre_render_frames(width: u32, height: u32) -> Vec<Vec<u32>> {
115115
.collect::<Vec<_>>()
116116
};
117117

118-
#[cfg(target_arch = "wasm32")]
118+
#[cfg(target_family = "wasm")]
119119
return (0..60).map(render).collect();
120120

121-
#[cfg(not(target_arch = "wasm32"))]
121+
#[cfg(not(target_family = "wasm"))]
122122
(0..60).into_par_iter().map(render).collect()
123123
}

examples/utils/winit_app.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ use winit::window::{Window, WindowAttributes, WindowId};
1010
/// Run a Winit application.
1111
#[allow(unused_mut)]
1212
pub(crate) fn run_app(event_loop: EventLoop<()>, mut app: impl ApplicationHandler<()> + 'static) {
13-
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
13+
#[cfg(not(target_family = "wasm"))]
1414
event_loop.run_app(&mut app).unwrap();
1515

16-
#[cfg(any(target_arch = "wasm32", target_arch = "wasm64"))]
16+
#[cfg(target_family = "wasm")]
1717
winit::platform::web::EventLoopExtWebSys::spawn_app(event_loop, app);
1818
}
1919

@@ -24,7 +24,7 @@ pub(crate) fn make_window(
2424
f: impl FnOnce(WindowAttributes) -> WindowAttributes,
2525
) -> Rc<Window> {
2626
let attributes = f(WindowAttributes::default());
27-
#[cfg(target_arch = "wasm32")]
27+
#[cfg(target_family = "wasm")]
2828
let attributes = winit::platform::web::WindowAttributesExtWebSys::with_append(attributes, true);
2929
let window = elwt.create_window(attributes);
3030
Rc::new(window.unwrap())

examples/winit_multithread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub mod ex {
6565
let app = winit_app::WinitAppBuilder::with_init(
6666
|elwt| {
6767
let attributes = Window::default_attributes();
68-
#[cfg(target_arch = "wasm32")]
68+
#[cfg(target_family = "wasm")]
6969
let attributes =
7070
winit::platform::web::WindowAttributesExtWebSys::with_append(attributes, true);
7171
let window = Arc::new(elwt.create_window(attributes).unwrap());

src/backend_dispatch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ make_dispatch! {
236236
Win32(D, backends::win32::Win32Impl<D, W>, backends::win32::BufferImpl<'a, D, W>),
237237
#[cfg(target_vendor = "apple")]
238238
CoreGraphics(D, backends::cg::CGImpl<D, W>, backends::cg::BufferImpl<'a, D, W>),
239-
#[cfg(target_arch = "wasm32")]
239+
#[cfg(target_family = "wasm")]
240240
Web(backends::web::WebDisplayImpl<D>, backends::web::WebImpl<D, W>, backends::web::BufferImpl<'a, D, W>),
241241
#[cfg(target_os = "redox")]
242242
Orbital(D, backends::orbital::OrbitalImpl<D, W>, backends::orbital::BufferImpl<'a, D, W>),

src/backends/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub(crate) mod orbital;
2929
))
3030
))]
3131
pub(crate) mod wayland;
32-
#[cfg(target_arch = "wasm32")]
32+
#[cfg(target_family = "wasm")]
3333
pub(crate) mod web;
3434
#[cfg(target_os = "windows")]
3535
pub(crate) mod win32;

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub use error::SoftBufferError;
2525

2626
use raw_window_handle::{HasDisplayHandle, HasWindowHandle, RawDisplayHandle, RawWindowHandle};
2727

28-
#[cfg(target_arch = "wasm32")]
28+
#[cfg(target_family = "wasm")]
2929
pub use backends::web::SurfaceExtWeb;
3030

3131
/// An instance of this struct contains the platform-specific data that must be managed in order to

0 commit comments

Comments
 (0)