开发者

Compiling multi-platform Qt application for Symbian

I'm developing an Qt for Symbian application. I have to use certain platform specific APIs that are only available on certain S60 version. For example:

-S60 3rd edition FP1 libs: S60_common_lib, S60_3rd_ed_lib

-S60 3rd edition FP2 libs: S60_common_lib, S60_3rd_ed_lib, Symbian_common_lib

-S60 5th edition libs: S60_common_lib, S60_5th_ed_lib, Symbian_common_lib

-Symbian^3 libs: S60_5th_ed_lib, Symbian3_lib, Symbian_common_lib

As you can see, certain libraries are shared between multiple platforms. Currently, I have to compile whole project multiple times in order to get a separate .exe, resources etc. for all different S60 platforms. I'm doing this by defining an identifier for each platform in the pro file. For example:

# symbian 3
DEFINES += symbian_3_build
symbian:LIBS += # ...
# S60 3.1
# DEFINES += s60_fp1
# LIBS...

And in actual code I have something like:

#ifdef symbian_3_build
    #include <some_s3_header.h>
#elseif s60_fp1
    #include <some_fp1_header.h>
#endif

So my questions are:

  1. Is this the only way to compile multiplatform Qt for Symbian application (e.g. is there any way to get it working with just one exe)?

  2. I'm using Qt creator. After compiling for one platform I copy the resource files (.exe, .rsc, _reg.rsc) from epoc folder before compiling to next platform (rebuild overwirites old files). After all version have been c开发者_StackOverflow社区ompiled and collected to specific location, I'll create create a single sis file, which installs different version based on the platform. This process is very prone for errors. Is there any better way to do this?

Thanks.


Is this the only way to compile multiplatform Qt for Symbian application (e.g. is there any way to get it working with just one exe)?

It really depends on what's the greatest common denominator of your configurations.

At least you don't have to modify the .pro file for each configuration. Just supply additional CONFIG values on the qmake command line, e.g. qmake CONFIG+=symbian3 and then have symbian3 { ... } blocks in .pro file for symbian3-specific parts.

If you want a single binary and the differences are on binary compatibility level, e.g. you are linking to functions in DLLs that are not present on some target, you can separate these function calls to an adapter component of your own that loads the required libraries dynamically with native RLibrary::Load(), RLibrary::Lookup() etc., based on the underlying platform version. One way to get the platform version at runtime is QSysInfo::s60Version().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