-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use submodule for unqlite source
- Loading branch information
Showing
16 changed files
with
255 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
target | ||
Cargo.lock | ||
*.bk | ||
src/ffi.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "unqlite"] | ||
path = unqlite | ||
url = https://github.com/symisc/unqlite.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
[package] | ||
name = "unqlite" | ||
version = "1.3.2" | ||
version = "1.4.0" | ||
authors = ["Huo Linhe <[email protected]>"] | ||
license = "MIT/Apache-2.0" | ||
readme = "README.md" | ||
homepage = "https://github.com/zitsen/unqlite.rs" | ||
repository = "https://github.com/zitsen/unqlite.rs.git" | ||
documentation = "http://zitsen.github.io/unqlite.rs" | ||
documentation = "https://docs.rs/unqlite" | ||
description = "Rust `unqlite` library wrapper." | ||
keywords = ["unqlite", "kv", "nosql"] | ||
|
||
[build-dependencies] | ||
bindgen = "0.32" | ||
cc = "1.0" | ||
|
||
[dependencies] | ||
libc = "0.2" | ||
unqlite-sys = "^1.1.0" | ||
|
||
[dev-dependencies] | ||
tempfile = "2.1.3" | ||
|
||
[features] | ||
default = ["enable-threads"] | ||
# For thread-safe | ||
enable-threads = [ "unqlite-sys/enable-threads" ] | ||
enable-threads = [] | ||
# Other features | ||
jx9-disable-builtin-func = [ "unqlite-sys/jx9-disable-builtin-func" ] | ||
jx9-enable-math-func = [ "unqlite-sys/jx9-enable-math-func" ] | ||
jx9-disable-disk-io = [ "unqlite-sys/jx9-disable-disk-io" ] | ||
enable-jx9-hash-io = [ "unqlite-sys/enable-jx9-hash-io" ] | ||
jx9-disable-builtin-func = [] | ||
jx9-enable-math-func = [] | ||
jx9-disable-disk-io = [] | ||
enable-jx9-hash-io = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
extern crate bindgen; | ||
extern crate cc; | ||
|
||
fn main() { | ||
use bindgen::builder; | ||
// Configure and generate bindings. | ||
let bindings = builder() | ||
.header("unqlite/unqlite.h") | ||
.with_codegen_config(bindgen::CodegenConfig { | ||
vars: false, | ||
..Default::default() | ||
}) | ||
.generate() | ||
.expect("generate unqlite bindings"); | ||
// Write the generated bindings to an output file. | ||
bindings | ||
.write_to_file("src/ffi.rs") | ||
.expect("write to source file"); | ||
|
||
cc::Build::new() | ||
.file("unqlite/unqlite.c") | ||
.warnings(false) | ||
.if_enable_threads() | ||
.if_jx9_diable_builtin_func() | ||
.if_jx9_enable_math_func() | ||
.if_jx9_disable_disk_io() | ||
.if_enable_jx9_hash_io() | ||
.compile("libunqlite.a"); | ||
} | ||
trait ConfigExt { | ||
fn if_enable_threads(&mut self) -> &mut Self { | ||
self | ||
} | ||
fn if_jx9_diable_builtin_func(&mut self) -> &mut Self { | ||
self | ||
} | ||
fn if_jx9_enable_math_func(&mut self) -> &mut Self { | ||
self | ||
} | ||
fn if_jx9_disable_disk_io(&mut self) -> &mut Self { | ||
self | ||
} | ||
fn if_enable_jx9_hash_io(&mut self) -> &mut Self { | ||
self | ||
} | ||
} | ||
|
||
impl ConfigExt for cc::Build { | ||
#[cfg(feature = "enable-threads")] | ||
fn if_enable_threads(&mut self) -> &mut Self { | ||
self.define("UNQLITE_ENABLE_THREADS", None) | ||
.flag("-lpthread") | ||
} | ||
#[cfg(feature = "jx9-disable-builtin-func")] | ||
fn if_jx9_diable_builtin_func(&mut self) -> &mut Self { | ||
self.define("JX9_DISABLE_BUILTIN_FUNC", None) | ||
} | ||
#[cfg(feature = "jx9-enable-math-func")] | ||
fn if_jx9_enable_math_func(&mut self) -> &mut Self { | ||
self.define("JX9_ENABLE_MATH_FUNC", None) | ||
} | ||
#[cfg(feature = "jx9-disable-disk-io")] | ||
fn if_jx9_disable_disk_io(&mut self) -> &mut Self { | ||
self.define("JX9_DISABLE_DISK_IO", None) | ||
} | ||
#[cfg(feature = "enable-jx9-hash-io")] | ||
fn if_enable_jx9_hash_io(&mut self) -> &mut Self { | ||
self.define("UNQLITE_ENABLE_JX9_HASH_IO", None) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.