2014-02-06 00:17:29 +00:00
|
|
|
Cross Compiling to Windows
|
|
|
|
==========================
|
|
|
|
|
2013-01-08 16:11:59 +00:00
|
|
|
Cross compiling mpv to Windows is supported with MinGW-w64. This can be used to
|
|
|
|
produce both 32 bit and 64 bit executables. MinGW-w64 is available from
|
|
|
|
http://mingw-w64.sourceforge.net.
|
|
|
|
|
|
|
|
You have to run mpv's configure with these arguments:
|
|
|
|
|
2014-02-15 18:12:58 +00:00
|
|
|
```bash
|
|
|
|
DEST_OS=win32 TARGET=i686-w64-mingw32 ./waf configure
|
|
|
|
```
|
2013-09-08 10:25:20 +00:00
|
|
|
|
2014-02-15 18:12:58 +00:00
|
|
|
While building a complete MinGW-w64 toolchain yourself is possible, people have
|
|
|
|
created scripts to help ease the process. These are the two recommended methods:
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2014-02-15 18:12:58 +00:00
|
|
|
- Using [mingw-w64-cmake](lachs0r/mingw-w64-cmake) to setup a MinGW-w64
|
|
|
|
environment. We recommend you to try this first before MXE. mingw-w64-cmake
|
|
|
|
will also build mpv and its dependencies.
|
|
|
|
- Alternatively, you can use MXE: http://mxe.cc. With MXE, you have to manually
|
|
|
|
set the target to MinGW-w64 (even if you compile to 32 bit). A working example
|
|
|
|
below.
|
|
|
|
|
|
|
|
**Warning**: the original MinGW (http://www.mingw.org) is unsupported.
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2013-07-30 14:07:42 +00:00
|
|
|
Note that MinGW environments included in Linux distributions are often broken,
|
2013-01-08 16:11:59 +00:00
|
|
|
outdated and useless, and usually don't use MinGW-w64.
|
|
|
|
|
|
|
|
Example with MXE
|
2014-02-06 00:17:29 +00:00
|
|
|
----------------
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2014-02-06 00:17:29 +00:00
|
|
|
```bash
|
2013-01-08 16:11:59 +00:00
|
|
|
# Download MXE. Note that compiling the required packages requires about 1 GB
|
2013-09-08 10:25:20 +00:00
|
|
|
# or more!
|
2013-01-08 16:11:59 +00:00
|
|
|
|
|
|
|
cd /opt
|
2013-12-19 20:29:21 +00:00
|
|
|
git clone https://github.com/mxe/mxe mingw
|
2013-01-08 16:11:59 +00:00
|
|
|
cd mingw
|
|
|
|
|
2014-02-15 18:12:58 +00:00
|
|
|
# Build required packages. The following provide a minimum required to build
|
|
|
|
# mpv.
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2014-02-15 18:12:58 +00:00
|
|
|
# The JOBS environment variable controls threads to use when building. DO NOT
|
|
|
|
# use the regular `make -j4` option with MXE. Alternatively, you can make this
|
|
|
|
# a default so you don't need to type `JOBS=4` every time you build:
|
|
|
|
# echo "JOBS := 4" >> settings.mk
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2014-02-15 18:12:58 +00:00
|
|
|
# The MXE_TARGET environment variable builds MinGW-w64 for 32 bit targets.
|
|
|
|
# You can make this a default:
|
|
|
|
# echo "MXE_TARGETS := i686-w64-mingw32" >> settings.mk
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2014-02-15 18:12:58 +00:00
|
|
|
make gcc ffmpeg libass jpeg pthreads MXE_TARGETS=i686-w64-mingw32 JOBS=4
|
2013-01-08 16:11:59 +00:00
|
|
|
|
|
|
|
# Build mpv. The target will be used to automatically select the name of the
|
|
|
|
# build tools involved (e.g. it will use i686-w64-mingw32-gcc).
|
|
|
|
|
2014-02-15 18:12:58 +00:00
|
|
|
cd ..
|
2013-01-08 16:11:59 +00:00
|
|
|
git clone https://github.com/mpv-player/mpv.git
|
|
|
|
cd mpv
|
|
|
|
export PATH=/opt/mingw/usr/bin/:$PATH
|
2013-07-16 11:28:28 +00:00
|
|
|
DEST_OS=win32 TARGET=i686-w64-mingw32 ./waf configure
|
|
|
|
./waf build
|
2014-02-06 00:17:29 +00:00
|
|
|
```
|