Skip to content

README fixes #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 46 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
SQLiteLib
==========


Easily build a custom SQLite static library for use in OSX and iOS frameworks and apps.

If you need a specific version of SQLite, or specific SQLite compilation options/features, read on.

==========


**May 29, 2016: SQLiteLib updated for SQLite 3.13.0** ([changelog](CHANGELOG.md)).

Expand All @@ -15,13 +16,11 @@ If you need a specific version of SQLite, or specific SQLite compilation options



---

### Installation:

==========

#### Manual Installation (ex. into a Framework)
## Installation:

#### Manual Installation (ex. into a Framework):

1. Download a copy of SQLiteLib.
2. Embed the `SQLiteLib.xcodeproj` project in your own project.
Expand All @@ -30,23 +29,20 @@ If you need a specific version of SQLite, or specific SQLite compilation options

That's it! (You'll probably also want to `#include "sqlite3.h"` somewhere. SQLiteLib copies this generated file to its project directory.)

==========

#### Using in Swift
#### Using in Swift:

You probably shouldn't be using the raw SQLite C API in Swift. There are a bunch of great libraries available that wrap it.

For example: ([GRDB.swift](https://github.com/groue/GRDB.swift)).

---

### Customization:
## Customization:

By default, SQLiteLib builds SQLite with options that match the built-in system version of SQLite on OSX and iOS (as of OSX 10.11.5, iOS 9.3.2), [with one exception*](#additional-details).

==========

#### Specifying Additional SQLite Compilation Options
#### Specifying Additional SQLite Compilation Options:

> By default, SQLiteLib compiles SQLite with options that match the built-in OSX/iOS version of SQLite (as of OSX 10.11, iOS 9.3.2), with one exception*.
> You only need to follow the steps below if you wish to customize the options.
Expand All @@ -64,9 +60,8 @@ CUSTOM_SQLLIBRARY_CFLAGS = -DSQLITE_ENABLE_PREUPDATE_HOOK
That's it.
There is no need to modify any other files.

==========

#### Compiling a Specific Version of SQLite
#### Compiling a Specific Version of SQLite:

SQLiteLib currently ships with the source for SQLite 3.13.0.

Expand All @@ -83,52 +78,50 @@ If you'd like to compile a newer (or older) version, the process is simple:
> Setting compilation options using the SQLite amalgamation is not guaranteed to work:
> > The versions of the SQLite amalgamation that are supplied on the download page are normally adequate for most users. However, some projects may want or need to build their own amalgamations. A common reason for building a custom amalgamation is in order to use certain compile-time options to customize the SQLite library. Recall that the SQLite amalgamation contains a lot of C-code that is generated by auxiliary programs and scripts. Many of the compile-time options effect this generated code and **must be supplied to the code generators before the amalgamation is assembled**.

==========

**Quick Guide to Using the Latest version of SQLite**:
####**Quick Guide to Using the Latest version of SQLite**:

The snapshop of the complete (raw) source tree for the *current* version of SQLite is available on the ([SQLite Download Page](https://www.sqlite.org/download.html#old)) under: **Alternative Source Code Formats**.
You'll want the file named "sqlite-src-*version*.zip".
> Do **NOT** use the file beginning with "sqlite-preprocessed" - it will not work properly.

---

### Additional Details:

==========
## Additional Details:


#### Default Compilation Options
#### Default Compilation Options:

The built-in OSX/iOS version of SQLite were built with the following compilation options (as of OSX 10.11.5, iOS 9.3.2):

> Fetched using `PRAGMA compile_options;`

- MacOSX (10.11.5)
- ENABLE_API_ARMOR
- ENABLE_FTS3
- ENABLE_FTS3_PARENTHESIS
- ENABLE_LOCKING_STYLE=1
- ENABLE_RTREE
- ENABLE_UPDATE_DELETE_LIMIT
- OMIT_AUTORESET
- OMIT_BUILTIN_TEST
- OMIT_LOAD_EXTENSION
- SYSTEM_MALLOC
- THREADSAFE=2
- `ENABLE_API_ARMOR`
- `ENABLE_FTS3`
- `ENABLE_FTS3_PARENTHESIS`
- `ENABLE_LOCKING_STYLE=1`
- `ENABLE_RTREE`
- `ENABLE_UPDATE_DELETE_LIMIT`
- `OMIT_AUTORESET`
- `OMIT_BUILTIN_TEST`
- `OMIT_LOAD_EXTENSION`
- `SYSTEM_MALLOC`
- `THREADSAFE=2`

- iPhoneOS (9.3.2)
- ENABLE_API_ARMOR
- ENABLE_FTS3
- ENABLE_FTS3_PARENTHESIS
- ENABLE_LOCKING_STYLE=1
- ENABLE_RTREE
- ENABLE_UPDATE_DELETE_LIMIT
- MAX_MMAP_SIZE=0
- OMIT_AUTORESET
- OMIT_BUILTIN_TEST
- OMIT_LOAD_EXTENSION
- SYSTEM_MALLOC
- THREADSAFE=2
- `ENABLE_API_ARMOR`
- `ENABLE_FTS3`
- `ENABLE_FTS3_PARENTHESIS`
- `ENABLE_LOCKING_STYLE=1`
- `ENABLE_RTREE`
- `ENABLE_UPDATE_DELETE_LIMIT`
- `MAX_MMAP_SIZE=0`
- `OMIT_AUTORESET`
- `OMIT_BUILTIN_TEST`
- `OMIT_LOAD_EXTENSION`
- `SYSTEM_MALLOC`
- `THREADSAFE=2`

SQLiteLib uses these settings with one exception - on iOS:

Expand All @@ -142,33 +135,33 @@ D. Richard Hipp (SQLite architect), suggests working around this on iOS using `-
>
> I'm guessing this is not really a factor on iOS."

Thus, SQLiteLib uses SQLITE_ENABLE_LOCKING_STYLE=1 on OSX,
**but on iOS, SQLiteLib compiles with ENABLE_LOCKING_STYLE=0**.
Thus, SQLiteLib uses `SQLITE_ENABLE_LOCKING_STYLE=1` on OSX,
**but on iOS, SQLiteLib compiles with `ENABLE_LOCKING_STYLE=0`**.

This removes the code that uses the deprecated function, but doesn't get rid of the warning that "`gethostuuid() is disabled`" (as of 3.13.0).

To prevent this warning, SQLiteLib separately specifies `-Wno-#warnings` when building for iOS.

All of these base settings are configured in the SQLiteLib.xcconfig file.
It is strongly recommended that you do not edit this file. If you'd like to specify additional compilation options, see [the instructions above](#specifying-additional-sqlite-compilation-options)
It is strongly recommended that you do not edit this file. If you'd like to specify additional compilation options, see [the instructions above](#specifying-additional-sqlite-compilation-options).


==========

#### Build Locations
#### Build Locations:

SQLiteLib generates intermediate files in [${DERIVED_SOURCES_DIR}](https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW43).

The generated SQLite amalgamation files are copied to:

-"${BUILT_PRODUCTS_DIR}/sqlite3.c"
-`${BUILT_PRODUCTS_DIR}/sqlite3.c`

-`${PROJECT_DIR}/sqlite3.h`

-"${PROJECT_DIR}/sqlite3.h"

---

#### Notes:
## Notes:

##### "sqlite3.c" shows as red/missing in Xcode
##### "sqlite3.c" shows as red/missing in Xcode:

Xcode (verified in Version 7.3.1 (7D1014)) will always show "sqlite3.c" as red/missing, even after a build.

Expand Down