|
8 | 8 | - '*.mkd'
|
9 | 9 | - 'LICENSE'
|
10 | 10 | pull_request:
|
11 |
| - types: [opened, repoened, synchronize] |
| 11 | + types: [opened, reopened, synchronize] |
12 | 12 |
|
13 | 13 | jobs:
|
14 | 14 | native-test:
|
@@ -257,6 +257,60 @@ jobs:
|
257 | 257 | command: build
|
258 | 258 | args: --target=${{ matrix.rust_target }} --manifest-path=${{ matrix.manifest }}
|
259 | 259 |
|
| 260 | + cross-windows-build: |
| 261 | + name: Cross-compile ${{ matrix.manifest }} for ${{ matrix.rust_target }} from x86_64-unknown-linux-gnu |
| 262 | + runs-on: ubuntu-20.04 |
| 263 | + strategy: |
| 264 | + fail-fast: true |
| 265 | + matrix: |
| 266 | + rust_target: |
| 267 | + - x86_64-pc-windows-msvc |
| 268 | + - i686-pc-windows-msvc |
| 269 | + manifest: ['psm/Cargo.toml', 'Cargo.toml'] |
| 270 | + xwin_version: ["0.1.6"] |
| 271 | + timeout-minutes: 10 |
| 272 | + steps: |
| 273 | + - uses: actions/checkout@v2 |
| 274 | + - name: Install Rust |
| 275 | + uses: actions-rs/toolchain@v1 |
| 276 | + with: |
| 277 | + toolchain: stable |
| 278 | + profile: minimal |
| 279 | + target: ${{ matrix.rust_target }} |
| 280 | + - name: Add toolchain shims |
| 281 | + run: | |
| 282 | + set -eux |
| 283 | + sudo ln -s clang-12 /usr/bin/clang-cl |
| 284 | + sudo ln -s llvm-ar-12 /usr/bin/llvm-lib |
| 285 | + sudo ln -s lld-link-12 /usr/bin/lld-link |
| 286 | + - name: Install Windows SDK |
| 287 | + run: | |
| 288 | + set -eux |
| 289 | + xwin_version=${{ matrix.xwin_version }} |
| 290 | + xwin_prefix="xwin-$xwin_version-x86_64-unknown-linux-musl" |
| 291 | +
|
| 292 | + # Install xwin to cargo/bin via github release. Note you could also just use `cargo install xwin`. |
| 293 | + curl --fail -L https://github.com/Jake-Shadle/xwin/releases/download/$xwin_version/$xwin_prefix.tar.gz | tar -xzv -C /home/runner/.cargo/bin --strip-components=1 $xwin_prefix/xwin |
| 294 | +
|
| 295 | + # Splat the CRT and SDK files to /tmp/xwin/crt and /tmp/xwin/sdk respectively |
| 296 | + xwin --accept-license 1 splat --output /tmp/xwin |
| 297 | + - name: Test |
| 298 | + env: |
| 299 | + CC: "clang-cl" |
| 300 | + CXX: "clang-cl" |
| 301 | + AR: "llvm-lib" |
| 302 | + CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER: "lld-link" |
| 303 | + CARGO_TARGET_I686_PC_WINDOWS_MSVC_LINKER: "lld-link" |
| 304 | + # Note that we only disable unused-command-line-argument here since clang-cl |
| 305 | + # doesn't implement all of the options supported by cl, but the ones it doesn't |
| 306 | + # are _generally_ not interesting. |
| 307 | + CFLAGS: "-Wno-unused-command-line-argument -fuse-ld=lld-link /imsvc/tmp/xwin/crt/include /imsvc/tmp/xwin/sdk/include/ucrt /imsvc/tmp/xwin/sdk/include/um /imsvc/tmp/xwin/sdk/include/shared" |
| 308 | + # Inform the linker where to search for libraries |
| 309 | + RUSTFLAGS: "-Lnative=/tmp/xwin/crt/lib/x86_64 -Lnative=/tmp/xwin/sdk/lib/um/x86_64 -Lnative=/tmp/xwin/sdk/lib/ucrt/x86_64" |
| 310 | + run: | |
| 311 | + set -eux |
| 312 | + cargo build --target ${{ matrix.rust_target }} --manifest-path ${{ matrix.manifest }} |
| 313 | +
|
260 | 314 | wasm-test:
|
261 | 315 | name: Test stacker on WASM
|
262 | 316 | runs-on: ubuntu-latest
|
|
0 commit comments