2013-03-22 21:24:35 +00:00
|
|
|
# Cross-compiling with MXE
|
|
|
|
|
|
|
|
MXE works for any BSD-compatible system (including Linux).
|
|
|
|
It is a complete package with cross-compiler to Win32 (a MinGW variant)
|
|
|
|
and includes scripts to automatically download and build many 3rd party
|
|
|
|
libraries and tools.
|
|
|
|
|
|
|
|
To cross-compile Colobot using MXE:
|
|
|
|
|
|
|
|
1. See the MXE website (http://mxe.cc) for list of required packages and make sure
|
|
|
|
you have them installed.
|
|
|
|
|
|
|
|
2. Download MXE and unpack it in the directory, where you want to keep it
|
|
|
|
permanently. During the build, MXE will write that path to many files,
|
|
|
|
so moving that directory can be tricky.
|
|
|
|
|
|
|
|
3. `cd` to the MXE root directory.
|
|
|
|
It already contains a universal Makefile for everything.
|
|
|
|
Usage is simply `make name_of_package`.
|
|
|
|
It will automatically check for dependencies, etc.
|
2015-09-26 12:46:26 +00:00
|
|
|
The packages will be installed in the MXE directory under `usr/i686-w64-mingw32.static`.
|
2013-03-22 21:24:35 +00:00
|
|
|
|
|
|
|
You need to `make gcc` first for basic compiler and then do the same
|
|
|
|
for some additional libraries. In the end, you should have the following
|
2015-09-26 12:46:26 +00:00
|
|
|
packages installed (this is the final listing of `usr/i686-w64-mingw32.static/installed/`):
|
2013-03-22 21:24:35 +00:00
|
|
|
* binutils
|
|
|
|
* boost
|
|
|
|
* bzip2
|
2015-09-26 12:46:26 +00:00
|
|
|
* cairo
|
|
|
|
* dbus
|
2013-03-22 21:24:35 +00:00
|
|
|
* expat
|
|
|
|
* flac
|
2015-09-26 12:46:26 +00:00
|
|
|
* fontconfig
|
2013-03-22 21:24:35 +00:00
|
|
|
* freetype
|
2015-09-26 12:46:26 +00:00
|
|
|
* freetype-bootstrap
|
2013-03-22 21:24:35 +00:00
|
|
|
* gcc
|
|
|
|
* gcc-gmp
|
2015-09-26 12:46:26 +00:00
|
|
|
* gcc-isl
|
2013-03-22 21:24:35 +00:00
|
|
|
* gcc-mpc
|
|
|
|
* gcc-mpfr
|
|
|
|
* gettext
|
|
|
|
* glew
|
2015-09-26 12:46:26 +00:00
|
|
|
* glib
|
|
|
|
* harfbuzz
|
|
|
|
* icu4c
|
2013-03-22 21:24:35 +00:00
|
|
|
* jpeg
|
2015-09-26 12:46:26 +00:00
|
|
|
* libffi
|
2013-03-22 21:24:35 +00:00
|
|
|
* libiconv
|
|
|
|
* libpng
|
2013-06-22 20:39:04 +00:00
|
|
|
* libsndfile
|
2015-09-26 12:46:26 +00:00
|
|
|
* libwebp
|
|
|
|
* lzo
|
|
|
|
* mingw-w64
|
|
|
|
* mxe-conf
|
2013-06-22 20:39:04 +00:00
|
|
|
* ogg
|
|
|
|
* openal
|
2015-09-26 12:46:26 +00:00
|
|
|
* pcre
|
2014-10-19 14:26:16 +00:00
|
|
|
* physfs
|
2015-09-26 12:46:26 +00:00
|
|
|
* pixman
|
|
|
|
* pkgconf
|
2013-03-22 21:24:35 +00:00
|
|
|
* portaudio
|
2015-09-26 12:46:26 +00:00
|
|
|
* sdl2
|
|
|
|
* sdl2_image
|
|
|
|
* sdl2_ttf
|
2013-03-22 21:24:35 +00:00
|
|
|
* tiff
|
2013-06-22 20:39:04 +00:00
|
|
|
* vorbis
|
2013-03-22 21:24:35 +00:00
|
|
|
* xz
|
|
|
|
* zlib
|
|
|
|
|
2013-11-22 23:50:20 +00:00
|
|
|
4. Now `cd` to directory with colobot sources.
|
|
|
|
It is recommended that you create a separate directory for out-of-source build:
|
|
|
|
`mkdir build-mxe && cd build-mxe`
|
|
|
|
|
|
|
|
In order to cross-compile a CMake project, you have to specify a CMake toolchain file.
|
2015-09-26 12:46:26 +00:00
|
|
|
MXE has such file in MXE's directory: `usr/i686-w64-mingw32.static/share/cmake/mxe-conf.cmake`
|
2013-11-22 23:50:20 +00:00
|
|
|
So you should use the following cmake command: `cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/mxe-conf.cmake ..`
|
2013-03-22 21:24:35 +00:00
|
|
|
CMake files in Colobot should detect that MXE is being used and they will
|
|
|
|
modify flags, paths, etc. as required. You should not run into any problems.
|
|
|
|
|
2013-11-12 10:32:41 +00:00
|
|
|
5. `make` should now compile the game with the resulting executable as `colobot.exe`.
|
2013-03-22 21:24:35 +00:00
|
|
|
The exe is linked against all libraries *statically*, so there are no dependencies
|
|
|
|
on external DLLs. However, the resulting binary will be huge with all these libraries,
|
2013-11-25 23:29:03 +00:00
|
|
|
so you might want to do: `strip colobot.exe`.
|
2013-11-12 10:32:41 +00:00
|
|
|
|
2013-11-26 17:17:33 +00:00
|
|
|
6. If you want to create a Colobot installer, you need to additionally build `nsis`
|
2013-11-12 10:32:41 +00:00
|
|
|
in MXE. Then you can create the NSIS installer that way:
|
2013-11-22 23:50:20 +00:00
|
|
|
`PATH=/path/to/mxe/binaries:$PATH make package`
|
|
|
|
where `/path/to/mxe/binaries` is path to cross-compiled MXE binaries available
|
2015-09-26 12:46:26 +00:00
|
|
|
in MXE's directory under `usr/i686-w64-mingw32.static/bin`.
|
2013-11-22 23:50:20 +00:00
|
|
|
This will create a versioned colobot-$version.exe installer that will install Colobot
|
|
|
|
in system directories, add a shortcut in the start menu and setup an uninstaller.
|