mw99 / DataCompression

Swift libcompression wrapper as an extension for the Data type (GZIP, ZLIB, LZFSE, LZMA, LZ4, deflate, RFC-1950, RFC-1951, RFC-1952)
Apache License 2.0
286 stars 57 forks source link

compression_stream calls only available on OS X 10.11 or newer #15

Closed Jeehut closed 1 year ago

Jeehut commented 5 years ago

I just added DataCompression to a Swift 5 based SwiftPM tool this one but I am now getting errors stating:

'compression_stream_init' is only available on OS X 10.11 or newer
'compression_stream_destroy' is only available on OS X 10.11 or newer

Here's my Package.swift file content:

// swift-tools-version:5.0

import PackageDescription

let package = Package(
    name: "Accio",
    platforms: [.macOS(.v10_12)],
    products: [
        .executable(name: "accio", targets: ["Accio"]),
        .library(name: "AccioKit", type: .dynamic, targets: ["AccioKit"])
    ],
    dependencies: [
        .package(url: "https://github.com/mw99/DataCompression.git", .upToNextMajor(from: "3.4.0")),
        .package(url: "https://github.com/Flinesoft/HandySwift.git", .upToNextMajor(from: "2.8.0")),
        .package(url: "https://github.com/onevcat/Rainbow.git", .upToNextMajor(from: "3.1.4")),
        .package(url: "https://github.com/jakeheis/SwiftCLI.git", .upToNextMajor(from: "5.2.2")),
        .package(url: "https://github.com/kareman/SwiftShell.git", .upToNextMajor(from: "4.1.2")),
        .package(url: "https://github.com/mengxiangyue/xcodeproj.git", .branch("master")), // TODO: switch back to original once https://github.com/tuist/xcodeproj/issues/385 is fixed
    ],
    targets: [
        .target(
            name: "Accio",
            dependencies: ["AccioKit"]
        ),
        .target(
            name: "AccioKit",
            dependencies: [
                "DataCompression",
                "HandySwift",
                "Rainbow",
                "SwiftCLI",
                "SwiftShell",
                "xcodeproj",
            ]
        ),
        .testTarget(
            name: "AccioKitTests",
            dependencies: ["AccioKit", "HandySwift", "xcodeproj"]
        )
    ]
)
Jeehut commented 5 years ago

Found a fix, but my fix will probably break Swift 4 compatiblity. See #16.

If you want to keep supporting Swift 4, you will want to add platform availability checks as suggested by Xcode. If you don't see the warnings, you probably need to delete the Xcode project file and regenerate it.

mw99 commented 5 years ago

Sorry this took forever. If you have time, you may check version 3.6.0