Skip to content

Commit c3f701c

Browse files
committed
Fix x86_64-pc-windows-gnu cross compilation
1 parent 7ca378b commit c3f701c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
- mips64-unknown-linux-gnuabi64
1414
- x86_64-apple-darwin
1515
- aarch64-apple-darwin
16+
- x86_64-pc-windows-gnu
1617
- x86_64-pc-windows-msvc
1718
include:
1819
- target: x86_64-unknown-linux-gnu
@@ -25,6 +26,8 @@ jobs:
2526
os: macos-latest
2627
- target: aarch64-apple-darwin
2728
os: macos-latest
29+
- target: x86_64-pc-windows-gnu
30+
os: ubuntu-22.04
2831
- target: x86_64-pc-windows-msvc
2932
os: windows-latest
3033
steps:
@@ -46,6 +49,12 @@ jobs:
4649
sudo apt-get update -y
4750
sudo apt-get install -y --no-install-recommends gcc-mips64-linux-gnuabi64 libc6-dev-mips64-cross
4851
shell: bash
52+
- name: Install GCC (x86_64-pc-windows-gnu)
53+
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
54+
run: |
55+
sudo apt-get update -y
56+
sudo apt-get install -y --no-install-recommends gcc-mingw-w64-x86-64
57+
shell: bash
4958
- name: Build for ${{ matrix.target }}
5059
run: |
5160
cargo build --manifest-path testcrate/Cargo.toml --target ${{ matrix.target }} --release

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ impl Build {
106106
"aarch64-apple-darwin" => {
107107
make.env("MACOSX_DEPLOYMENT_TARGET", "11.0");
108108
}
109+
_ if target.contains("linux") => {
110+
make.env("TARGET_SYS", "Linux");
111+
}
112+
_ if target.contains("windows") => {
113+
make.env("TARGET_SYS", "Windows");
114+
}
109115
_ => {}
110116
}
111117

0 commit comments

Comments
 (0)