mirror of
https://github.com/D-Modem/app.git
synced 2026-11-28 17:38:05 -08:00
ios/DModemKit (Swift package): the engine (dmodem_engine.h) from Swift
(Engine: its config, its callbacks to a listener), its DTE (read on a
thread of its own, written), the settings (ModemSettings, as the Android
app's: the SIP account or the Wi-Fi peer line, user:password@host, kept in
UserDefaults, read leniently), ConnectInfo ("V.cvm · LAPM"), and
ModemSession (started from the settings: status, log, console, the DTE's
data, the speaker) for the views to watch. On Apple's systems the engine
is the XCFramework; on Linux the host build's libraries
(DMODEM_HOST_BUILD), so its tests run there: a session on a peer line
answering AT commands, a dial handed to the app and turned down busy.
shared: TerminalEmulator.runs(), a screen row as styled runs with their
colours resolved as TerminalView has them (the remote's palette, bold as
bright, iCE colours, inverse, faint), for a view that draws text (the iOS
app's); tested on the JVM and natively.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
40 lines
1.6 KiB
Swift
40 lines
1.6 KiB
Swift
// swift-tools-version:5.9
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
// Copyright (C) 2026 Neo-Desktop
|
|
//
|
|
// DModemKit: the iOS app's modem, apart from its views: the engine
|
|
// (dmodem_engine.h) from Swift, its DTE, the settings, the session the
|
|
// views watch. On Apple's systems the engine is build-apple's XCFramework
|
|
// (ios/build-native.sh); on Linux the host build's libraries (cmake -S
|
|
// native-test -B build-host, or DMODEM_HOST_BUILD), so its tests run
|
|
// there too.
|
|
import Foundation
|
|
import PackageDescription
|
|
|
|
#if os(Linux)
|
|
let host = ProcessInfo.processInfo.environment["DMODEM_HOST_BUILD"] ?? "../../build-host"
|
|
let engine: Target = .systemLibrary(name: "DModemEngine", path: "Sources/DModemEngineHost")
|
|
let engineLinking: [LinkerSetting] = [
|
|
.unsafeFlags([
|
|
"-L\(host)/app", "-L\(host)/app/d-modem-re/dmodemd", "-L\(host)/_deps/libre-install/lib",
|
|
]),
|
|
.linkedLibrary("dmodem_engine"), .linkedLibrary("dmodem_sip"), .linkedLibrary("re"),
|
|
.linkedLibrary("ssl"), .linkedLibrary("crypto"), .linkedLibrary("stdc++"), .linkedLibrary("dl"),
|
|
.linkedLibrary("m"),
|
|
]
|
|
#else
|
|
let engine: Target = .binaryTarget(name: "DModemEngine", path: "../../build-apple/DModemEngine.xcframework")
|
|
let engineLinking: [LinkerSetting] = [.linkedLibrary("c++")]
|
|
#endif
|
|
|
|
let package = Package(
|
|
name: "DModemKit",
|
|
platforms: [.macOS(.v12), .iOS(.v15)],
|
|
products: [.library(name: "DModemKit", targets: ["DModemKit"])],
|
|
targets: [
|
|
engine,
|
|
.target(name: "DModemKit", dependencies: ["DModemEngine"], linkerSettings: engineLinking),
|
|
.testTarget(name: "DModemKitTests", dependencies: ["DModemKit"]),
|
|
]
|
|
)
|