diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c419d7b4bf..a8b5b85653 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,10 +11,16 @@ env: jobs: test: - runs-on: windows-latest + runs-on: ${{ matrix.os }} strategy: - matrix: - rust: [stable] + matrix: + include: + - os: windows-latest + rust: stable + other: x86_64-pc-windows-msvc + - os: ubuntu-latest + rust: stable + other: i686-unknown-linux-gnu steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 @@ -24,9 +30,14 @@ jobs: override: true components: rustfmt - - name: tests + - name: build + run: cargo build + if: matrix.os == 'ubuntu-latest' + + - name: test run: cargo test --all + if: matrix.os == 'windows-latest' - name: fmt run: cargo fmt --all -- --check - if: matrix.rust == 'stable' + if: matrix.os == 'windows-latest' diff --git a/crates/gen/src/types/function.rs b/crates/gen/src/types/function.rs index 8b0074036d..9705ce2b63 100644 --- a/crates/gen/src/types/function.rs +++ b/crates/gen/src/types/function.rs @@ -50,13 +50,21 @@ impl Function { link = "onecoreuap"; } - quote! { - pub unsafe fn #name<#constraints>(#params) #return_type { - #[link(name = #link)] - extern "system" { - pub fn #name(#(#abi_params),*) #abi_return_type; + if cfg!(windows) { + quote! { + pub unsafe fn #name<#constraints>(#params) #return_type { + #[link(name = #link)] + extern "system" { + pub fn #name(#(#abi_params),*) #abi_return_type; + } + #name(#(#args),*) + } + } + } else { + quote! { + pub unsafe fn #name<#constraints>(#params) #return_type { + panic!("Unsupported target OS"); } - #name(#(#args),*) } } }