From 59172a14e71cf6aeae1de13e55d2e60af6dacb35 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Fri, 5 Oct 2018 20:37:19 +0200 Subject: [PATCH] Starting to work on auto sfml build locally --- .gitignore | 1 + Cargo.toml | 5 +++++ prepare/build.rs | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 prepare/build.rs diff --git a/.gitignore b/.gitignore index 6936990..7a4bf0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target **/*.rs.bk Cargo.lock +third-party diff --git a/Cargo.toml b/Cargo.toml index b47da53..a0f3a6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,10 +2,15 @@ name = "rusty" version = "0.1.0" authors = ["Thomas Forgione "] +build = "prepare/build.rs" [dependencies] sfml = "0.14.0" +[build-dependencies] +git2 = "0.7.5" +cmake = "0.1" + [[bin]] name = "rusty-maker" path = "src/app/game.rs" diff --git a/prepare/build.rs b/prepare/build.rs new file mode 100644 index 0000000..c07cd58 --- /dev/null +++ b/prepare/build.rs @@ -0,0 +1,22 @@ +extern crate git2; + +use git2::Repository; + +fn main() { + let sfml = match Repository::open("third-party/sfml") { + Ok(repo) => repo, + Err(_) => { + Repository::clone("https://github.com/sfml/sfml", "third-party/sfml") + .expect("Couldn't clone SFML") + } + }; + + let csfml = match Repository::open("third-party/csfml") { + Ok(repo) => repo, + Err(_) => { + Repository::clone("https://github.com/sfml/csfml", "third-party/csfml") + .expect("Couldn't clone CSFML") + } + }; + +}