Files
app/ios/DModemKit/Package.swift
T
Claude fe6ab528f1 iOS engine build: #4's configure and link fixes, as they are there
The Apple job now gets past the shared Kotlin tests and stops where #4
fixed it: CMAKE_MACOSX_BUNDLE=OFF for dmodemd's install rule, and
libresolv, SystemConfiguration and CoreFoundation for libre. The files
are #4's, unchanged, so the two merge cleanly in either order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSgB6M9Vp9dEP1haEE
2026-10-30 11:58:35 +00:00

44 lines
1.8 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"), .linkedLibrary("resolv"),
]
#else
let engine: Target = .binaryTarget(name: "DModemEngine", path: "../../build-apple/DModemEngine.xcframework")
let engineLinking: [LinkerSetting] = [
.linkedLibrary("c++"), .linkedLibrary("resolv"),
// libre asks the system for its DNS servers (srv.c, SCDynamicStore)
.linkedFramework("SystemConfiguration"), .linkedFramework("CoreFoundation"),
]
#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"]),
]
)