Difference between revisions of "Compiling ScummVM/Windows CE"

From ScummVM :: Wiki
Jump to navigation Jump to search
m (Compiling/ScummVM Windows CE moved to Compiling ScummVM/Windows CE: oops... Jubanka, don't kill me!)
m (fixing wikilink)
Line 66: Line 66:
: Compressing/Decompressing files.
: Compressing/Decompressing files.

[[Arisme]] has done and excellent job in porting all these libraries to Windows CE,
[[user:Arisme|Arisme]] has done and excellent job in porting all these libraries to Windows CE,
along the process of porting ScummVM itself.
along the process of porting ScummVM itself.

Revision as of 23:16, 20 January 2007

So you want to roll your own binary for the ScummVM Windows CE port? The first thing to ask yourself is do you really need to compile it? The official PocketScumm binaries are "good enough" for more than the average user. Also, bear in mind that the compilation procedure is seldom as simple as unpack-build and that, probably, you'll have to know your way around projects, makefiles and editing appropriately the source files.
Still reading? Good :-)
Many people are put off by the sheer volume of work which has to take place in order to get a successful build. Things are not that bad though as, hopefully, this document tries to describe. More than often you may find that once you set up you build environment right, there's only minimal work to be done to build any version of PocketScumm. Alright, ready? Let's go :-)

Get your gear together

The first thing you need to do is decide on the compiler and grab all required libraries.


Versions before 0.9.0 use the Embedded Visual C developement environment. More specifically you can use either evc3 or evc4 for those versions. Most of the following instructions for building with VS2005 adhere to these builds as well.

For the current 0.9.0 branch and the trunk there are two ways to compile:

The former is used for building the 0.9.0 branch. The migration from evc to VS is mandatory, as C++ templates introduced through core code evolution in the branch cause the evc to compilers to crash with 'Internal compiler error'. Unfortunately the migration is not completely successful as VS2005 (no service packs) introduces incorrect optimization in release builds, leading to workarounds in the source and compilation of specific files with no optimizations at all. Also, note that Visual Studio Express does not support Windows CE.

The latter method (GCC) is slated to be used for building PocketScumm, starting with the next major release (0.10.0). As such, the trunk currently contains only the necessary Makefile for building with GCC. It does not contain any VS2005 project files, athough we may in the future opt to also provide project files for it as well.


ScummVM depends on quite a few external libraries to handle content. These are:

Lossless audio compression for sound files.
Decoding of MPEG-2 video content.
Fixed point implementation of the OGG Vorbis algorithm, also for sound files.
MP3 sound files.
Handles all backend screen drawing.
Compressing/Decompressing files.

Arisme has done and excellent job in porting all these libraries to Windows CE, along the process of porting ScummVM itself.

For Microsoft toolchain builds, you can find all of them on his webpage both in source/patch form and as pre-built binaries. Usually, you don't need to rebuild these libraries so we recommend to use the binaries. To relieve you even further from the hassle, we have prepared a precompiled lib/header pack which is available here. This package contains all that is peripheral to ScummVM and is required for builds.

For GCC toolchain builds, the libraries need to be further patched in order to successfully compile. The patches are available here and are accumulated. This means that are direct patches to the original source versions of the libraries, that they include Arisme's patches and are not incremental to them. A precompiled lib/header pack is available for GCC builds as well and you can find it right here.

Please note that many of those libraries have been officially ported to winCE after the work done by Arisme or, newer versions are available for them. We generally cannot comment on how well they will work with ScummVM. The more adventurous of you may want to give them a shot, but we find that these work well enough for our purposes.

Compiling using Microsoft tools

  • Build libraries from source

If you downloaded prebuilt libraries, you may skip this step. We will not document the process of compiling individual libraries. Generally, you should download the source and patch from Arisme's site, perform the patch and use the included project files to build.

  • Place library files in appropriate places.

