[niepce] Update cbindgen to 0.4.3



commit 284714f1f66d6326ed7ab200bcea11e5554f738c
Author: Hubert Figuière <hub figuiere net>
Date:   Mon Feb 19 20:12:04 2018 -0500

    Update cbindgen to 0.4.3

 Cargo.toml                         |  2 +-
 build.rs                           | 13 ++++++++++---
 cbindgen.toml                      | 11 -----------
 src/engine/library/notification.rs |  1 -
 src/fwk/base/propertyvalue.rs      |  7 ++-----
 src/rust_bindings.hpp              |  5 ++++-
 6 files changed, 17 insertions(+), 22 deletions(-)
---
diff --git a/Cargo.toml b/Cargo.toml
index d2074a5..85f981a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ try_opt = "0.1.1"
 
 [build-dependencies]
 bindgen = "0.30.0"
-cbindgen = { version = "=0.1.29" }
+cbindgen = { version = "0.4.3" }
 pkg-config = "0.3.9"
 
 [lib]
diff --git a/build.rs b/build.rs
index cec2063..155d376 100644
--- a/build.rs
+++ b/build.rs
@@ -52,7 +52,14 @@ fn main() {
     let target_dir = env::var("CARGO_TARGET_DIR").unwrap_or(String::from("./target"));
     let mut target_file = PathBuf::from(target_dir);
     target_file.push("bindings.h");
-    cbindgen::generate(&crate_dir)
-        .unwrap()
-        .write_to_file(&*target_file.to_string_lossy());
+    let cbuilder = cbindgen::Builder::new()
+        .with_include_guard("niepce_rust_bindings_h")
+        .with_namespace("ffi")
+        .with_language(cbindgen::Language::Cxx)
+        .with_parse_deps(true)
+        .with_parse_exclude(&["exempi", "chrono"])
+        .exclude_item("GtkWindow")
+        .with_crate(&crate_dir);
+
+    cbuilder.generate().unwrap().write_to_file(&*target_file.to_string_lossy());
 }
diff --git a/src/engine/library/notification.rs b/src/engine/library/notification.rs
index 58d8caf..86c6618 100644
--- a/src/engine/library/notification.rs
+++ b/src/engine/library/notification.rs
@@ -85,7 +85,6 @@ impl Drop for MetadataChange {
     }
 }
 
-#[repr(C)]
 pub enum Notification {
     AddedFile,
     AddedFiles,
diff --git a/src/fwk/base/propertyvalue.rs b/src/fwk/base/propertyvalue.rs
index 977c8b0..78ee385 100644
--- a/src/fwk/base/propertyvalue.rs
+++ b/src/fwk/base/propertyvalue.rs
@@ -20,20 +20,17 @@
 use libc::c_char;
 use std::ffi::{CStr,CString};
 
-use chrono::{DateTime, Utc};
+use super::date::Date;
 
 #[derive(Clone,Debug)]
-#[repr(C)]
 pub enum PropertyValue {
     Empty,
     Int(i32),
     String(String),
     StringArray(Vec<String>),
-    Date(DateTime<Utc>)
+    Date(Date)
 }
 
-type Date = DateTime<Utc>;
-
 impl PropertyValue {
 }
 
diff --git a/src/rust_bindings.hpp b/src/rust_bindings.hpp
index 29c1c79..1a96b1d 100644
--- a/src/rust_bindings.hpp
+++ b/src/rust_bindings.hpp
@@ -29,12 +29,15 @@ namespace fwk {
 class FileList;
 }
 namespace eng {
-class QueriedContent;
+struct QueriedContent;
 }
 
 
 namespace ffi {
 class rust_str;
+struct Utc;
+template <class T>
+struct DateTime;
 typedef rust_str str;
 typedef eng::QueriedContent QueriedContent;
 typedef eng::NiepceProperties Np;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]