Crates.io | cargo-xcode-build-rs |
lib.rs | cargo-xcode-build-rs |
version | 0.2.3 |
source | src |
created_at | 2024-06-24 02:23:18.582629 |
updated_at | 2024-06-27 01:09:00.990877 |
description | Build script for XCode when compiling rust for iOS |
homepage | https://github.com/ActuallyHappening/YMap/tree/master/crates/cargo_xcode_build_rs |
repository | https://github.com/ActuallyHappening/YMap |
max_upload_size | |
id | 1281687 |
size | 90,343 |
A 100% Rust wrapper around the iOS XCode build script found in the bevy
examples.
Benefits of using a Rust script over a sh
ell script (or nu
shell):
crates.io
sudo xcode-select --install
and that suggestion can be added to the error message for everyone to benefit fromcc
compiler is on $PATH
set -exu
)cargo install cargo-xcode-build-rs
This is how I used it in my XCode project, which was copied from the bevy
mobile example:
https://github.com/ActuallyHappening/YMap/blob/master/crates/cargo_xcode_build_rs/docs/xcode-usage.png
Use cargo xcode-build-rs --manifest-dir . xcode
in the actual xcode script.
Use cargo xcode-build-rs --manifest-dir . --colour test
to begin a test iOS simulator build, which shouldn't be necessary normally.
To compiles projects for iOS with special Cargo features enabled, add a package.metadata.xcode-build-rs
section to your Cargo.toml
file. For example:
[package.metadata.xcode-build-rs.ios]
## As an example, when set to true enabled default features
## which is already the default.
## Set to false to disable default features
## See Cargo's docs: https://doc.rust-lang.org/cargo/reference/features.html#dependency-features
default-features = true
## What features to enable
features = ["ios"]
## Extra flags to pass to `cargo rustc`
extra_flags = ["--cfg", "winit_ignore_noise_logs_unstable"]
cargo xcode-build-rs --help
Build script for XCode when compiling rust for iOS
Usage: cargo xcode-build-rs [OPTIONS] --manifest-dir <MANIFEST_DIR> <COMMAND>
Commands:
xcode Run in XCode
test Run a test build for an iOS simulator
help Print this message or the help of the given subcommand(s)
Options:
--colour By default, doesn't display colour because this can be annoying in the XCode terminal
--manifest-dir <MANIFEST_DIR> The --manifest-path option to pass to `cargo rustc builds`. Often you can pass `.`
-h, --help Print help
-V, --version Print version
Based on the bevy mobile example script build_rust_deps.sh
here.
That script is also based on the mozilla script here
git clone https://github.com/ActuallyHappening/YMap.git
cd crates/xcode_build_rs
cargo is
to install this locally on your system.
cargo rt
to run the CLI in test mode locally on your system.