Open main menu

Difference between revisions of "Compiling ScummVM/Windows CE"

Detailed ce port build instructions
 
(Detailed ce port build instructions)
Line 1: Line 1:
== Compiling ScummVM for Windows Mobile ==
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.<br/>
Still reading? Good :-)<br/>
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 :-)


From Microsoft's [http://www.microsoft.com/windowsmobile/about/faq.mspx Windows Mobile FAQ]: "A Windows Mobile powered device is a handheld device powered by the Windows Mobile platform. It allows you to retrieve e-mail, keep track of your schedule and your contacts, browse the Internet, send and receive text messages, read and compose Microsoft Word Mobile files, make Microsoft Excel Mobile charts, and view Microsoft PowerPoint presentations.* Windows Mobile is a rich platform that allows you to download third-party software to customize your device. You can download e-books, games, maps, business software, and more."
== Get your gear together ==


More information can be found in the [http://www.microsoft.com/windowsmobile/default.mspx Windows Mobile homepage] as well as the [http://msdn.microsoft.com/mobility/windowsmobile/default.aspx Windows Mobile Developer Center].
The first thing you need to do is decide on the compiler and grab all required
libraries.


=== Compilers ===


== Things needed ==
Versions before 0.9.0 use the Embedded Visual C developement environment.
More specifically you can use either
[http://www.microsoft.com/downloads/details.aspx?familyid=f663bf48-31ee-4cbe-aac5-0affd5fb27dd&displaylang=en evc3] or
[http://www.microsoft.com/downloads/details.aspx?familyid=4a4ed1f4-91d3-4dbe-986e-a812984318e5&displaylang=en evc4]
for those versions.
Most of the following instructions for building with VS2005 adhere to these builds as well.


=== Visual Studio 2005 ===
For the current 0.9.0 branch and the trunk there are two ways to compile:
There exist several versions of Visual Studio 2005. A feature comparison can be found here:


http://msdn.microsoft.com/vstudio/products/compare/default.aspx
* Using [http://msdn.microsoft.com/windowsmobile/downloads/tools/install/default.aspx Microsoft Visual Studio 2005], or
* Using the [http://download.videolan.org/pub/testing/wince/ Windows CE GCC cross compiler] developed by the [http://www.videolan.org/vlc/ VLC] team.


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 [http://msdn.microsoft.com/vstudio/express/ Visual Studio Express] does
not support Windows CE.


You can obtain the free Express version of VS2005 here:
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.


http://msdn.microsoft.com/vstudio/express/default.aspx
=== Libraries ===


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


=== Windows Mobile programming environment ===
* [http://flac.sourceforge.net/ FLAC] 1.1.0
: Lossless audio compression for sound files.
* [http://libmpeg2.sourceforge.net/ mpeg2dec] 0.4.0
: Decoding of MPEG-2 video content.
* [http://www.xiph.org/vorbis/ Tremor]
: Fixed point implementation of the OGG Vorbis algorithm, also for sound files.
* [http://www.underbit.com/products/mad/ mad] 0.14.2b
: MP3 sound files.
* [http://www.libsdl.org/ SDL] 1.2.6
: Handles all backend screen drawing.
* [http://www.zlib.net/ zlib] 1.2.1
: Compressing/Decompressing files.


Instructions for setting up a programming environment for the Windows Mobile platform can be found from this [http://msdn.microsoft.com/mobility/windowsmobile/howto/windowsmobile5/install/default.aspx installation instructions page]
[[Arisme]] has done and excellent job in porting all these libraries to Windows CE,
along the process of porting ScummVM itself.


You'll need:
For Microsoft toolchain builds, you can find all of them on [http://arisme.free.fr/ports/ his webpage]
* [http://www.microsoft.com/windowsmobile/downloads/activesync41.mspx ActiveSync 4.1]
both in source/patch form and as pre-built binaries.
* [http://www.microsoft.com/downloads/details.aspx?familyid=83A52AF2-F524-4EC5-9155-717CBE5D25ED&displaylang=en Windows Mobile 5.0 SDK for Pocket PC] OR
Usually, you don't need to rebuild these libraries so we recommend to use
* [http://www.microsoft.com/downloads/details.aspx?familyid=DC6C00CB-738A-4B97-8910-5CD29AB5F8D9&displaylang=en Windows Mobile 5.0 SDK for Smartphone]
the binaries.
To relieve you even further from the hassle, we have prepared a precompiled lib/header
pack which is available [http://users.uoa.gr/~knakos/scummvm/libraries/vs2005_libpack.zip 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 [http://users.uoa.gr/~knakos/scummvm/libraries/ 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 [http://users.uoa.gr/~knakos/scummvm/libraries/wince-gcc-libs.tar.bz2 here].


If you're unsure about which SDK you need, read [http://www.microsoft.com/windowsmobile/about/faq.mspx#2 this question in the FAQ]
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 ==


=== Libraries needed ===
* 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.


[TODO]
* 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.<br/>
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.)<br/>
Another point to note is that evc4 can "import" evc3 project files
and VS2005 can import project files from both.
 
* Build
Press F7 :-)<br/>
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 [http://forums.scummvm.org/viewforum.php?f=6 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
[http://users.uoa.gr/~knakos/scummvm/libraries/tremor_2006_10_29.tar.bz2 here].
Download the diffs from [http://users.uoa.gr/~knakos/scummvm/libraries/ 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.
116

edits