Xcode Project for SQLite

I’ve been integrating SQLite into an application I’m building. I wanted to make it part of my build so I could properly create a universal binary and also control which version of SQLite I used (instead of using the Tiger system dylib). I think I came up with a reasonable solution via Xcode.

The basic idea is to create a couple targets. One target runs the configure script with CFLAGS and LDFLAGS properly set for Universal Binaries (as outlined by Apple). Next, I used a external build system target to wrap the call to the generated makefile. This lets you do cool things like run a real make clean if you clean the targets. I then copied the generated files into the build/Debug or build/Release directory. This lets anything that wants to depend on it to pick up the right bits easily. In particular, the sqlite console app, header, and static library are here. The final target is a hack I did to let me embed the SQLite Xcode project in another Xcode project. I created a target for a static library with the name libsqlite3.a. However, I don’t put anything in it to build and just make the copy files target a dependency. This seems to do the trick. I can embed the SQLite xcode project in another one and get the correct search paths to either debug or release as needed.

Note that the configure stage runs configure in the ${CONFIGURATION_TEMP_DIR} so you never pollute the SQLite source tree with any generated files. You can dump the build directory to clean everything up. Also, the configure stage has a reasonably reliable check for an existing Makefile that will prevent configure from running every time you build. This also means that the make stage won’t unnecessarily recompile and will work just like you would do it on the command line.

You can download the xcode project from here. The zip file simply contains the Xcode project. Put this at the root of a SQLite snapshot or enlistment and you should be able to hack away in Xcode. I plan to add a test target as well to run all the SQLite tests and maybe a shared library target.

2 Comments

  1. Niels Buntrock
    Posted March 9, 2007 at 2:43 am | Permalink

    Hi,

    you left your .svn folder inside the project; you better use svn export :-)
    Thanks for the Xcode project for SQLite – I’m just going to try it.

    Cheers
    Niels

  2. Posted March 9, 2007 at 10:32 am | Permalink

    Oops. Sorry about that. I put an updated version up here.


One Trackback/Pingback

  1. [...] Hey, check it out. Just after Andrew posts his XCode project for SQLite, Apple goes and releases a big ole hoodoo about making open source projects into universal binaries using XCode [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*