Coder Social home page Coder Social logo

Comments (3)

vgorloff avatar vgorloff commented on June 8, 2024

The folder layout, shown below, with the target build subfolder x86_64-apple-macosx is produced by "Swift Package Manager" (https://github.com/apple/swift-package-manager).

At the moment "Swift Package Manager" officially not supporting Android targets. Thats why subfolder name is x86_64-apple-macosx.

Maybe later we will also provide embedded "Swift Package Manager" which will produce directory structure with appropriate Android target names.

├── .build
│   └── x86_64-apple-macosx

from swift-everywhere-toolchain.

Guang1234567 avatar Guang1234567 commented on June 8, 2024

@vgorloff

Thanks your reply.

I find the other solution without provide embedded spm accidentally.

https://github.com/readdle/swift-android-buildtools/blob/4c13ae4768606992ab6e83f2415d8f3d39e1b362/src/bash/swift-build.sh#L54

$SWIFT_ANDROID_HOME/toolchain/usr/bin/swift-build --destination=<($SELF_DIR/generate-destination-json.sh) $flags "$@"

Just pass —destination to spm, and the generate-destination-json.sh should be like below:

#!/bin/bash
: "${SWIFT_ANDROID_HOME:?$SWIFT_ANDROID_HOME should be set}"
: "${ANDROID_NDK_HOME:?$ANDROID_NDK_HOME should be set}"

EXTERNAL_TOOLCHAIN="$ANDROID_NDK_HOME/toolchains/$TOOLCHAIN_ROOT-4.9/prebuilt/darwin-x86_64"

cat <<JSON
{
    "version": 1,
    "dynamic-library-extension": "so",
    "target": "$TARGET",
    
    #  …….
}
JSON

"target": "$TARGET" is the point. And the $TARGET is a env var.

export TARGET = x86_64-unknown-linux-android
export TARGET = aarch64-unknown-linux-android
export TARGET = armv7-none-linux-androideabi

from swift-everywhere-toolchain.

Guang1234567 avatar Guang1234567 commented on June 8, 2024

In addition, swift-everywhere-toolchain can be wrapped by readdle/swift-android-gradle and readdle/swift-android-toolchain.

But readdle/swift-android-toolchain is 5.0-r9, so i use swift-everywhere-toolchain to instead it today and success.

from swift-everywhere-toolchain.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.