mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-10 10:03:17 +01:00
Tested on Ubuntu 17.10 and Ubuntu 16.04 LTS. Should work just as well on other distros however I'm not sure which command will install mingw-w64 correctly
parent
90c542951d
commit
7ea8a6b143
@ -1,22 +1,21 @@
|
||||
**(Note: Has anyone tried this? Hajime Hoshi has not tried yet.)**
|
||||
### If you wish to cross compile from a Linux system to Windows you can quite easily do so.
|
||||
|
||||
You may not have a Windows machine handy.
|
||||
But thanks to xgo, it is possible to cross-compile games made with Ebiten!
|
||||
Start by installing sys/windows from the standard library
|
||||
`go get golang.org/x/sys/windows`
|
||||
|
||||
You will need xgo:
|
||||
Then you'll need the mingw compiler.
|
||||
* Debian/Ubuntu:
|
||||
`sudo apt install mingw-w64`
|
||||
_Note:_ If package cannot be found on ubuntu make sure you've added the multiverse repository
|
||||
(`sudo add-apt-repository multiverse`)
|
||||
|
||||
```
|
||||
go get github.com/karalabe/xgo
|
||||
```
|
||||
When completed you should be able to cross compile using this:
|
||||
`CGO_ENABLED=1 CXX=x86_64-w64-mingw32-g++ CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build file.go`
|
||||
|
||||
You will also need Docker:
|
||||
https://www.docker.com/products/overview
|
||||
Make sure docker is in your PATH.
|
||||
Since that's quite a messy command to use each time you want to test your program you might wanna set up a bash alias in your .bashrc or .profile file.
|
||||
* `nano ~/.bashrc`
|
||||
* add this line
|
||||
`alias LinuxtoWindows="export CXX=x86_64-w64-mingw32-g++ && export CC=x86_64-w64-mingw32-gcc && CGO_ENABLED=1 && GOOS=windows"`
|
||||
to the bottom of the file.
|
||||
|
||||
Make sure your Ebiten game is in your GOPATH and run this to cross-compile your game to Windows:
|
||||
|
||||
```
|
||||
xgo --targets=windows/* /path/to/ebiten/game/in/gopath
|
||||
```
|
||||
|
||||
NOTE: make sure you have a couple of GB's space as xgo will download what it needs to cross-compile the game.
|
||||
Now you may simply use `LinuxToWindows && go build file.go` to cross compile
|
Loading…
Reference in New Issue
Block a user