Update README.md with instructions for linking libz and libc++ for an SPM target

This commit is contained in:
Steven Sherry 2020-07-15 01:09:36 -05:00
parent eb3c7e2e87
commit 0b1403e40d
No known key found for this signature in database
GPG Key ID: 5BE85414B74F99B1
1 changed files with 17 additions and 3 deletions

View File

@ -14,8 +14,9 @@ import PackageDescription
let package = Package(
name: "AwesomePackage",
platforms: [
.macOS(.v10_15),
.iOS(.v13),
// These are the minimum versions libtesseract supports
.macOS(.v10_13),
.iOS(.v11),
],
products: [
.library(
@ -29,7 +30,8 @@ let package = Package(
targets: [
.target(
name: "AwesomePackage",
dependencies: ["libtesseract"]
dependencies: ["libtesseract"],
linkerSettings: [.linkedLibrary("z"), .linkedLibrary("c++")]
),
]
)
@ -45,6 +47,18 @@ You must link against the following libraries:
This can be done in an Xcode-based project by adding these in Build Phases -> Link Binary with Libaries
![screenshot of xcode linking libc++ and libz](link_libraries.png)
In a Swift Package Manager project, this can be achieved by adding the following to your target `linkerSettings`:
```swift
// See Package.swift example above for full context
targets: [
.target(
name: "AwesomePackage",
dependencies: ["libtesseract"],
linkerSettings: [.linkedLibrary("z"), .linkedLibrary("c++")]
),
]
```
See SwiftyTesseract's [Additonal Configuration](https://github.com/SwiftyTesseract/SwiftyTesseract#additional-configuration) notes on considerations for including language training data files.
## Build dependencies