mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-10 10:03:17 +01:00
Destroyed Cross Compiling (markdown)
parent
d95dd790aa
commit
d69d5f3322
@ -1,43 +0,0 @@
|
||||
**As of 1.9, MinGW is no longer required. Just the below command should work anywhere:**
|
||||
|
||||
```sh
|
||||
GOOS=windows GOARCH=amd64 go build path/to/yourgame # or GOARCH=386
|
||||
```
|
||||
|
||||
For Ebiten 1.8 or before, see the below instruction.
|
||||
|
||||
# Using MinGW
|
||||
|
||||
**If you wish to cross compile from a Linux system to Windows you can quite easily do so.**
|
||||
|
||||
Start by installing sys/windows from the standard library:
|
||||
|
||||
```sh
|
||||
go get golang.org/x/sys/windows
|
||||
```
|
||||
|
||||
Then you'll need the mingw compiler. For example, on Debian/Ubuntu, run this command:
|
||||
|
||||
```sh
|
||||
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`)
|
||||
|
||||
When completed you should be able to cross compile using this:
|
||||
|
||||
```sh
|
||||
CGO_ENABLED=1 CXX=x86_64-w64-mingw32-g++ CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build file.go
|
||||
```
|
||||
|
||||
## Tips
|
||||
|
||||
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 the below line to the bottom of the file:
|
||||
|
||||
```sh
|
||||
alias LinuxtoWindows="export CXX=x86_64-w64-mingw32-g++ && export CC=x86_64-w64-mingw32-gcc && export CGO_ENABLED=1 && export GOOS=windows"
|
||||
```
|
||||
|
||||
Now you may simply use `LinuxToWindows && go build file.go` to cross compile.
|
Loading…
Reference in New Issue
Block a user