Don't specify a widgetry backend by default; force every user to set the feature explicitly.

This commit is contained in:
Dustin Carlino 2020-11-22 18:35:03 -08:00
parent 0dd246c83f
commit abf3dbc859
6 changed files with 12 additions and 15 deletions

View File

@ -11,7 +11,7 @@ license = "Apache-2.0"
crate-type = ["cdylib", "lib"]
[features]
default = ["built", "widgetry/glow-backend", "reqwest"]
default = ["built", "widgetry/native-backend", "reqwest"]
# Just a marker to jump straight into the OSM viewer
osm_viewer = []
wasm = ["console_log", "futures", "futures-channel", "js-sys", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", "widgetry/wasm-backend"]
@ -54,7 +54,7 @@ sim = { path = "../sim" }
wasm-bindgen = { version = "0.2.68", optional = true }
wasm-bindgen-futures = { version = "0.4.18", optional = true }
webbrowser = "0.5.5"
widgetry = { path = "../widgetry", default-features=false }
widgetry = { path = "../widgetry" }
xmltree = "0.10.1"
[build-dependencies]

View File

@ -4,10 +4,8 @@ version = "0.1.0"
authors = ["Dustin Carlino <dabreegster@gmail.com>"]
edition = "2018"
# TODO Can't toggle based on target_arch. https://github.com/rust-lang/cargo/issues/2524
# cargo web start --target wasm32-unknown-unknown --no-default-features --features wasm
[features]
default = ["widgetry/glow-backend"]
default = ["widgetry/native-backend"]
wasm = ["widgetry/wasm-backend"]
[dependencies]
@ -15,4 +13,4 @@ aabb-quadtree = "0.1.0"
abstutil = { path = "../abstutil" }
geom = { path = "../geom" }
map_model = { path = "../map_model" }
widgetry = { path = "../widgetry", default-features=false }
widgetry = { path = "../widgetry" }

View File

@ -5,8 +5,7 @@ authors = ["Dustin Carlino <dabreegster@gmail.com>"]
edition = "2018"
[features]
default = ["glow-backend"]
glow-backend = ["glow", "glutin", "usvg/text", "usvg/text_native"]
native-backend = ["glow", "glutin", "usvg/text", "usvg/text_native"]
wasm-backend = ["glow/web-sys", "instant/wasm-bindgen", "usvg/text", "usvg/text_web-sys", "wasm-bindgen", "web-sys", "winit/web-sys"]
[dependencies]

View File

@ -6,7 +6,7 @@ use glow::HasContext;
use crate::drawing::Uniforms;
use crate::{Canvas, Color, GeomBatch, ScreenDims, ScreenRectangle};
#[cfg(feature = "glow-backend")]
#[cfg(feature = "native-backend")]
pub use crate::backend_glow_native::setup;
#[cfg(feature = "wasm-backend")]
@ -189,7 +189,7 @@ impl Drop for Buffer {
#[cfg(feature = "wasm-backend")]
type WindowAdapter = crate::backend_glow_wasm::WindowAdapter;
#[cfg(feature = "glow-backend")]
#[cfg(feature = "native-backend")]
type WindowAdapter = crate::backend_glow_native::WindowAdapter;
pub struct PrerenderInnards {

View File

@ -62,9 +62,9 @@ pub use crate::widgets::{EdgeInsets, Outcome, Panel, Widget, WidgetImpl, WidgetO
mod app_state;
mod assets;
#[cfg(any(feature = "glow-backend", feature = "wasm-backend"))]
#[cfg(any(feature = "native-backend", feature = "wasm-backend"))]
mod backend_glow;
#[cfg(feature = "glow-backend")]
#[cfg(feature = "native-backend")]
mod backend_glow_native;
#[cfg(feature = "wasm-backend")]
mod backend_glow_wasm;
@ -84,7 +84,7 @@ mod tools;
mod widgets;
mod backend {
#[cfg(any(feature = "glow-backend", feature = "wasm-backend"))]
#[cfg(any(feature = "native-backend", feature = "wasm-backend"))]
pub use crate::backend_glow::*;
}

View File

@ -8,7 +8,7 @@ edition = "2018"
crate-type = ["cdylib", "lib"]
[features]
default = ["widgetry/glow-backend"]
default = ["widgetry/native-backend"]
wasm = ["console_log", "wasm-bindgen", "widgetry/wasm-backend"]
[dependencies]
@ -19,4 +19,4 @@ rand = "0.7.0"
rand_xorshift = "0.2.0"
svg_face = "0.1.2"
wasm-bindgen = { version = "0.2.68", optional = true }
widgetry = { path = "../widgetry", default-features=false }
widgetry = { path = "../widgetry" }