-
Notifications
You must be signed in to change notification settings - Fork 297
Building Couchbase Lite
If you'd rather, you can download pre-built libraries. This is probably the best path unless you want to troubleshoot by stepping into the framework code, or want to make changes to Couchbase Lite itself.
Our build-bot runs hourly, 24/7/365, and generates builds of the latest commits. These have not been QA'd at all: if it compiles and links, it goes up there. Caveat Emptor. We'll have separate downloads of known-good releases shortly.
Once you've got the library, skip down to "Linking Couchbase Lite Into Your Own App".
If you'd rather be l33t and build it yourself, read on...
- Use Git to clone the Couchbase Lite repository to your local disk. For example: "
git clone git://github.com/couchbaselabs/couchbase-lite-ios.git
" - In that directory run "
git submodule init
" and then "git submodule update
". This will clone some external Git repositories into the vendor/ subdirectory. - Open CouchbaseLite.xcodeproj, and build the "CBL iOS" and/or "CBL Mac" schemes. (Or to build an optimized but less-debuggable version, use the Xcode "Archive" command instead of "Build".)
- You should now have a "CouchbaseLite.framework" in your build output directory. (You can find this directory by looking at the last line of output of the build log in Xcode)
In the future you can update to the latest Couchbase Lite by running "git pull
" in the Couchbase Lite directory, then building the project again.
The "Grocery Sync iOS Demo" and "CBL Mac Demo" targets build some simple demo apps.
- Drag CouchbaseLite.framework into the file list of your app's project window.
- An alternate trick, if you want to always use the latest self-built version of CouchbaseLite.framework, is to symbolic-link (symlink) it.
1. Either, into your project folder directly:
$ cd ~/dev/myProject/
$ ln -s ~/dev/couchbase-lite-ios/DerivedData/CouchbaseLite/Build/Products/Debug-ios-universal/CouchbaseLite.framework CouchbaseLite.framework
2. Or, into your project's Framework folder if it has a real mapping to the Frameworks group inside Xcode:
$ cd ~/dev/myProject/Frameworks
$ ln -s ~/dev/couchbase-lite-ios/DerivedData/CouchbaseLite/Build/Products/Debug-ios-universal/CouchbaseLite.framework CouchbaseLite.framework
3. Then do the drag & drop of theCouchbaseLite.framework
symlink from the Finder window into your Xcode project window's Framework group and follow rest of the instructions below as usual. TheCopy items into destination group's folder (if needed)
andCreate groups for any added folders
can/should stay selected and it will work properly. NO it will NOT follow the reference of the symlink to make a copy ... that won't happen, so relax. - In the window that appears, make sure the checkbox next to your app's target is checked.
- For an iOS target:
- Go to the "Build Settings" tab of your app target's settings.
- Find the "Other Linker Flags" row in the "Linker" section, and add the flag
-ObjC
. (Note the capitalization.) - Go to the "Build Phases" tab of the app target's settings.
- In the "Link Binary with Libraries" section, click the plus button and add
CFNetwork.framework
,Security.framework
,SystemConfiguration.framework
,libsqlite3.dylib
andlibz.dylib
. - For a Mac OS target, you'll need to make sure the framework is copied into your app's bundle:
- To to the "Build Settings" tab of your app target's settings.
- In the "Linker" section, edit "Runpath Search Paths" and add the path "
@loader_path/../Frameworks
". - Now switch to to the "Build Phases" tab.
- Press the "Add Build Phase" button at the bottom of the window and create a new "Copy Files" phase.
- Set the phase's destination to "Frameworks".
- Press the "+" button below the phases' file list and select CouchbaseLite.framework to add it.