From 59f5ee9870337f2282e56dac3dacb618f21d5aab Mon Sep 17 00:00:00 2001 From: Sam Ansmink Date: Tue, 26 Mar 2024 09:28:02 +0100 Subject: [PATCH] try cross for cross compile --- .github/workflows/_extension_distribution.yml | 5 +++++ CMakeLists.txt | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/_extension_distribution.yml b/.github/workflows/_extension_distribution.yml index 51ae18a..1d3562e 100644 --- a/.github/workflows/_extension_distribution.yml +++ b/.github/workflows/_extension_distribution.yml @@ -145,6 +145,11 @@ jobs: with: targets: aarch64-unknown-linux-gnu + - name: Setup Rust for cross compile + if: ${{ matrix.duckdb_arch == 'linux_arm64'}} + run: | + cargo install cross --git https://github.com/cross-rs/cross + - name: Setup Rust for manylinux (dtolnay/rust-toolchain doesn't work due to curl being old here) if: ${{ matrix.duckdb_arch == 'linux_amd64_gcc4' }} run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 699e47d..086259e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,13 +60,22 @@ elseif("${OS_NAME}" STREQUAL "osx") endif() endif() +if("${USE_RUST_CROSS}") + set(RUST_COMMAND "cargo") +else() + set(RUST_COMMAND "cross") +endif() + +# OVerride TODO remove +set(RUST_COMMAND "cross") + # Add rust_example as a CMake target ExternalProject_Add( ${KERNEL_NAME} DOWNLOAD_COMMAND "" CONFIGURE_COMMAND "" - BUILD_COMMAND cargo build --package deltakernel-ffi --all-features --target=${RUST_PLATFORM_TARGET} - COMMAND cargo build --package deltakernel-ffi --all-features --release --target=${RUST_PLATFORM_TARGET} + BUILD_COMMAND ${RUST_COMMAND} build --package deltakernel-ffi --all-features --target=${RUST_PLATFORM_TARGET} + COMMAND ${RUST_COMMAND} build --package deltakernel-ffi --all-features --release --target=${RUST_PLATFORM_TARGET} BINARY_DIR "${CMAKE_SOURCE_DIR}/../delta-kernel-rs" BUILD_BYPRODUCTS "${CMAKE_SOURCE_DIR}/../delta-kernel-rs/target/${RUST_PLATFORM_TARGET}/debug/libdeltakernel_ffi.a" BUILD_BYPRODUCTS "${CMAKE_SOURCE_DIR}/../delta-kernel-rs/target/${RUST_PLATFORM_TARGET}/release/libdeltakernel_ffi.a"