diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8a89137dae..19755caef5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -229,6 +229,11 @@ jobs: key: gradle-${{ runner.os }}+${{ matrix.cross_os }}-${{ matrix.qt }} if: matrix.cross_os == 'Android' + - name: Install Android Rust target + run: > + rustup target add aarch64-linux-android + if: matrix.cross_os == 'Android' + - name: Generate project run: > cmake -S . -B build --log-level=VERBOSE diff --git a/cmake/Cargo.cmake b/cmake/Cargo.cmake index 928f7aed58..5785484d42 100644 --- a/cmake/Cargo.cmake +++ b/cmake/Cargo.cmake @@ -23,6 +23,7 @@ function(_corrosion_determine_libs_new target_triple out_libs) list(APPEND args --target=${target_triple}) endif() list(APPEND args -- --print=native-static-libs) + message(STATUS "Checking native libraries with command: ${CARGO_COMMAND} ${args}") execute_process( COMMAND ${CARGO_COMMAND} ${args} WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/corrosion/required_libs" @@ -59,7 +60,7 @@ endfunction() # SPDX-SnippetEnd function(_cargo_set_libs target triple) - if(NOT "${triple}") + if("${triple}") set(cache_var "CARGO_LIBS_${triple}") else() set(cache_var "CARGO_LIBS_HOST") @@ -99,6 +100,8 @@ function(add_cargo_library target package) else() set(arch i686) endif() + else() + message(WARNING "Unknown Cargo arch for processor '${CMAKE_SYSTEM_PROCESSOR}'") endif() if(WIN32) @@ -108,16 +111,21 @@ function(add_cargo_library target package) elseif(MINGW) set(abi gnu) endif() + elseif(ANDROID) + set(sys linux) + set(abi android) elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin) set(sys apple) set(abi darwin) elseif(CMAKE_SYSTEM_NAME STREQUAL Linux) set(sys unknown-linux) set(abi gnu) + else() + message(WARNING "Unknown Cargo sys and abi for system '${CMAKE_SYSTEM_NAME}'") endif() if(NOT arch OR NOT sys OR NOT abi) - message(WARNING "Unable to determine target ABI for Cargo; using host ABI") + message(SEND_ERROR "Unable to determine target ABI for Cargo") else() set(triple ${arch}-${sys}-${abi}) message(STATUS "Cargo target ABI: ${triple}")