Browse Source

Skeleton with libschrift submodule and compilation.

Kestrel 10 months ago
commit
8e5e9426b1
6 changed files with 37 additions and 0 deletions
  1. 3 0
      .gitignore
  2. 3 0
      .gitmodules
  3. 9 0
      Cargo.toml
  4. 7 0
      build.rs
  5. 1 0
      libschrift
  6. 14 0
      src/lib.rs

+ 3 - 0
.gitignore

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

+ 3 - 0
.gitmodules

@@ -0,0 +1,3 @@
+[submodule "libschrift"]
+	path = libschrift
+	url = https://github.com/tomolt/libschrift

+ 9 - 0
Cargo.toml

@@ -0,0 +1,9 @@
+[package]
+name = "schrift-rs"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[build-dependencies]
+cc = "1.0"

+ 7 - 0
build.rs

@@ -0,0 +1,7 @@
+fn main() {
+    cc::Build::new()
+        .flag("-std=c99")
+        .flag("-pedantic")
+        .file("libschrift/schrift.c")
+        .compile("schrift");
+}

+ 1 - 0
libschrift

@@ -0,0 +1 @@
+Subproject commit 8e533fd07acc2f8ae4cffe7f95d2c3392773e2b5

+ 14 - 0
src/lib.rs

@@ -0,0 +1,14 @@
+pub fn add(left: usize, right: usize) -> usize {
+    left + right
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn it_works() {
+        let result = add(2, 2);
+        assert_eq!(result, 4);
+    }
+}