I was going to write this long rant about how much Symbian’s build variant system sucks ass. But why bother, it’s not like it’s going to matter. So I’ll just write a short version instead.
When building a project is quite common to have to accommodate for different things like architectures, models, supported functions. Maybe even build one possibly restricted evaluation version of the software and one full version. In the unix world autoconf as ended up being the standard tool for this. Configuring, building and installing a program is usually the following simple three steps:
$ ./configure $ make $ sudo make install
./configure script checks that the system contains the necessary functions and defines different constants so that it’s possible to accommodate for minor differences between the different unix flavours in the code.
It’s often also possible to affect what’s being built by supplying options to the configure script, like
./configure --with-mysql to include mysql support. This is working quite well.
Unfortunately Symbian’s build system seems to be mostly influenced by horrible windows ideas. Because it’s completely lacking something like this, it supports something called “build variants” which is a huge joke. To use it one has to add a
.hrh file to the project, let’s call it
BuildConfig.hrh, in this file one can have
#define:s for different configurations of the software. Before building one has to edit that file and make sure that it represents the desired configuration, by commenting out unwanted features (represented by define statements) and uncomment wanted ones.
This is, however, not enough. One then has to create a directory in the
epoc32\tools directory called
variant and inside that directory create a text file named
variant.cfg file should contain the full path to the above created
BuildConfig.hrh file. Yes you read it correctly, the full path. Talk about a really portable solution…
When this is done, the bldmake and abld commands will find the
variant.cfg file and the defines in the
BuildConfig.hrh file will be available during the whole build process, so they can be used even in the mmp file like this
TARGET foobar.app // ...
#if defined(SOME_DEFINE) SOURCE foobar1.cpp #endif #if defined(CRIPPLED_VERSION) SOURCE foobar2.cpp #endif
So now when I distribute the code for my application each person who wants to build it has to copy the supplied variant.cfg into their Symbian SDK directory and replace the path in the file with the correct path for their system. Way to go Symbian, that’s a great solution!
Please please change so that the bldmake and abld commands also look for a variant.cfg file next to the bld.inf file and for gods sake support relative paths.