-
Notifications
You must be signed in to change notification settings - Fork 0
Cross compile using MXE
zwostein edited this page Aug 27, 2013
·
4 revisions
This is a quick reference on how to compile a Windows executable on a Linux machine using the MXE toolchain
Download MXE from http://mxe.cc/#tutorial and install the cross compiler including all dependencies:
make gcc qt openal glew vorbis ogg
This will take a while...
$ git clone https://github.com/splatterlinge/Splatterlinge.git
$ cd Splatterlinge
MXE provides a toolchain file for CMake. Unfortunately, running CMake with the toolchain file only won't suffice and you'll probably end up with linker errors. To make the linker work, you'll have to add additional libraries and some defines:
cmake -DCMAKE_CXX_STANDARD_LIBRARIES:STRING="-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -llzma -llcms -lvorbis -logg" \
-DCMAKE_C_FLAGS:STRING="-DAL_LIBTYPE_STATIC -DGLEW_STATIC" \
-DCMAKE_CXX_FLAGS:STRING="-DAL_LIBTYPE_STATIC -DGLEW_STATIC" \
-DCMAKE_TOOLCHAIN_FILE=###PATH_TO_MXE###/usr/i686-pc-mingw32/share/cmake/mxe-conf.cmake .
Don't forget to replace ###PATH_TO_MXE###
with your actual directory containing MXE.
$ make
If you installed "Wine", you can check if the executable is ok on your Linux machine, too:
$ wine ./bin/Ununoctium.exe