From 361a05f600df75292bb7be13844110a8dc915931 Mon Sep 17 00:00:00 2001 From: Aaron Rennow Date: Thu, 22 Aug 2019 12:19:09 -0400 Subject: [PATCH 1/3] Add support for Swift Package Manager --- .gitignore | 5 ++++- Package.swift | 17 +++++++++++++++++ SQLClient/SQLClient.xcodeproj/project.pbxproj | 5 +++-- .../SQLClient/{ => spm_include}/SQLClient.h | 0 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 Package.swift rename SQLClient/SQLClient/SQLClient/{ => spm_include}/SQLClient.h (100%) 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/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 From 7720ab727960dd9ea159f4cbe727fa7b90aca000 Mon Sep 17 00:00:00 2001 From: Aaron Rennow Date: Tue, 10 Sep 2019 15:47:27 -0400 Subject: [PATCH 2/3] Updated README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 7295668..87a622b 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,17 @@ 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

From 1b8a84830c008eee8f56e2fb4d57f0eeab3d651c Mon Sep 17 00:00:00 2001
From: Aaron Rennow 
Date: Wed, 25 Sep 2019 08:11:54 -0400
Subject: [PATCH 3/3] Fix README formatting

---
 README.md | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 87a622b..5511768 100644
--- a/README.md
+++ b/README.md
@@ -7,9 +7,13 @@ Native Microsoft SQL Server client for iOS. An Objective-C wrapper around the op
 
 ## 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"],
+
+```
+.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).
 
 ----------------