mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 16:29:20 +08:00
Build raw sqlite interface as libsqlite3-sys
Use pkg-config to find it.
This commit is contained in:
parent
94ed61c44c
commit
03f368c4f4
@ -15,3 +15,6 @@ name = "rusqlite"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
time = "~0.1.0"
|
time = "~0.1.0"
|
||||||
bitflags = "~0.1"
|
bitflags = "~0.1"
|
||||||
|
|
||||||
|
[dependencies.libsqlite3-sys]
|
||||||
|
path = "libsqlite3-sys"
|
||||||
|
5
build.rs
Normal file
5
build.rs
Normal 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
3
libsqlite3-sys/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/target/
|
||||||
|
/doc/
|
||||||
|
Cargo.lock
|
11
libsqlite3-sys/Cargo.toml
Normal file
11
libsqlite3-sys/Cargo.toml
Normal 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
5
libsqlite3-sys/build.rs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
extern crate "pkg-config" as pkg_config;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
pkg_config::find_library("sqlite3").unwrap();
|
||||||
|
}
|
@ -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` */
|
/* 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 */
|
/* automatically generated by rust-bindgen */
|
||||||
|
|
||||||
@ -521,7 +521,6 @@ pub struct Struct_sqlite3_rtree_geometry {
|
|||||||
pub xDelUser: ::std::option::Option<extern "C" fn
|
pub xDelUser: ::std::option::Option<extern "C" fn
|
||||||
(arg1: *mut ::libc::c_void)>,
|
(arg1: *mut ::libc::c_void)>,
|
||||||
}
|
}
|
||||||
#[link(name = "sqlite3")]
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub static mut sqlite3_version: *const ::libc::c_char;
|
pub static mut sqlite3_version: *const ::libc::c_char;
|
||||||
pub static mut sqlite3_temp_directory: *mut ::libc::c_char;
|
pub static mut sqlite3_temp_directory: *mut ::libc::c_char;
|
@ -1,4 +1,10 @@
|
|||||||
|
#![feature(libc)]
|
||||||
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
|
extern crate libc;
|
||||||
|
|
||||||
pub use self::bindgen::*;
|
pub use self::bindgen::*;
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use libc::{c_int, c_void};
|
use libc::{c_int, c_void};
|
||||||
|
|
@ -52,6 +52,7 @@
|
|||||||
#![cfg_attr(test, feature(test))]
|
#![cfg_attr(test, feature(test))]
|
||||||
|
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
extern crate "libsqlite3-sys" as ffi;
|
||||||
#[macro_use] extern crate rustc_bitflags;
|
#[macro_use] extern crate rustc_bitflags;
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
@ -76,9 +77,6 @@ pub use transaction::{SqliteTransactionBehavior,
|
|||||||
pub mod types;
|
pub mod types;
|
||||||
mod transaction;
|
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.
|
/// A typedef of the result returned by many methods.
|
||||||
pub type SqliteResult<T> = Result<T, SqliteError>;
|
pub type SqliteResult<T> = Result<T, SqliteError>;
|
||||||
|
|
||||||
@ -705,6 +703,7 @@ impl<'stmt> SqliteRow<'stmt> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
extern crate "libsqlite3-sys" as ffi;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
fn checked_memory_handle() -> SqliteConnection {
|
fn checked_memory_handle() -> SqliteConnection {
|
||||||
|
Loading…
Reference in New Issue
Block a user