Build raw sqlite interface as libsqlite3-sys

Use pkg-config to find it.
This commit is contained in:
John Gallagher 2015-02-23 15:22:34 -05:00
parent 94ed61c44c
commit 03f368c4f4
8 changed files with 36 additions and 5 deletions

View File

@ -15,3 +15,6 @@ name = "rusqlite"
[dependencies]
time = "~0.1.0"
bitflags = "~0.1"
[dependencies.libsqlite3-sys]
path = "libsqlite3-sys"

5
build.rs Normal file
View File

@ -0,0 +1,5 @@
extern crate "pkg-config" as pkg_config;
fn main() {
pkg_config::find_library("sqlite3").unwrap();
}

3
libsqlite3-sys/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/target/
/doc/
Cargo.lock

11
libsqlite3-sys/Cargo.toml Normal file
View File

@ -0,0 +1,11 @@
[package]
name = "libsqlite3-sys"
version = "0.0.9"
authors = ["John Gallagher <jgallagher@bignerdranch.com>"]
description = "Native bindings to the libsqlite3 library"
license = "MIT"
links = "sqlite3"
build = "build.rs"
[build-dependencies]
pkg-config = "~0.2"

5
libsqlite3-sys/build.rs Normal file
View File

@ -0,0 +1,5 @@
extern crate "pkg-config" as pkg_config;
fn main() {
pkg_config::find_library("sqlite3").unwrap();
}

View File

@ -1,4 +1,4 @@
#![allow(raw_pointer_derive)]
#![allow(raw_pointer_derive, non_snake_case, non_camel_case_types)]
/* Running `target/bindgen /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sqlite3.h -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.0/include` */
/* automatically generated by rust-bindgen */
@ -521,7 +521,6 @@ pub struct Struct_sqlite3_rtree_geometry {
pub xDelUser: ::std::option::Option<extern "C" fn
(arg1: *mut ::libc::c_void)>,
}
#[link(name = "sqlite3")]
extern "C" {
pub static mut sqlite3_version: *const ::libc::c_char;
pub static mut sqlite3_temp_directory: *mut ::libc::c_char;

View File

@ -1,4 +1,10 @@
#![feature(libc)]
#![allow(non_snake_case)]
extern crate libc;
pub use self::bindgen::*;
use std::mem;
use libc::{c_int, c_void};

View File

@ -52,6 +52,7 @@
#![cfg_attr(test, feature(test))]
extern crate libc;
extern crate "libsqlite3-sys" as ffi;
#[macro_use] extern crate rustc_bitflags;
use std::mem;
@ -76,9 +77,6 @@ pub use transaction::{SqliteTransactionBehavior,
pub mod types;
mod transaction;
/// Automatically generated FFI bindings (via [bindgen](https://github.com/crabtw/rust-bindgen)).
#[allow(dead_code,non_snake_case,non_camel_case_types)] pub mod ffi;
/// A typedef of the result returned by many methods.
pub type SqliteResult<T> = Result<T, SqliteError>;
@ -705,6 +703,7 @@ impl<'stmt> SqliteRow<'stmt> {
#[cfg(test)]
mod test {
extern crate "libsqlite3-sys" as ffi;
use super::*;
fn checked_memory_handle() -> SqliteConnection {