[Qt5-feedback] What is the Qt view of targets, and is it the same as QtSDKs ?
BRM
bm_witness at yahoo.com
Wed Jun 15 15:32:01 CEST 2011
>From: Charley Bay <charleyb123 at gmail.com>
> <snip, build hacks, maybe a few main branches>
>
> This is a very real problem. I would very much like to see discussion on this
> topic (rich targets for differently configured platforms as handled by the
>build
>
> system, as opposed to historic "#if Q_OS" hacks.)
>
> Fundamentally, the "#if Q_OS" hacks won't be sufficient going forward IMHO
> because they logically represent the "flat list" of resolved states after a
> combinatorial explosion of options (see list below). It's too painful to
> maintain that flat list, especially since it should be logically "sparse" given
>
> the set of *actual* targets which are relevant to the developer (a rich/large
> number of targets, but we do not target all possible combinations).
I have to quite disagree. The #if Q_OS stuff compliments the build system and is
quite required.
For example, I have an API I wrote for logging data. This little API supports
syslog on Non-windows platforms, standard file I/O on all platforms, a
shared-read file I/O on Windows, and Windows Event Log (on Windows).
This is done mostly transparent to the program. That is, the program sees a
small API interface, that then loads the different "modules" in the background
based on the configuration. So the little API needs to include all the various
headers regardless of the platform in the header files, but only actually
include the ones relevant for the build target during compilation. That aspect
cannot be handled by the build system. What is handled by the build system is
that the various implementation files for the backends are only built as
appropriate for the build target - so the Windows Event Log support is not built
under Linux, nor is syslog support built under Windows.
As with any tool, it can - of course - be misused; but it has very appropriate
and valid uses that are not possible using other methods.
And, I would much rather test for a Qt Define like Q_OS_WIN32 instead of having
to test for compiler and target specific defines (e.g. _MSC_VER and _WIN32). It
makes that kind of stuff so much more legible and straight forward.
Ben
More information about the Qt5-feedback
mailing list