Cross-compiling
Cross-compiling means to build executables for a different OS or machine, and is accomplished with the target=... argument to scons. If you're using a normal cross-compiling build of gcc, then you will want to pass the target triple. Otherwise the gcc/cc etc in your $PATH should be appropriate for the target and you can write e.g. target=win32.
Unix to Windows[edit]
mxe is an awesome tool to set up a cross-compiler from Unix to Windows with a single command. It automatically downloads and builds a mingw-w64 build of gcc, and can also build a large array of common libraries and packages.
Install toolchain:
# Build gcc cross-compiling toolchain cd /place/mxe/here git clone https://github.com/mxe/mxe.git cd mxe # The default target is i686-w64-mingw32.static # libffi is an extra dependency FB uses by default; add CFLAGS=-DDISABLE_FFI to the 'make' line for the FB build below to skip it. make gcc libffi PATH=$PATH:/place/mxe/here/mxe/usr/bin # Build FB cross-compiling toolchain # This assumes you already have a copy of FB installed somewhere; it augments it with libraries to target Windows. cd /path/to/fbc/source/ make TARGET=i686-w64-mingw32.static prefix=/path/to/fbc/install rtlib gfxlib2 install-rtlib install-gfxlib2
Compile:
PATH=$PATH:/place/mxe/here/mxe/usr/bin # Assuming fbc is already in your PATH. You don't need a separate fbc install to target Windows! scons target=i686-w64-mingw32.static -j4 # other arguments as desired
Although mxe can compile SDL and SDL_mixer, you don't need to, since we include the .dlls along with the source, and FB has translations of the include files. If you do want to re-compile SDL_mixer.dll, see Windows compiling requirements#SDL_mixer.dll for details.
Note: mxe has i686-w64-mingw32.static and i686-w64-mingw32.shared targets. The shared one will create .exes dependent on libwinpthread-1.dll, so use the static one. It will not statically link SDL or SDL_mixer.