Skip to content

Commit c1e8ff5

Browse files
committed
update readme with build instructions
1 parent dd82337 commit c1e8ff5

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ install:
99
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
1010
brew install mysql;
1111
brew link mysql;
12-
ls /usr/local/include/mysql/;
1312
mysql.server start;
1413
fi
1514
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
@@ -22,8 +21,8 @@ install:
2221
script:
2322
# Build MySQL
2423
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
25-
swift build -Xcc -I/usr/local/include/mysql -Xswiftc -I/usr/local/include/mysql -Xlinker -L/usr/local/lib;
26-
swift build --configuration release -Xcc -I/usr/local/include/mysql -Xswiftc -I/usr/local/include/mysql -Xlinker -L/usr/local/lib;
24+
swift build -Xswiftc -I/usr/local/include/mysql -Xlinker -L/usr/local/lib;
25+
swift build --configuration release -Xswiftc -I/usr/local/include/mysql -Xlinker -L/usr/local/lib;
2726
fi
2827
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
2928
swift build;

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,43 @@ let result = try mysql.execute("SELECT LAST_INSERTED_ID() as id", [], connection
6868

6969
No need to worry about closing the connection.
7070

71+
## Building
72+
73+
### macOS
74+
75+
Installing MySQL
76+
77+
```shell
78+
brew install mysql
79+
brew link mysql
80+
mysql.server start
81+
```
82+
83+
Linking MySQL to `swift build`
84+
85+
```swift
86+
swift build -Xswiftc -I/usr/local/include/mysql -Xlinker -L/usr/local/lib
87+
```
88+
89+
`-I` tells the compiler where to find the MySQL header files, and `-L` tells the linker where to find the library. This is required to compile and run on macOS.
90+
91+
### Linux
92+
93+
Install MySQL
94+
95+
```shell
96+
sudo apt-get update
97+
sudo apt-get install -y mysql-server libmysqlclient-dev
98+
sudo mysql_install_db
99+
sudo service mysql start
100+
```
101+
102+
`swift build` should work normally without needing to link.
103+
104+
### Travis
105+
106+
Travis builds Swift MySQL on both Ubuntu 14.04 and macOS 10.10. Check out the `.travis.yml` file to see how this package is built and compiled during testing.
107+
71108
## Fluent
72109

73110
This wrapper was created to power [Fluent](https://github.com/qutheory/fluent), an elegant ORM for Swift.

0 commit comments

Comments
 (0)