⚠️ WARNING
This is work in progress and is not ready for use
Cargo plugin for building XCFrameworks
cargo xcframework
with parameters that are almost the same as for cargo build
Cargo.toml
section [package.metadata.xcframework]
Install:
cargo install xcframework
If you for any reason needs the bleeding-edge super fresh version:
cargo install --git https://github.com/human-solutions/xcframework
Help:
cargo xcframework --help
For setting up your project, have a look at the examples
The built XCFramework is named after the top-level module name declared in the module.modulemap
file in the include-dir
directory.
A typical such file looks like this:
cpp
// The XCFramework will be named 'MyModuleName.xcframework'
module MyModuleName {
// a header file in the same directory as the modulemap
header "mylib.h"
export *
}
Cargo.toml parameters in section [package.metadata.xcframework]
.
```toml
module.modulemap
file and the headers are located.#
include-dir = "my-bin-name"
#
crate-type
parameter. Overridden by the command line parameter --lib-type
.lib-type = "staticlib"
#
zip = true
cargo +nightly xcframework
, set the default toolchain to nightlyrustup override set nightly
in the project directory.#
build-std = false
#
macOS = false
#
macOS-targets = ["x86_64-apple-darwin", "aarch64-apple-darwin"]
#
simulators = false
#
iOS = false
#
iOS-targets = ["aarch64-apple-ios"]
simulators
and iOS
are true.#
iOS-simulator-targets = ["aarch64-apple-ios-sim", "x86_64-apple-ios"]
```
The iOS and macOS versions targeted can be set with the environment variables:
MACOSX_DEPLOYMENT_TARGET
and IPHONEOS_DEPLOYMENT_TARGET
. See apple_base.rs for the default values.