Skip to content

Commit

Permalink
Make fltk dependency optional on ui feature
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipK committed Sep 27, 2021
1 parent 8434f78 commit ace806e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
15 changes: 7 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@ version = "0.2.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
steam_shortcuts_util="1.1.2"
steamgriddb_api="0.2,0"
serde={version="1.0.130", features=["derive"]}
steam_shortcuts_util = "1.1.2"
steamgriddb_api = "0.2,0"
serde = { version = "1.0.130", features = ["derive"] }
serde_json = "1.0.68"
tokio = { version = "1.11.0", features = ["full"] }
reqwest = { version = "0.11.4", features = ["default"] }
config = "0.11.0"
failure = "0.1.8"
#https://fltk-rs.github.io/fltk-rs/
fltk = { version = "^1.2", features = ["fltk-bundled"] }

fltk = { version = "^1.2", features = ["fltk-bundled"], optional = true }

[build-dependencies]
fl2rust = "0.4"
fl2rust = { version = "0.4", optional = true }

[features]
ui=[]
# default = ["ui"]
ui = ["fltk", "fl2rust"]
21 changes: 15 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
use std::path::PathBuf;
#[cfg(feature = "ui")]
use std::env;
#[cfg(feature = "ui")]
use std::path::PathBuf;

fn main() {
println!("cargo:rerun-if-changed=gui/mainview.fl");
let g = fl2rust::Generator::default();
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
g.in_out("gui/mainview.fl", out_path.join("mainview.rs").to_str().unwrap()).expect("Failed to generate rust from fl file!");
}
#[cfg(feature = "ui")]
{
println!("cargo:rerun-if-changed=gui/mainview.fl");
let g = fl2rust::Generator::default();
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
g.in_out(
"gui/mainview.fl",
out_path.join("mainview.rs").to_str().unwrap(),
)
.expect("Failed to generate rust from fl file!");
}
}
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ mod platform;
mod settings;
mod steam;
mod steamgriddb;
#[cfg(feature = "ui")]
use fltk::{app, prelude::*, window::Window};
#[cfg(feature = "ui")]
mod mainview;

use crate::{
Expand All @@ -25,6 +27,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
{
let app = app::App::default().with_scheme(app::Scheme::Gtk);
let mut ui = mainview::UserInterface::make_window();


app.run().unwrap();
}
Expand Down

0 comments on commit ace806e

Please sign in to comment.