diff --git a/.gitignore b/.gitignore index 6e13704..3fe6a04 100644 --- a/.gitignore +++ b/.gitignore @@ -17,5 +17,8 @@ DerivedData *.hmap *.xccheckout -#CocoaPods +# CocoaPods Pods + +# Swift Package Manager +.build \ No newline at end of file diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..ec523f7 --- /dev/null +++ b/Package.swift @@ -0,0 +1,17 @@ +// swift-tools-version:5.0 +import PackageDescription + +let package = Package( + name: "SQLClient", + products: [ + .library(name: "SQLClient", targets: ["SQLClient"]), + ], + targets: [ + .target( + name: "SQLClient", + path: "SQLClient/SQLClient/SQLClient", + publicHeadersPath: "spm_include", + linkerSettings: [.linkedLibrary("iconv")] + ), + ] +) \ No newline at end of file diff --git a/README.md b/README.md index 7295668..5511768 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,21 @@ SQLClient Native Microsoft SQL Server client for iOS. An Objective-C wrapper around the open-source [FreeTDS](https://github.com/FreeTDS/freetds/) library. +---------------- + +## Swift Package Manager +In order to use this project in SPM, you'll need to copy the file `libsybdb.a` from this repository into your own project, and include a line like + +``` +.target(name: "App", dependencies: ["SQLClient"], + linkerSettings: [.unsafeFlags(["-Llibs", "-lsybdb"])] +) +``` + +in your project's `Package.swift` file (assuming you put `libsybdb.a` in a directory called `libs`). This is due to [Apple's limitations on manually specified flags](https://github.com/apple/swift-package-manager/blob/master/Documentation/PackageDescription.md#linkersetting). + +---------------- + ## Sample Usage
diff --git a/SQLClient/SQLClient.xcodeproj/project.pbxproj b/SQLClient/SQLClient.xcodeproj/project.pbxproj index 95e1867..ef664cd 100644 --- a/SQLClient/SQLClient.xcodeproj/project.pbxproj +++ b/SQLClient/SQLClient.xcodeproj/project.pbxproj @@ -62,7 +62,6 @@ 5B0FC8CD180DDF7E00DF4EFE /* ctpublic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ctpublic.h; sourceTree = ""; }; 5B0FC8CE180DDF7E00DF4EFE /* libsybdb.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libsybdb.a; sourceTree = " "; }; 5B0FC8CF180DDF7E00DF4EFE /* odbcss.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = odbcss.h; sourceTree = " "; }; - 5B0FC8D0180DDF7E00DF4EFE /* SQLClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLClient.h; sourceTree = " "; }; 5B0FC8D1180DDF7E00DF4EFE /* SQLClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SQLClient.m; sourceTree = " "; }; 5B0FC8D2180DDF7E00DF4EFE /* sqldb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sqldb.h; sourceTree = " "; }; 5B0FC8D3180DDF7E00DF4EFE /* sqlfront.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sqlfront.h; sourceTree = " "; }; @@ -177,7 +176,6 @@ isa = PBXGroup; children = ( 5B0FC8CE180DDF7E00DF4EFE /* libsybdb.a */, - 5B0FC8D0180DDF7E00DF4EFE /* SQLClient.h */, 5B0FC8D1180DDF7E00DF4EFE /* SQLClient.m */, 5B0FC8CA180DDF7E00DF4EFE /* bkpublic.h */, 5B0FC8CB180DDF7E00DF4EFE /* cspublic.h */, @@ -252,6 +250,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -374,6 +373,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = "$(SRCROOT)/SQLClient/SQLClient/spm_include"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -411,6 +411,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = "$(SRCROOT)/SQLClient/SQLClient/spm_include"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; diff --git a/SQLClient/SQLClient/SQLClient/SQLClient.h b/SQLClient/SQLClient/SQLClient/spm_include/SQLClient.h similarity index 100% rename from SQLClient/SQLClient/SQLClient/SQLClient.h rename to SQLClient/SQLClient/SQLClient/spm_include/SQLClient.h