Skip to content

Commit

Permalink
cross-arch windows compile now works on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
RinLovesYou committed Jan 7, 2024
1 parent 1c8b9ff commit 60e0f15
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -385,3 +385,7 @@ Output/

# Rust Android Compilation
Rust/MelonBootstrap/jniLibs/

# cargo-xwin SDK cache dirs. cargo-xwin is a tool for cross-compiling Rust projects for Windows on Linux.
# it (stupdily) uses the same cache location for each architecture. The build script will store this in .cache
.cache/
6 changes: 4 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,16 @@ def build(target: str):
os.system(DotnetCommand)

# fully construct Cargo Command
xwin = IsLinux and target == "win64"
xwin = IsLinux and target == "win64" or target == "win32"
command = CargoCommand
command = command.replace("--target=", "--target={}".format(targets[target]))
if xwin:
os.environ["XWIN_CACHE_DIR"] = os.path.join(".cache", "x64")
command = command.replace("cargo", "cargo xwin")
if target == "win32":
os.environ["XWIN_ARCH"] = "x86"
os.environ["XWIN_VERSION"] = "17"
os.environ["XWIN_CACHE_DIR"] = os.path.join(".cache", "x86")


print(command)

Expand Down
4 changes: 2 additions & 2 deletions docs/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ to build the rust parts, you can simply type `cargo build`, with the optional `-

The available architectures are:

* 64bit Windows: `--target=x86_64-pc-windows-msvc` (Bootstrap) & `--target=x86_64-pc-windows-gnu` (Proxy)
* 32bit Windows: `--target=i686-pc-windows-msvc` (Bootstrap) & `--target=i686-pc-windows-gnu` (Proxy)
* 64bit Windows: `--target=x86_64-pc-windows-msvc` (Bootstrap)
* 32bit Windows: `--target=i686-pc-windows-msvc` (Bootstrap)
* 64bit Linux: `--target=x86_64-unknown-linux-gnu`
* 64bit MacOS (not yet): `--target=x86_64-apple-darwin`

Expand Down

0 comments on commit 60e0f15

Please sign in to comment.