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