Skip to content

Commit

Permalink
WIP: Android please
Browse files Browse the repository at this point in the history
  • Loading branch information
askmeaboutlo0m committed Sep 3, 2023
1 parent 24bcafb commit a05add1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmake/Cargo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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}")
Expand Down

0 comments on commit a05add1

Please sign in to comment.