Viewing is open to everyone. Downloading and starring need a GitHub sign-in. Sign in with GitHub

Package.swift

v0.1.0-build.85 Latest Commit ede38f5

Size
3.8 KB
Lines
71
Language
swift
SHA-256
a83646063049…
View on GitHub

Sign in with GitHub to download. Each download is recorded with your GitHub username.

1// swift-tools-version:5.9
2//
3// CKey for Swift (iOS 15+, macOS 12+). Add this repository's URL in Xcode
4// (File > Add Package Dependencies...) or in Package.swift:
5//
6// .package(url: "https://github.com/clearkeysolutions/ckey", from: "0.1.0")
7//
8// The manifest lives at the repository root because SwiftPM installs a
9// package from the root of a Git repository. The Swift code is in sdk/swift;
10// see sdk/swift/README.md.
11//
12// Products
13// CKey encode, render (CGImage/PNG/SVG/PDF), SwiftUI/UIKit/AppKit
14// views, scanning, payload classification and the optional
15// aggregate telemetry (default mode 1; `CKey.telemetry = .off`).
16// CKeyScanner scan-only: decoder, camera helper and payload classification.
17// No renderer, no telemetry: nothing of either is compiled
18// into an app that links only this product.
19//
20// The C++ core is compiled in place from src/ (nothing is copied). SwiftPM
21// requires every source of a target to live under that target's directory
22// and forbids targets whose directories overlap, so each C++ target is a
23// small directory under sdk/swift/Sources/<Target>/ holding a one-line .cpp
24// that #includes the matching repository translation unit by a path relative
25// to itself (src/ckey_codec.cpp and so on), exactly as CMake builds them.
26// CKeyCodec's public include directory carries a module map that exposes the
27// repository's include/ckey/ckey.h to Swift, plus a forwarding ckey/ckey.h
28// so the core's own `#include "ckey/ckey.h"` resolves without any
29// header-search flags (and without unsafeFlags, which SwiftPM refuses in
30// dependencies). CKeyTelemetry does the same for include/ckey/telemetry.h.
31// The other C++ targets have no headers of their own, but SwiftPM requires
32// their include/ directory to exist, so each keeps one with a .gitkeep.
33import PackageDescription
34
35let package = Package(
36 name: "CKey",
37 platforms: [.iOS(.v15), .macOS(.v12)],
38 products: [
39 .library(name: "CKey", targets: ["CKey"]),
40 .library(name: "CKeyScanner", targets: ["CKeyScanKit"]),
41 ],
42 targets: [
43 // C++ core libraries (src/README.md). ckey.h is owned by CKeyCodec.
44 .target(name: "CKeyCodec", path: "sdk/swift/Sources/CKeyCodec",
45 linkerSettings: [.linkedLibrary("c++")]),
46 .target(name: "CKeyScan", dependencies: ["CKeyCodec"], path: "sdk/swift/Sources/CKeyScan",
47 linkerSettings: [.linkedLibrary("c++")]),
48 .target(name: "CKeyRender", dependencies: ["CKeyCodec"], path: "sdk/swift/Sources/CKeyRender",
49 linkerSettings: [.linkedLibrary("c++")]),
50 .target(name: "CKeyCertify", dependencies: ["CKeyScan", "CKeyRender"], path: "sdk/swift/Sources/CKeyCertify",
51 linkerSettings: [.linkedLibrary("c++")]),
52 // Optional telemetry core. It depends on CKeyCodec only for the
53 // ckey.h declarations it includes (CKEY_API, ckey_status).
54 .target(name: "CKeyTelemetry", dependencies: ["CKeyCodec"], path: "sdk/swift/Sources/CKeyTelemetry",
55 linkerSettings: [.linkedLibrary("c++")]),
56
57 // Swift API.
58 .target(name: "CKeyScanKit", dependencies: ["CKeyCodec", "CKeyScan"],
59 path: "sdk/swift/Sources/CKeyScanKit"),
60 .target(name: "CKey",
61 dependencies: ["CKeyScanKit", "CKeyCodec", "CKeyRender", "CKeyCertify", "CKeyTelemetry"],
62 path: "sdk/swift/Sources/CKey",
63 resources: [.copy("PrivacyInfo.xcprivacy")]),
64
65 .testTarget(name: "CKeyScanKitTests", dependencies: ["CKeyScanKit"],
66 path: "sdk/swift/Tests/CKeyScanKitTests"),
67 .testTarget(name: "CKeyTests", dependencies: ["CKey"],
68 path: "sdk/swift/Tests/CKeyTests"),
69 ],
70 cxxLanguageStandard: .cxx20
71)