First, follow the instructions on the Usage
cargo-xcode. The instructions that follow are quoted from there, but keep in mind
that it might have become outdated.
Ensure that these lines are present in your
[lib] crate-type = ["lib", "staticlib", "cdylib"]
libis required for non-library targets, such as tests and benchmarks
staticlibis required for iOS
cdylibfor all other platforms
Configure this to suit your needs. Then run this command in
This will generate a
$crate/$crate.xcodeproj that can be imported into other Xcode projects.
You only have to do this once per crate.
Now, open up that
$crate/$crate.xcodeproj file with Xcode and select the root item at the left pane. The item's name will be identical to your crate's name. In the Build Settings tab, search for
Dynamic Library Install Name Base and change the value into
@executable_path/../Frameworks/. This is required by cargo-xcode to enable macOS executable to properly locate
.dylib library files in the package.