mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Make some voxygen dependencies optional
This commit is contained in:
parent
c5dc2fe765
commit
2ad816449c
@ -7,14 +7,14 @@ default-run = "veloren-voxygen"
|
||||
|
||||
[features]
|
||||
gl = ["gfx_device_gl"]
|
||||
discord = ["discord-rpc-sdk"]
|
||||
discord = ["discord-rpc-sdk", "parking_lot", "lazy_static"]
|
||||
singleplayer = ["server", "portpicker"]
|
||||
|
||||
default = ["gl"]
|
||||
default = ["gl", "singleplayer", "msgbox", "heaptrack"]
|
||||
|
||||
[dependencies]
|
||||
common = { package = "veloren-common", path = "../common" }
|
||||
client = { package = "veloren-client", path = "../client" }
|
||||
server = { package = "veloren-server", path = "../server" }
|
||||
|
||||
# Graphics
|
||||
gfx = "0.18.1"
|
||||
@ -32,13 +32,18 @@ specs = "0.14.2"
|
||||
# Mathematics
|
||||
vek = { version = "0.9.8", features = ["serde"] }
|
||||
|
||||
# discord
|
||||
# Discord
|
||||
discord-rpc-sdk = { git = "https://github.com/Songtronix/rust-discord-rpc.git", optional = true }
|
||||
parking_lot = { version = "0.9.0", optional = true }
|
||||
lazy_static = { version = "1.3.0", optional = true }
|
||||
|
||||
# Singleplayer
|
||||
server = { package = "veloren-server", path = "../server", optional = true }
|
||||
portpicker = { version = "0.1.0", optional = true }
|
||||
|
||||
# Utility
|
||||
glsl-include = "0.3.1"
|
||||
failure = "0.1.5"
|
||||
lazy_static = "1.3.0"
|
||||
log = "0.4.8"
|
||||
dot_vox = "4.0.0"
|
||||
image = "0.22.0"
|
||||
@ -47,16 +52,14 @@ serde_derive = "1.0.98"
|
||||
ron = "0.5.1"
|
||||
guillotiere = "0.4.2"
|
||||
simplelog = "0.6.0"
|
||||
msgbox = { git = "https://github.com/bekker/msgbox-rs.git" }
|
||||
msgbox = { git = "https://github.com/bekker/msgbox-rs.git", optional = true }
|
||||
directories = "2.0.2"
|
||||
portpicker = "0.1.0"
|
||||
num = "0.2.0"
|
||||
backtrace = "0.3.33"
|
||||
rand = "0.7.0"
|
||||
frustum_query = "0.1.2"
|
||||
rodio = "0.9.0"
|
||||
crossbeam = "0.7.2"
|
||||
heaptrack = "0.3.0"
|
||||
heaptrack = { version = "0.3.0", optional = true }
|
||||
hashbrown = { version = "0.5.0", features = ["serde", "nightly"] }
|
||||
parking_lot = "0.9.0"
|
||||
chrono = "0.4.7"
|
||||
|
@ -25,6 +25,7 @@ pub mod render;
|
||||
pub mod scene;
|
||||
pub mod session;
|
||||
pub mod settings;
|
||||
#[cfg(feature = "singleplayer")]
|
||||
pub mod singleplayer;
|
||||
pub mod window;
|
||||
|
||||
@ -32,12 +33,14 @@ pub mod window;
|
||||
pub use crate::error::Error;
|
||||
|
||||
use crate::{audio::AudioFrontend, menu::main::MainMenuState, settings::Settings, window::Window};
|
||||
use heaptrack::track_mem;
|
||||
use log::{self, debug, error, info};
|
||||
|
||||
use simplelog::{CombinedLogger, Config, TermLogger, TerminalMode, WriteLogger};
|
||||
use std::{fs::File, mem, panic, str::FromStr};
|
||||
|
||||
#[cfg(feature = "heaptracking")]
|
||||
use heaptrack::track_mem;
|
||||
#[cfg(feature = "heaptracking")]
|
||||
track_mem!();
|
||||
|
||||
/// A type used to store state that is shared between all play states.
|
||||
@ -193,6 +196,7 @@ fn main() {
|
||||
backtrace::Backtrace::new(),
|
||||
);
|
||||
|
||||
#[cfg(feature = "errorbox")]
|
||||
msgbox::create("Voxygen has panicked", &msg, msgbox::IconType::ERROR);
|
||||
|
||||
default_hook(panic_info);
|
||||
|
@ -1,4 +1,5 @@
|
||||
mod client_init;
|
||||
#[cfg(feature = "singleplayer")]
|
||||
mod start_singleplayer;
|
||||
mod ui;
|
||||
|
||||
@ -7,6 +8,7 @@ use crate::{window::Event, Direction, GlobalState, PlayState, PlayStateResult};
|
||||
use client_init::{ClientInit, Error as InitError};
|
||||
use common::{clock::Clock, comp};
|
||||
use log::warn;
|
||||
#[cfg(feature = "singleplayer")]
|
||||
use start_singleplayer::StartSingleplayerState;
|
||||
use std::time::Duration;
|
||||
use ui::{Event as MainMenuEvent, MainMenuUi};
|
||||
@ -114,6 +116,7 @@ impl PlayState for MainMenuState {
|
||||
.login_error("Invalid username or password".to_string());
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "singleplayer")]
|
||||
MainMenuEvent::StartSingleplayer => {
|
||||
return PlayStateResult::Push(Box::new(StartSingleplayerState::new()));
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ pub enum Event {
|
||||
password: String,
|
||||
server_address: String,
|
||||
},
|
||||
#[cfg(feature = "singleplayer")]
|
||||
StartSingleplayer,
|
||||
Quit,
|
||||
Settings,
|
||||
@ -274,6 +275,7 @@ impl MainMenuUi {
|
||||
|
||||
// Singleplayer
|
||||
// Used when the singleplayer button is pressed
|
||||
#[cfg(feature = "singleplayer")]
|
||||
macro_rules! singleplayer {
|
||||
() => {
|
||||
self.login_error = None;
|
||||
@ -512,21 +514,24 @@ impl MainMenuUi {
|
||||
};
|
||||
|
||||
// Singleplayer button
|
||||
if Button::image(self.imgs.button)
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.w_h(258.0, 55.0)
|
||||
.down_from(self.ids.login_button, 20.0)
|
||||
.align_middle_x_of(self.ids.address_bg)
|
||||
.label("Singleplayer")
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(22)
|
||||
.label_y(Relative::Scalar(5.0))
|
||||
.label_x(Relative::Scalar(2.0))
|
||||
.set(self.ids.singleplayer_button, ui_widgets)
|
||||
.was_clicked()
|
||||
#[cfg(feature = "singleplayer")]
|
||||
{
|
||||
singleplayer!();
|
||||
if Button::image(self.imgs.button)
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.w_h(258.0, 55.0)
|
||||
.down_from(self.ids.login_button, 20.0)
|
||||
.align_middle_x_of(self.ids.address_bg)
|
||||
.label("Singleplayer")
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(22)
|
||||
.label_y(Relative::Scalar(5.0))
|
||||
.label_x(Relative::Scalar(2.0))
|
||||
.set(self.ids.singleplayer_button, ui_widgets)
|
||||
.was_clicked()
|
||||
{
|
||||
singleplayer!();
|
||||
}
|
||||
}
|
||||
// Quit
|
||||
if Button::image(self.imgs.button)
|
||||
|
Loading…
Reference in New Issue
Block a user