diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef31087484..744276fb0a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -156,10 +156,14 @@ jobs: - name: check web if: matrix.kind == 'web' run: | - cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu + # build examples + cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu --examples - # Build for WebGL - cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu --features webgl -- -D warnings + # build with features + cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu --features glsl,spirv + + # build for WebGL + cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu --features webgl # build docs cargo doc --target ${{ matrix.target }} -p wgpu --no-deps diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index dc14b5a813..b83be4abbb 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -85,6 +85,8 @@ git = "https://github.com/gfx-rs/naga" rev = "09d35f3" #version = "0.8" +# DEV dependencies + [dev-dependencies.naga] git = "https://github.com/gfx-rs/naga" rev = "09d35f3" @@ -94,4 +96,6 @@ features = ["wgsl-in"] [dev-dependencies] env_logger = "0.8" winit = "0.26" # for "halmark" example + +[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] glutin = "0.28" # for "gles" example diff --git a/wgpu-hal/examples/raw-gles.rs b/wgpu-hal/examples/raw-gles.rs index 65dadbc79f..23cb6df431 100644 --- a/wgpu-hal/examples/raw-gles.rs +++ b/wgpu-hal/examples/raw-gles.rs @@ -2,9 +2,14 @@ //! the ability to hook up wgpu-hal to an existing context and draw into it. extern crate wgpu_hal as hal; -use hal::{Adapter as _, CommandEncoder as _, Device as _, Queue as _}; +#[cfg(target_arch = "wasm32")] +fn main() {} + +#[cfg(not(target_arch = "wasm32"))] fn main() { + use hal::{Adapter as _, CommandEncoder as _, Device as _, Queue as _}; + env_logger::init(); println!("Initializing external GL context"); diff --git a/wgpu-info/src/main.rs b/wgpu-info/src/main.rs index 349eecc27d..769fdfe753 100644 --- a/wgpu-info/src/main.rs +++ b/wgpu-info/src/main.rs @@ -104,9 +104,12 @@ fn print_info_from_adapter(adapter: &wgpu::Adapter, idx: usize) { } } +#[cfg(target_arch = "wasm32")] +fn main() {} + +#[cfg(not(target_arch = "wasm32"))] fn main() { env_logger::init(); - let args: Vec<_> = std::env::args().skip(1).collect(); let instance = wgpu::Instance::new(wgpu::Backends::all()); diff --git a/wgpu/examples/hello-windows/main.rs b/wgpu/examples/hello-windows/main.rs index 6cef470275..d25c6d12a6 100644 --- a/wgpu/examples/hello-windows/main.rs +++ b/wgpu/examples/hello-windows/main.rs @@ -1,3 +1,5 @@ +#![cfg_attr(target_arch = "wasm32", allow(dead_code))] + use std::collections::HashMap; use winit::{ event::{Event, WindowEvent},