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