All Projects → TimNN → Cargo Lipo

TimNN / Cargo Lipo

Licence: other
Cargo subcommand to automatically create universal libraries for iOS.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Cargo Lipo

Corrosion
Marrying Rust and CMake - Easy Rust and C/C++ Integration!
Stars: ✭ 106 (-63.45%)
Mutual labels:  build-tool, cargo
Cargo Make
Rust task runner and build tool.
Stars: ✭ 895 (+208.62%)
Mutual labels:  build-tool, cargo
spring-boot-project-builder
快速构建Spring Boot项目
Stars: ✭ 20 (-93.1%)
Mutual labels:  build-tool
Cargo
📦 GitHub Action for Rust `cargo` command
Stars: ✭ 267 (-7.93%)
Mutual labels:  cargo
teapot
Teapot is a tool for managing complex cross-platform builds.
Stars: ✭ 56 (-80.69%)
Mutual labels:  build-tool
broom
A disk cleaning utility for developers.
Stars: ✭ 38 (-86.9%)
Mutual labels:  cargo
blackjack
Build cargo dependencies with Bazel
Stars: ✭ 34 (-88.28%)
Mutual labels:  cargo
grunt-retire
Grunt plugin for retire.
Stars: ✭ 89 (-69.31%)
Mutual labels:  build-tool
Haskell.nix
Alternative Haskell Infrastructure for Nixpkgs
Stars: ✭ 283 (-2.41%)
Mutual labels:  build-tool
makesure
Simple task/command runner with declarative goals and dependencies
Stars: ✭ 230 (-20.69%)
Mutual labels:  build-tool
Bazel Remote
A remote cache for Bazel
Stars: ✭ 260 (-10.34%)
Mutual labels:  build-tool
cargo-wix
A cargo subcommand to build Windows installers for rust projects using the WiX Toolset
Stars: ✭ 142 (-51.03%)
Mutual labels:  cargo
rustsec
Audit Cargo.lock files for dependencies with security vulnerabilities
Stars: ✭ 956 (+229.66%)
Mutual labels:  cargo
example-bazel-monorepo
🌿💚 Example Bazel-ified monorepo, supporting Golang, Java, Python, Scala, and Typescript
Stars: ✭ 213 (-26.55%)
Mutual labels:  build-tool
crm
Cargo registry manager (Cargo 注册表管理器),用于方便的管理和更换 Rust 国内镜像源
Stars: ✭ 103 (-64.48%)
Mutual labels:  cargo
Dependencycheck
OWASP dependency-check is a software composition analysis utility that detects publicly disclosed vulnerabilities in application dependencies.
Stars: ✭ 3,571 (+1131.38%)
Mutual labels:  build-tool
BuildMonkey
Build artefacts for creating a Eclipse RCP application with gradle
Stars: ✭ 11 (-96.21%)
Mutual labels:  build-tool
modular-styles
Extract CSS into CSS Modules for any language!
Stars: ✭ 25 (-91.38%)
Mutual labels:  build-tool
pack
📦 Packs the assets for your web server.
Stars: ✭ 18 (-93.79%)
Mutual labels:  build-tool
Cargo Instruments
A cargo plugin to generate Xcode Instruments trace files
Stars: ✭ 284 (-2.07%)
Mutual labels:  cargo

cargo lipo Build Status Crates.io

Provides a cargo lipo subcommand which automatically creates a universal library for use with your iOS application.

Maintenance Status

Please consider this project deprecated / passively maintained. This is partly because I am not currently working on any iOS projects, and partly because I believe that there exists a better alternative to using lipo:

One can use architecture (and OS) specific environment variables in Xcode. The OS specific part could be configured in the Xcode project editor last time I tried, but the architecture specific part needed to be added by manually editing the project.pbxproj file, for example like this:

    "LIBRARY_SEARCH_PATHS[sdk=iphoneos*]" = ../path/to/target/debug/<...>;
    "LIBRARY_SEARCH_PATHS[sdk=macosx11.1][arch=arm64]" = ../path/to/target/<...>;
    "LIBRARY_SEARCH_PATHS[sdk=macosx11.1][arch=x86_64]" = ../path/to/target/<...>;

Thus, I believe that a future iOS support crate should offer primarily two features:

  • Something similar to the current --xcode-integ flag.
  • Something which can do the project.pbxproj editing.

Usage

From anywhere you would usually run cargo you can now run cargo lipo or cargo lipo --release to create a universal library for ios, which can be found in $target/universal/{release|debug}/$lib_name.a.

Make sure you have a library target in your Cargo.toml with a crate type of staticlib:

[lib]
name = "..."
crate-type = ["staticlib"]

Xcode Integration

cargo-lipo easily integrates with Xcode. Although note that this functionality has only been added recently and may not yet be perfect (the Xcode build process is somewhat of a blackbox to me).

  1. In your "Build Settings" change "Enable Bitcode" to No.

  2. Add a new "Run Script" phase to your "Build Phases". Place it before "Compile Sources". Add something like the following to the script:

    # The $PATH used by Xcode likely won't contain Cargo, fix that.
    # This assumes a default `rustup` setup.
    export PATH="$HOME/.cargo/bin:$PATH"
    
    # --xcode-integ determines --release and --targets from Xcode's env vars.
    # Depending your setup, specify the rustup toolchain explicitly.
    cargo lipo --xcode-integ --manifest-path ../something/Cargo.toml
    
  3. Build the project once, then update the "Link Binary with Libraries" phase: Click the +, then choose "Add Other...". Navigate to your-cargo-project/target/universal/{debug-or-release} and select your library(s).

  4. Go back to your "Build Settings" and add "Library Search Paths" for "Debug" and "Release", pointing to your-cargo-project/target/universal/{debug-or-release}.

Installation

Install cargo lipo with cargo install cargo-lipo. cargo lipo should always be buildable with the latest stable Rust version. For the minimum supported version check .travis.yml.

You also need a rust compiler which can compile for the iOS targets. If you use rustup all you should have to do is

# 64 bit targets (real device & simulator):
rustup target add aarch64-apple-ios x86_64-apple-ios
# 32 bit targets (you probably don't need these):
rustup target add armv7-apple-ios i386-apple-ios

Troubleshooting

Cargo fails with error: can't find crate for `std`: Your rust compiler most likely does not support cross-compiling to iOS.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].