You need two things: The library header files (*.h) and the actual libraries (*.lib). There's no place in particular where it would be good to put these files. Just make sure that the VS compiler's additional include directories option points additionally to the directory (-ies) where your library header files live, and the linker's additional library directories to the *.lib files directory (-ies). For ScummVM 0.9.1, the VS2005 files assume that the directories "lib" and "libinclude" are situated in "backends/wince/missing".

  • Open the Project

For versions older than 0.9.1, project files can be found in directories "dists/msevc3" and "dists/msevc4" of the source tree. For 0.9.1 the project files are in "dists/msvc8-wince". Open "PocketScumm.vcw" or "PocketScumm.sln", whatever is applicable. In the workspace that opens you should be able to see several projects, the main one being the "scummvm" project and the others being the scummvm engines which are built as libraries.
A common problem which occurs here stems from the requirement that the project files have to be in CR/LF format, or else the tools will error out with various errors while opening them. (This unfortunately happens as tagging usually takes place on a non-Windows machine ( :-) ), plus some shortcomings of CVS. Hopefully SVN remedies this.)
Another point to note is that evc4 can "import" evc3 project files and VS2005 can import project files from both.

  • Build

Press F7 :-)
This is not a fool proof procedure. You may get from zero fatal compilation errors to several thousand. Please be patient and try to make sense of what the tool is reporting. More than usual, the very first error the tool reports is the one you should attend to before re-trying the build. If you can't make heads or tails out of it, you may try asking for help in the forums, but *please* refrain yourself from asking if you don't know what you're doing here. The developers cannot be burdened by the task of answering questions for your specific build setup.

Compiling using the GCC toolchain

Assuming you have installed the toolchain in its default place

  • Build libraries from source

You may skip this step if you downloaded the prebuilt library package. Download the original library source tarball (those in Arisme's site are OK). As an exception, get the Tremor snapshot from here. Download the diffs from here and patch the libraries. You need to configure and make each library, except the SDL library which sports a custom (and lame :-) ) Makefile. Here are the typical parameters to the configure scripts:

  • FLAC:

CFLAGS="-D__stdcall= -D_WIN32_WCE=300 -I/usr/local/wince/cross-tools/include" LDFLAGS=-L/usr/local/wince/cross-tools/lib CC=arm-wince-pe-gcc ./configure --host=arm-wince-pe --target=arm-wince-pe --without-ogg --without-xmms -without-libiconv --without-id3lib

  • mad:

CFLAGS="-D__stdcall= -D_OFF_T_ -I/usr/local/wince/cross-tools/include" LDFLAGS=-L/usr/local/wince/cross-tools/lib CC=arm-wince-pe-gcc ./configure --host=arm-wince-pe --target=arm-wince-pe --disable-nls

  • mpeg2dec:

CFLAGS="-D__stdcall= -D_OFF_T_ -I/usr/local/wince/cross-tools/include" LDFLAGS=-L/usr/local/wince/cross-tools/lib CC=arm-wince-pe-gcc ./configure --host=arm-wince-pe --target=arm-wince-pe

  • Tremor:

CFLAGS="-D__stdcall= -D_OFF_T_ -I/usr/local/wince/cross-tools/include" LDFLAGS=-L/usr/local/wince/cross-tools/lib CC=arm-wince-pe-gcc ./autogen.sh --host=arm-wince-pe --target=arm-wince-pe

  • libz:

CFLAGS="-D__stdcall= -D_OFF_T_ -D_WIN32_WCE -D_MSC_VER=666" CC=arm-wince-pe-gcc AR="arm-wince-pe-ar cru" RANLIB=arm-wince-pe-ranlib ./configure --libdir=/usr/local/wince/cross-tools/lib --includedir=/usr/local/wince/cross-tools/include

You may also have to do some minor manual edits to the config.h files. libmad's one springs to mind, in which you have to undefine HAVE_STDINT_H

  • Place library files in appropriate places.

Take a look at the Makefile to check out where the headers and libs are expected. Currently they need to be under backends/platform/wince/libs/ in directories include and lib.

  • Build

cd into backends/platform/wince/ and type make dist.