Code Painters The Art of Coding

26Jul/102

Symbian: separate builds for different S60 editions

Symbian's build environment was never really my favorite one. Recently I was working on a project using different APIs on S60 3rd, 3rd FP1, 3rd FP2 and 5th editions. Typical Symbian project contains a single bld.inf file and a corresponding .mmp file, so it is not immediately obvious how to compile conditionally, based on exact S60 release you're targeting.

I've found a solution at Forum Nokia Wiki, but it requires adding a custom file to the SDK, I'm not really happy about it. However a closer look at the build process reveals that bld.inf is preprocessed using the following call:

cpp.EXE -undef -nostdinc -+  -I "C:\Symbian\9.2\S60_3rd_FP1\epoc32\include" -I .
-I "C:\Users\czajnik\work\test\TestApp\group\" 
-I "C:\Symbian\9.2\S60_3rd_FP1\epoc32\include\variant"
-include "C:\Symbian\9.2\S60_3rd_FP1\epoc32\include\variant\Symbian_OS_v9.2.hrh"
"C:\Users\czajnik\work\test\TestApp\group\BLD.INF"

The most important observation here is the inclusion of Symbian_OS_v9.2.hrh. Every SDK release comes with such a file, containing a bunch of #define macros denoting features available on a particular platform. With a little help from grep, sort, sed and diff I've eventually got the following bld.inf file:

PRJ_PLATFORMS
WINSCW ARMV5 GCCE

PRJ_MMPFILES
gnumakefile Icons_scalable_dc.mk

#ifdef SYMBIAN_C32_SERCOMMS_V2
TestApp_S60_5th.mmp
#else
#ifdef SYMBIAN_APPARC_APPINFO_CACHE
TestApp_S60_3rd_FP2.mmp
#else
#ifdef SYMBIAN_FLEXIBLE_ALARM
TestApp_S60_3rd_FP1.mmp
#else
TestApp_S60_3rd.mmp
#endif
#endif
#endif

Works like a charm 🙂

Share:
  • Facebook
  • Digg
  • del.icio.us
  • Twitter
  • LinkedIn
  • Google Bookmarks
  • Reddit
  • StumbleUpon
Tagged as: Leave a comment
Comments (2) Trackbacks (0)
  1. Kudos for creativity, but why not use the macros defined for you? For example:

    __SERIES60_30__: defined in S60 3rd Edition SDK;

    __SERIES60_31__: defined in S60 3rd Edition FP1 SDK;

    __S60_32__: defined in S60 3rd Edition FP2 SDK;

    __S60_50__: for the S60 5th Edition SDK.

  2. Well, as far as I know the macros you refer to are only available in the .h/.cpp files. Unfortunately those symbols are not available inside mmp files, nor bld.inf, niet even in rss files as far as I remember. I needed something working at mmp level, so I’m able to select the set of linked libraries based on the S60 edition.

    Sure, I may be terribly wrong here – if I messed up something and there’s an easier way, let me know! I’ll recheck anyway when I’m back from my holidays 🙂


Leave a comment

No trackbacks yet.