Add Swift Package Manager support
Add Package.swift with three products: GCDWebServer (core), GCDWebUploader, and GCDWebDAVServer. Public headers live across Core/Requests/Responses subdirectories, which SPM cannot expose directly. To support SPM without moving any files (keeping the Xcode project and CocoaPods builds intact), public headers are surfaced through symlinks in include/ directories with a hand-written umbrella-directory module map; the private GCDWebServerPrivate.h is left unlinked so it stays out of the public module. GCDWebUploader.bundle is shipped as a .copy resource and located at runtime via SWIFTPM_MODULE_BUNDLE under a #if SWIFT_PACKAGE branch. Verified: swift build (all targets), Swift module imports, Xcode framework build, and the XCTest suite all pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
55
Package.swift
Normal file
55
Package.swift
Normal file
@ -0,0 +1,55 @@
|
||||
// swift-tools-version:5.9
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "GCDWebServer",
|
||||
platforms: [
|
||||
.iOS(.v16),
|
||||
.tvOS(.v16),
|
||||
.macOS(.v12),
|
||||
],
|
||||
products: [
|
||||
.library(name: "GCDWebServer", targets: ["GCDWebServer"]),
|
||||
.library(name: "GCDWebUploader", targets: ["GCDWebUploader"]),
|
||||
.library(name: "GCDWebDAVServer", targets: ["GCDWebDAVServer"]),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "GCDWebServer",
|
||||
path: "GCDWebServer",
|
||||
// Public headers are exposed via symlinks in include/ so that GCDWebServerPrivate.h stays private.
|
||||
publicHeadersPath: "include",
|
||||
cSettings: [
|
||||
// Source files import sibling headers across these subdirectories with quoted #imports.
|
||||
.headerSearchPath("Core"),
|
||||
.headerSearchPath("Requests"),
|
||||
.headerSearchPath("Responses"),
|
||||
],
|
||||
linkerSettings: [
|
||||
.linkedLibrary("z"),
|
||||
.linkedFramework("CoreServices", .when(platforms: [.iOS, .tvOS])),
|
||||
.linkedFramework("CFNetwork", .when(platforms: [.iOS, .tvOS])),
|
||||
.linkedFramework("SystemConfiguration", .when(platforms: [.macOS])),
|
||||
]
|
||||
),
|
||||
.target(
|
||||
name: "GCDWebUploader",
|
||||
dependencies: ["GCDWebServer"],
|
||||
path: "GCDWebUploader",
|
||||
exclude: [".DS_Store"],
|
||||
resources: [
|
||||
.copy("GCDWebUploader.bundle"),
|
||||
],
|
||||
publicHeadersPath: "include"
|
||||
),
|
||||
.target(
|
||||
name: "GCDWebDAVServer",
|
||||
dependencies: ["GCDWebServer"],
|
||||
path: "GCDWebDAVServer",
|
||||
publicHeadersPath: ".",
|
||||
linkerSettings: [
|
||||
.linkedLibrary("xml2"),
|
||||
]
|
||||
),
|
||||
]
|
||||
)
|
||||
Reference in New Issue
Block a user