diff --git a/.cargo/config b/.cargo/config index 3e8860a59c..c694936e59 100644 --- a/.cargo/config +++ b/.cargo/config @@ -3,6 +3,12 @@ rustflags = [ "-C", "link-arg=-fuse-ld=gold", ] +[target.x86_64-pc-windows-gnu] +rustflags = [ + # Required for mimalloc + "-C", "link-arg=-lpsapi", +] + [alias] # tools cmd-doc-gen = "run --features=bin_cmd_doc_gen --bin cmd_doc_gen" diff --git a/.gitlab/scripts/env.sh b/.gitlab/scripts/env.sh index fc9c02167b..7241ab322c 100644 --- a/.gitlab/scripts/env.sh +++ b/.gitlab/scripts/env.sh @@ -2,5 +2,8 @@ # exports default env variables in CI export DISABLE_GIT_LFS_CHECK=true export VELOREN_ASSETS="assets" + +# When updating RUSTFLAGS here, windows-x86_64.sh must also be updated as it sets them independently export RUSTFLAGS="-D warnings" + export SHADERC_LIB_DIR=/shaderc/combined/ diff --git a/.gitlab/scripts/windows-x86_64.sh b/.gitlab/scripts/windows-x86_64.sh index 1f3a2d967b..b72594f907 100755 --- a/.gitlab/scripts/windows-x86_64.sh +++ b/.gitlab/scripts/windows-x86_64.sh @@ -2,4 +2,10 @@ update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix export VELOREN_USERDATA_STRATEGY=executable + +# RUSTFLAGS is set here in addition to env.sh (which is used for all targets not just windows) due to +# https://github.com/rust-lang/cargo/issues/5376 which prevents the windows-specific rustflags set in +# .cargo/config from being applied +export RUSTFLAGS="-D warnings -C link-arg=-lpsapi" + time cargo build --target=x86_64-pc-windows-gnu --release --no-default-features --features default-publish diff --git a/server-cli/Cargo.toml b/server-cli/Cargo.toml index 84cea7e4d3..3bdc9f0b65 100644 --- a/server-cli/Cargo.toml +++ b/server-cli/Cargo.toml @@ -43,7 +43,7 @@ tracing = { version = "0.1", default-features = false } ron = {version = "0.7", default-features = false} serde = {version = "1.0", features = [ "rc", "derive" ]} -[target.'cfg(all(windows, target_env="msvc"))'.dependencies] +[target.'cfg(windows)'.dependencies] mimalloc = "0.1.29" [dependencies.tui] diff --git a/server-cli/src/main.rs b/server-cli/src/main.rs index 1e0875e340..e88c6d7572 100644 --- a/server-cli/src/main.rs +++ b/server-cli/src/main.rs @@ -2,7 +2,7 @@ #![deny(clippy::clone_on_ref_ptr)] #![feature(bool_to_option)] -#[cfg(all(target_os = "windows", target_env = "msvc"))] +#[cfg(target_os = "windows")] #[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index 007f2f0332..c6b4ca7b61 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -138,7 +138,7 @@ dispatch = "0.1.4" [target.'cfg(windows)'.build-dependencies] winres = "0.1" -[target.'cfg(all(windows, target_env="msvc"))'.dependencies] +[target.'cfg(windows)'.dependencies] mimalloc = "0.1.29" # Mumble diff --git a/voxygen/anim/Cargo.toml b/voxygen/anim/Cargo.toml index 0a6b1ebcf3..9c4a7a2b07 100644 --- a/voxygen/anim/Cargo.toml +++ b/voxygen/anim/Cargo.toml @@ -21,5 +21,5 @@ voxygen-dynlib = {package = "veloren-voxygen-dynlib", path = "../dynlib", option # Hot Reloading lazy_static = {version = "1.4.0", optional = true} -[target.'cfg(all(windows, target_env="msvc"))'.dependencies] +[target.'cfg(windows)'.dependencies] mimalloc = "0.1.29" diff --git a/voxygen/anim/src/lib.rs b/voxygen/anim/src/lib.rs index b5f7b96b56..e3aa8d44f9 100644 --- a/voxygen/anim/src/lib.rs +++ b/voxygen/anim/src/lib.rs @@ -4,7 +4,7 @@ #[cfg(all(feature = "be-dyn-lib", feature = "use-dyn-lib"))] compile_error!("Can't use both \"be-dyn-lib\" and \"use-dyn-lib\" features at once"); -#[cfg(all(target_os = "windows", target_env = "msvc", feature = "be-dyn-lib"))] +#[cfg(all(target_os = "windows", feature = "be-dyn-lib"))] #[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index 3b66bbb74c..86c43540aa 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -4,7 +4,6 @@ #[cfg(all( target_os = "windows", - target_env = "msvc", not(feature = "tracy-memory"), not(feature = "hot-egui") ))]