Skip to content

Commit

Permalink
Update readme with build instructins
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-Lees11 committed Mar 11, 2019
1 parent c572668 commit 3cb6f45
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# CunixODBC

Intended for demonstation purposes only.

Swift module maps for [unixODBC](https://github.com/lurcher/unixODBC), which allow you to use the unixODBC C library in your Swift project.

Note - from Swift 4.2 you can pull the unixODBC library directly into your Swift project and will not need to use this repository (you can see an example of this in [Swift-Kuery-PostgreSQL](https://github.com/IBM-Swift/Swift-Kuery-PostgreSQL/tree/master/Sources/CLibpq)).
Expand All @@ -26,6 +28,32 @@ Add `CunixODBC` to your target's dependencies:
import CunixODBC
```

#### Build and test linking

You must have unixODBC installed on your machine:

- MacOS:
```
brew install unixodbc
```
- Linux:
```
apt-get install unixodbc-dev
```
Since brew doesn't install the files to the expected place you must provide a linker to swift for any project that depends on this:

```
swift build -Xcc -I/usr/local/Cellar/unixodbc/2.3.7/include
swift run -Xcc -I/usr/local/Cellar/unixodbc/2.3.7/include
swift test -Xcc -I/usr/local/Cellar/unixodbc/2.3.7/include
```

#### Using with Xcode:

You must add the xcconfig file from this repo to your project. Then generate the project using:
```
swift package generate-xcodeproj --xcconfig-overrides unixodbc.xcconfig
```
## Community

We love to talk server-side Swift, and Kitura. Join our [Slack](http://swift-at-ibm-slack.mybluemix.net/) to meet the team!
2 changes: 2 additions & 0 deletions unixodbc.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HEADER_SEARCH_PATHS = /usr/local/Cellar/unixodbc/2.3.7/include
LIBRARY_SEARCH_PATHS = /usr/local/Cellar/unixodbc/2.3.7/lib

0 comments on commit 3cb6f45

Please sign in to comment.