@@ -434,34 +434,39 @@ jobs:
434434 shared_lib : libpolyglot_sql_ffi.so
435435 static_lib : libpolyglot_sql_ffi.a
436436 use_cross : false
437+ target_dir : target
437438 - os : ubuntu-latest
438439 target : aarch64-unknown-linux-gnu
439440 archive_name : linux-aarch64
440441 archive_ext : tar.gz
441442 shared_lib : libpolyglot_sql_ffi.so
442443 static_lib : libpolyglot_sql_ffi.a
443444 use_cross : true
445+ target_dir : target-cross
444446 - os : macos-15-intel
445447 target : x86_64-apple-darwin
446448 archive_name : macos-x86_64
447449 archive_ext : tar.gz
448450 shared_lib : libpolyglot_sql_ffi.dylib
449451 static_lib : libpolyglot_sql_ffi.a
450452 use_cross : false
453+ target_dir : target
451454 - os : macos-latest
452455 target : aarch64-apple-darwin
453456 archive_name : macos-aarch64
454457 archive_ext : tar.gz
455458 shared_lib : libpolyglot_sql_ffi.dylib
456459 static_lib : libpolyglot_sql_ffi.a
457460 use_cross : false
461+ target_dir : target
458462 - os : windows-latest
459463 target : x86_64-pc-windows-msvc
460464 archive_name : windows-x86_64
461465 archive_ext : zip
462466 shared_lib : polyglot_sql_ffi.dll
463467 static_lib : polyglot_sql_ffi.lib
464468 use_cross : false
469+ target_dir : target
465470 steps :
466471 - uses : actions/checkout@v4
467472
@@ -470,17 +475,22 @@ jobs:
470475 targets : ${{ matrix.target }}
471476
472477 - uses : Swatinem/rust-cache@v2
478+ if : ${{ !matrix.use_cross }}
473479
474480 - name : Install cross (linux aarch64)
475481 if : matrix.use_cross
476482 run : cargo install cross --git https://github.com/cross-rs/cross
477483
478484 - name : Build FFI artifacts with cross
479485 if : matrix.use_cross
486+ env :
487+ CARGO_TARGET_DIR : ${{ matrix.target_dir }}
480488 run : cross build -p polyglot-sql-ffi --profile ffi_release --target ${{ matrix.target }}
481489
482490 - name : Build FFI artifacts with cargo
483491 if : ${{ !matrix.use_cross }}
492+ env :
493+ CARGO_TARGET_DIR : ${{ matrix.target_dir }}
484494 run : cargo build -p polyglot-sql-ffi --profile ffi_release --target ${{ matrix.target }}
485495
486496 - name : Package archive (unix)
@@ -489,8 +499,8 @@ jobs:
489499 dir="polyglot-sql-ffi-${{ matrix.archive_name }}"
490500 mkdir -p "$dir"
491501 cp crates/polyglot-sql-ffi/polyglot_sql.h "$dir/"
492- cp "target /${{ matrix.target }}/ffi_release/${{ matrix.shared_lib }}" "$dir/"
493- cp "target /${{ matrix.target }}/ffi_release/${{ matrix.static_lib }}" "$dir/"
502+ cp "${{ matrix.target_dir }} /${{ matrix.target }}/ffi_release/${{ matrix.shared_lib }}" "$dir/"
503+ cp "${{ matrix.target_dir }} /${{ matrix.target }}/ffi_release/${{ matrix.static_lib }}" "$dir/"
494504 cp LICENSE "$dir/"
495505 tar -czf "${dir}.tar.gz" "$dir"
496506
@@ -501,8 +511,8 @@ jobs:
501511 $dir = "polyglot-sql-ffi-${{ matrix.archive_name }}"
502512 New-Item -ItemType Directory -Path $dir -Force | Out-Null
503513 Copy-Item "crates/polyglot-sql-ffi/polyglot_sql.h" "$dir/"
504- Copy-Item "target /${{ matrix.target }}/ffi_release/${{ matrix.shared_lib }}" "$dir/"
505- Copy-Item "target /${{ matrix.target }}/ffi_release/${{ matrix.static_lib }}" "$dir/"
514+ Copy-Item "${{ matrix.target_dir }} /${{ matrix.target }}/ffi_release/${{ matrix.shared_lib }}" "$dir/"
515+ Copy-Item "${{ matrix.target_dir }} /${{ matrix.target }}/ffi_release/${{ matrix.static_lib }}" "$dir/"
506516 Copy-Item "LICENSE" "$dir/"
507517 Compress-Archive -Path $dir -DestinationPath "$dir.zip" -Force
508518
0 commit comments