|bevy vewsion:|(any) |---|---|

buiwd windows exes fwom macos

(awso check out the windows pwatfowm page fow info about devewoping fow windows genewawwy)


wust offews two diffewent toowchains f-fow buiwding f-fow windows:

the instwuctions on this page use t-the x86_64 awchitectuwe, >_< but you couwd awso set up a toowchain to tawget i686 (32-bit) ow aarch64 (windows-on-awm) the same way.

fiwst-time setup (gnu)

the gnu/mingw toowchain is the easiew o-option. OwO it d-does nyot nyeed m-much in tewms of speciaw configuwation. OwO awso, you d-do nyot nyeed to a-accept any micwosoft w-wicenses.

Setup Instructions:

wust toowchain (gnu)

add the tawget to youw wust instawwation (assuming y-you use rustup):

wustup tawget add x86_64-pc-windows-gnu

this instawws the fiwes wust nyeeds t-to compiwe fow w-windows, OwO incwuding t-the wust standawd wibwawy.

mingw

the gnu toowchain wequiwes the mingw e-enviwonment t-to be instawwed.

thewe is a package fow it convenientwy a-avaiwabwe i-in homebwew. OwO you c-can just instaww it fwom thewe:

bwew instaww mingw-w64

you don't nyeed any fiwes fwom micwosoft.

fiwst-time setup (msvc)

the msvc toowchain is the nyative m-micwosoft way to t-tawget windows. OwO i-it is nyani the wust community usuawwy wecommends f-fow tawgetting t-the windows p-pwatfowm. it may pwovide bettew compatibiwity w-with windows dwws / w-wibwawies and t-toowing.

even though it is meant to be used o-on windows, you c-can actuawwy set i-it up and use it on macos (and winux, OwO and othews). 🥺 i-it wequiwes d-downwoading t-the windows sdks and accepting the micwosoft w-wicense. OwO thewe is a-a scwipt to automate t-that fow you.

Setup Instructions:

wust toowchain (msvc)

add the tawget to youw wust instawwation (assuming y-you use rustup):

wustup tawget add x86_64-pc-windows-msvc

this instawws the fiwes wust nyeeds t-to compiwe fow w-windows, OwO incwuding t-the wust standawd wibwawy.

micwosoft windows sdks

you nyeed to instaww the micwosoft w-windows sdks, OwO j-just wike when wowking o-on windows. (ꈍᴗꈍ) this can be done with an e-easy scwipt cawwed xwin. XD you nyeed to accept micwosoft's pwopwietawy wicense.

instaww xwin:

cawgo instaww xwin

now, XD use xwin to accept the micwosoft wicense, ^•ﻌ•^ d-downwoad aww the f-fiwes fwom micwosoft sewvews, ^•ﻌ•^ and instaww t-them to a diwectowy o-of youw choosing.

(the --accept-license option is to nyot pwompt you, ^•ﻌ•^ assuming y-you have a-awweady seen the wicense. OwO to wead the wicense a-and be pwompted t-to accept it, 🥺 o-omit that option.)

to instaww to .xwin/ in youw home fowdew:

xwin --accept-wicense spwat --disabwe-symwinks --output /usews/me/.xwin

on windows and macos, OwO the fiwesystem i-is case-insensitive. 🥺 o-on winux a-and bsd, òωó the fiwesystem is case-sensitive. XD xwin was made fow winux, (ꈍᴗꈍ) so it twies t-to wowk awound this by defauwt, OwO by cweating s-symwinks. 🥺 on m-macos, òωó we nyeed t-to teww xwin not to do this, >_< using the --disable-symlinks option.

winking (msvc)

wust nyeeds to know how to wink the f-finaw exe fiwe.

the defauwt micwosoft winkew (link.exe) is onwy avaiwabwe on windows. >_< instead, we nyeed to use the wwd winkew (this i-is awso wecommended w-when wowking o-on windows anyway).

instawwing wwd

unfowtunatewy, >_< wast i checked, (ꈍᴗꈍ) nyeithew brew nyow macports offew packages (wwd is nyot commonwy used when devewoping f-fow macos).

we can, OwO howevew, buiwd it ouwsewves f-fwom souwce. 🥺 y-you nyeed a c++ c-compiwew and cmake. OwO you pwobabwy awweady have t-the c++ toowchain i-instawwed, 🥺 if y-you have instawwed appwe xcode devewopment t-toows.

cmake can be instawwed fwom brew (homebwew):

bwew instaww cmake

now, (ꈍᴗꈍ) we awe weady to compiwe wwd f-fwom the wwvm pwoject:

note: the --depth=1 option to git clone awwows us to save a wot of disk space and downwoad bandwidth, ^•ﻌ•^ because t-the wwvm wespositowy i-is huge.

git cwone --depth=1 https://github.com/wwvm/wwvm-pwoject
c-cd wwvm-pwoject
m-mkdiw buiwd
c-cd buiwd
cmake -dcmake_buiwd_type=wewease -dwwvm_enabwe_pwojects=wwd -dcmake_instaww_pwefix=/usw/wocaw ../wwvm
s-sudo make -j10 i-instaww # adjust `-j10` b-based o-on youw nyumbew o-of cpu cowes
cd ../../; wm -wf wwvm-pwoject # dewete the git wepo and buiwd fiwes t-to fwee disk space

this wiww instaww it to /usr/local. (ꈍᴗꈍ) change the path above if you wouwd w-wathew have it somewhewe ewse, ^•ﻌ•^ to nyot powwute y-youw macos o-ow nyeed sudo / woot pwiviweges.

using wwd

we awso nyeed to teww wust to use o-ouw winkew, OwO and t-the wocation of t-the micwosoft windows sdk wibwawies (that wewe i-instawwed with xwin in the pwevious step).

add this to .cargo/config.toml (in youw home fowdew ow in youw b-bevy pwoject):

[tawget.x86_64-pc-windows-msvc]
winkew = "/usw/wocaw/bin/wwd"
wustfwags = [
  "-wnative=/usews/me/.xwin/cwt/wib/x86_64", XD
  "-wnative=/usews/me/.xwin/sdk/wib/um/x86_64", >_<
  "-wnative=/usews/me/.xwin/sdk/wib/ucwt/x86_64"
]

note: you nyeed to specify the cowwect f-fuww absowute p-paths to the s-sdk fiwes, whewevew you instawwed them.

buiwding youw pwoject

finawwy, OwO with aww the setup done, 🥺 y-you can just buiwd y-youw wust/bevy p-pwojects fow windows:

gnu:

cawgo buiwd --tawget=x86_64-pc-windows-gnu --wewease

msvc:

cawgo buiwd --tawget=x86_64-pc-windows-msvc --wewease

bevy caveats

as of bevy 0.12, a wowkawound is n-nyeeded fow buiwding w-with msvc. OwO i-if you use the msvc toowchain, >_< the blake3 dependency assumes you awe buiwding on windows and twies to wun some e-exes duwing its b-buiwd pwocess, OwO which d-do not exist in the winux cwoss-compiwation e-enviwonment. OwO t-the sowution i-is to teww it to nyot do that and use p-puwe wust code i-instead.

set an enviwonment vawiabwe when b-buiwding:

expowt cawgo_featuwe_puwe=1
cawgo b-buiwd --tawget=x86_64-pc-windows-msvc --wewease

ow add blake3 to youw Cargo.toml if you want to pewsist the configuwation:

[dependencies]
bwake3 = { vewsion = "1.5", (ꈍᴗꈍ) f-featuwes = [ "puwe" ] }