Set up cross compilation

This commit is contained in:
Simon Gellis 2024-12-15 22:54:21 -05:00
parent 99390d52e1
commit 1b8207db17
3 changed files with 43 additions and 20 deletions

31
Cargo.lock generated
View File

@ -554,9 +554,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.2.3"
version = "1.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d"
checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf"
dependencies = [
"jobserver",
"libc",
@ -825,9 +825,9 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
version = "0.8.20"
version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]]
name = "cursor-icon"
@ -1265,12 +1265,6 @@ dependencies = [
"syn 2.0.90",
]
[[package]]
name = "futures-sink"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
[[package]]
name = "futures-task"
version = "0.3.31"
@ -1286,7 +1280,6 @@ dependencies = [
"futures-core",
"futures-io",
"futures-macro",
"futures-sink",
"futures-task",
"memchr",
"pin-project-lite",
@ -1833,7 +1826,7 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags 2.6.0",
"libc",
"redox_syscall 0.5.7",
"redox_syscall 0.5.8",
]
[[package]]
@ -2436,7 +2429,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [
"cfg-if",
"libc",
"redox_syscall 0.5.7",
"redox_syscall 0.5.8",
"smallvec",
"windows-targets 0.52.6",
]
@ -2670,9 +2663,9 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.5.7"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f"
checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
dependencies = [
"bitflags 2.6.0",
]
@ -4203,9 +4196,9 @@ dependencies = [
[[package]]
name = "zbus"
version = "5.1.1"
version = "5.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1162094dc63b1629fcc44150bcceeaa80798cd28bcbe7fa987b65a034c258608"
checksum = "fb67eadba43784b6fb14857eba0d8fc518686d3ee537066eb6086dc318e2c8a1"
dependencies = [
"async-broadcast",
"async-executor",
@ -4239,9 +4232,9 @@ dependencies = [
[[package]]
name = "zbus_macros"
version = "5.1.1"
version = "5.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cd2dcdce3e2727f7d74b7e33b5a89539b3cc31049562137faf7ae4eb86cd16d"
checksum = "2c9d49ebc960ceb660f2abe40a5904da975de6986f2af0d7884b39eec6528c57"
dependencies = [
"proc-macro-crate",
"proc-macro2",

View File

@ -1,5 +1,6 @@
[package]
name = "lemur"
description = "An emulator for the Virtual Boy."
version = "0.1.0"
edition = "2021"
@ -38,4 +39,10 @@ windows = { version = "0.58", features = ["Win32_System_Threading"] }
cc = "1"
[profile.release]
lto = true
lto = true
[package.metadata.bundle]
name = "Lemur"
identifier = "com.virtual-boy.Lemur"
icon = ["assets/lemur-256x256.png"]
category = "games"

23
build.Dockerfile Normal file
View File

@ -0,0 +1,23 @@
# This Dockerfile produces a base image for builds.
# It includes all dependencies necessary to cross-compile for Windows/MacOS/Linux.
FROM crazymax/osxcross:latest-ubuntu AS osxcross
FROM rust:latest
RUN rustup target add x86_64-pc-windows-msvc && \
rustup target add x86_64-apple-darwin && \
apt-get update && \
apt-get install -y clang lld libc6-dev libasound2-dev libudev-dev genisoimage && \
cargo install cargo-bundle xwin
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_x86_64-apple-darwin="o64-clang" \
CXX_x86_64-apple-darwin="o64-clang++" \
CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER="lld-link" \
CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER="o64-clang" \
CARGO_TARGET_X86_64_APPLE_DARWIN_AR="llvm-ar-14" \
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"