Wednesday, February 11, 2009

Building programs with the SDK

The numerous Symbian SDKs share a
special build system developed by
Symbian for the use specifically with
the SDK. Some of the Symbian IDEs
build on top of it, in order to provide
integration with the SDK. C++BuilderX in particular integrates with the default
build system very well. Although there exist alternative ways
to build things for Symbian (as the
Rudolf König SDK on Unix using plain
GNU Makefile), the Symbian build
system is somewhat standard in the
Symbian C++ world. So I believe that it must be known by every Symbian C++
programmer and I will teach you how
to use and develop applications with it. A Symbian application source usually
stores, in a directory named 'group', the
file 'bld.inf' and one or more files with
extension '.mmp'. You define the build
for your Symbian application by writing b l d . i n f and at least one p r o j e c t . mm p . Then you process these files with a tool named
'bldmake' and will obtain a batch file
('ABLD.BAT') and some makefiles that
will build the application for you. This tool exists mainly because a
Symbian application is usually built for
many platforms: the emulator, using a
Microsoft X86 compiler, as well as the
real device using a gcc-derived ARM
compiler. The b l d m a k e saves you from writing specially crafted makefiles
for these compilers and make utilities;
also it allows for building many targets
with just a single command. In fact, 'bldmake' is quite easy to use IF
you accept the way it works. If you
don't, you will suffer endless
nightmares in order to build things the
way you want. Another drawback is
the fact that it is somewhat slow, so you have to compile, build and start the
emulator, and always wait some time
in the middle of the process. Let's explain how it works with an
example. Open a command line prompt,
and after changing to the directory
containing the b l d . i n f , t y p e : > b l d m a k e b l d f i l e s Of course, you must have the PATH set
correctly for the installation of the SDK
you are using. This command will look
for the b l d . i n f , process it and the related * . mm p , then generate a BATCH file named A B L D . B A T . Now you have all you need to build your
applications. Simply type: > a b l d b u i l d This will build your application in all the
available flavors. Well, in fact you are
building eight (!) different binaries. Note
that the target files are stored in a very
deep directory structure, and you are
building both in debug and release versions for WINS (windows), ARM4
(plain arm), ARMI (speed optimized
arm), THUMB (size optimized ARM)! But
you can choose to build for only one
target, and since it take less time, you
usually build ONLY for one version of one target. For example, to build for the
emulator only in the debug version, or
for the device, optimized for size, in
release version, you type: > a b l d b u i l d w i n s u d e b > a b l d b u i n d t h u m b u r e l Building for Windows is enough to start
the emulator and run the application in
the emulated environment. Application
files are compiled and placed straight
where the emulator can run it: no need
to copy them in the right location. But for real devices, you have to pack
everything in a . s i s file for installation, send it to the phone and
install the application. You are required
to write a . p k g file to describe the installer, and then create it with: > m a k e s i s f i l e . p k g References:
BldMake
ABLD

Submenu
2.1 Binary Files
2.2 Source Files
2.3 The build process
2.4 The .mmp
2.5 The AIF
2.6 Create an installer

Thursday, January 22, 2009

Installing Microsoft tools

Note: we will choose special installation
directories (not the default ones!) in
order to prevent some problems which
can arise if we use the installation
directories containing spaces in file
name (that is the case if we stick with the default suggestion).
Run the installer VCToolkitSetup.exe.
Since installation path containing spaces
can generate problems, I will
recommend that you to install it to a
directory without spaces in the name. Also installing in drives different from C:
can give you some problems, so I
recommend installing it in: C : \ S y m b i a n \ M S D E V This will create c:\Symbian\MSDEV\bin
(and other directories).
Now we can install the debugging
tools, running d b g _ x 8 6 _ x . y . e x e . This installer won't create ANY bin
subdirectories, placing the cdb.exe
(required for the debugging support) in
the top level of the installation
directory. So I suggest you to choose,
(in order to have all the required tools in the same place), this one: C : \ S y m b i a n \ M S D E V \ b i n Now you can install n m a k e , executing nmake15.exe: it will
decompress n m a k e . e x e and n a m a k e . e r r . Copy both of them to C : \ S y m b i a n \ M S D E V \ b i n The next step is to copy l i b . e x e and d u m p b i n . e x e to: C : \ S y m b i a n \ M S D E V \ b i n Now you have to add, to the system (or
user) path, the directory C : \ S y m b i a n \ M S D E V \ b i n . To do so, go to the control panel, choose
system, select advanced and click on
the button 'Environment Variables'.
Depending on your locale, icons and
option names will be translated in your
language. Now you have a dialog. Choose in the System Panel the entry
'PATH' and edit it by double clicking. At
the beginning add C : \ S y m b i a n \ M S D E V \ b i n ; . Note the ';' at the end, it is essential to separate
things. If you forget it, things simply
won't work. As a check, open a
command prompt and type 'nmake'. If
you get 'command not found' or
equivalent, you made a mistake in configuring the path. NOTE: if you get
'makefile not found' or similar, then you
are right: nmake is working (only it
does not find a makefile, but at this
stage it is not supposed to do so).
Congratulations! You have installed the required Microsoft tools for the Symbian
SDK.