Symbian C++ Programming Tutorial > 2. Building programs with the SDK

2. 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 bld.inf and at least one project.mmp. 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 bldmake 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 bld.inf, type:

     > bldmake bldfiles

Of course, you must have the PATH set correctly for the installation of the SDK you are using. This command will look for the bld.inf, process it and the related *.mmp, then generate a BATCH file named ABLD.BAT. Now you have all you need to build your applications. Simply type:

     > abld build

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:

     > abld build wins udeb
     > abld buind thumb urel

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 .sis file for installation, send it to the phone and install the application. You are required to write a .pkg file to describe the installer, and then create it with:

     > makesis file.pkg

References:

Submenu

Symbian C++ Programming Tutorial