diff --git a/Cargo.lock b/Cargo.lock index 001768b..da863fa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1800,6 +1800,7 @@ dependencies = [ "wgpu", "windows 0.58.0", "winit", + "winresource", ] [[package]] @@ -2879,6 +2880,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + [[package]] name = "shlex" version = "1.3.0" @@ -3132,11 +3142,26 @@ dependencies = [ "zerovec", ] +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + [[package]] name = "toml_datetime" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -3145,6 +3170,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", + "serde", + "serde_spanned", "toml_datetime", "winnow", ] @@ -4085,6 +4112,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "winresource" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7276691b353ad4547af8c3268488d1311f4be791ffdc0c65b8cfa8f41eed693b" +dependencies = [ + "toml", + "version_check", +] + [[package]] name = "write16" version = "1.0.0" diff --git a/Cargo.toml b/Cargo.toml index 054aceb..c2ac868 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,6 +37,7 @@ windows = { version = "0.58", features = ["Win32_System_Threading"] } [build-dependencies] cc = "1" +winresource = "0.1" [profile.release] lto = true diff --git a/assets/lemur.ico b/assets/lemur.ico new file mode 100644 index 0000000..feda985 Binary files /dev/null and b/assets/lemur.ico differ diff --git a/build.Dockerfile b/build.Dockerfile index 8ec0fc7..2521d83 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -8,21 +8,27 @@ RUN rustup target add x86_64-pc-windows-msvc && \ rustup target add x86_64-apple-darwin && \ rustup target add aarch64-apple-darwin && \ apt-get update && \ - apt-get install -y clang lld libc6-dev libasound2-dev libudev-dev genisoimage && \ - cargo install cargo-bundle xwin + apt-get install -y clang-19 lld-19 libc6-dev libasound2-dev libudev-dev genisoimage mingw-w64 && \ + cargo install cargo-bundle xwin && \ + xwin --accept-license splat --output xwin && \ + rm -rf .xwin-cache && \ + ln -s $(which clang-19) /usr/bin/clang && \ + ln -s $(which clang++-19) /usr/bin/clang++ COPY --from=osxcross /osxcross /osxcross -RUN xwin --accept-license splat --output xwin && rm -rf .xwin-cache + ENV PATH="/osxcross/bin:$PATH" \ LD_LIBRARY_PATH="/osxcross/lib" \ - CC="clang" CXX="clang++" AR="llvm-ar-14" \ + CC="clang-19" CXX="clang++-19" AR="llvm-ar-19" \ CC_x86_64-apple-darwin="o64-clang" \ CXX_x86_64-apple-darwin="o64-clang++" \ CC_aarch64-apple-darwin="oa64-clang" \ CXX_aarch64-apple-darwin="o6a4-clang++" \ - CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER="lld-link" \ + CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER="lld-link-19" \ CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER="o64-clang" \ - CARGO_TARGET_X86_64_APPLE_DARWIN_AR="llvm-ar-14" \ + CARGO_TARGET_X86_64_APPLE_DARWIN_AR="llvm-ar-19" \ CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER="oa64-clang" \ - CARGO_TARGET_AARCH64_APPLE_DARWIN_AR="llvm-ar-14" \ + CARGO_TARGET_AARCH64_APPLE_DARWIN_AR="llvm-ar-19" \ + CROSS_COMPILE="setting-this-to-silence-a-warning-" \ + RC_PATH="llvm-rc-19" \ RUSTFLAGS="-Lnative=/xwin/crt/lib/x86_64 -Lnative=/xwin/sdk/lib/um/x86_64 -Lnative=/xwin/sdk/lib/ucrt/x86_64" \ MACOSX_DEPLOYMENT_TARGET="14.5" diff --git a/build.rs b/build.rs index ab23bf9..6335468 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,12 @@ -use std::path::Path; +use std::{error::Error, path::Path}; + +fn main() -> Result<(), Box> { + if std::env::var("CARGO_CFG_TARGET_OS")? == "windows" { + let mut res = winresource::WindowsResource::new(); + res.set_icon("assets/lemur.ico"); + res.compile()?; + } -fn main() { println!("cargo::rerun-if-changed=shrooms-vb-core"); cc::Build::new() .include(Path::new("shrooms-vb-core/core")) @@ -11,4 +17,6 @@ fn main() { .define("VB_DIV_GENERIC", None) .file(Path::new("shrooms-vb-core/core/vb.c")) .compile("vb"); + + Ok(()) }