[PyQt] Platforms directive or tags, or both?

Phil Thompson phil at riverbankcomputing.com
Thu Oct 18 21:57:58 BST 2012


On Thu, 18 Oct 2012 11:58:59 -0600, Larry Shaffer <larrys at dakotacarto.com>
wrote:
> Hi Phil,
> 
> Thanks for the reply.
> 
> On Thu, Oct 18, 2012 at 10:03 AM, Phil Thompson
> <phil at riverbankcomputing.com> wrote:
>> On Thu, 18 Oct 2012 09:42:30 -0600, Larry Shaffer
>> <larrys at dakotacarto.com>
>> wrote:
>>> Hi,
>>>
>>> I'm working on a fix for Mac (for QGIS project) where size_t needs a
>>> different typedef in a sip file than other platforms.
>>>
>>> See: http://hub.qgis.org/issues/6505
>>>
>>> The build system is CMake that passes -t WS_MACX from the found PyQt4
>>> config on the command line. So, I wrote a simple:
>>>
>>> %If (WS_MACX)
>>> typedef unsigned long size_t;
>>> %End
>>> %If (!WS_MACX)
>>> typedef unsigned int size_t;
>>> %End
>>>
>>> When I tried to enable the platform with  %Platforms {WS_MACX} I was
>>> presented with an error noting it had already been defined (or
>>> enabled), presumably because of the existing tag. Does the Platforms
>>> directive need to be used if already enabling a platform via -t on the
>>> command line?
>>
>> %Platforms defines the platform, it doesn't enable it - you just need
to
>> use it as you have done and pass the right -t flag.
> 
> Ok.
> 
>>> Also, I would either like to know what the other platforms' (Win,
>>> Linux, etc.) tags are expected to be and whether those can be counted
>>> on being consistent, or whether I can just use the CMake platform
>>> variables to pass in known, valid tags (WIN32, UNIX, APPLE) to use in
>>> sip files.
>>
>> Platforms (and tags) are a SIP specific thing.
> 
> What I was suggesting is this:
> 
> %Platforms {UNIX_NOTAPPLE APPLE WIN32}
> %If (APPLE)
> typedef unsigned long size_t;
> %End
> %If (!APPLE)
> typedef unsigned int size_t;
> %End
> 
> where the generic platform tags are generated by CMake, before being
> concatenated to sip command line options:
> 
> SET(_sip_tags)
> IF (APPLE)
>     LIST(APPEND _sip_tags -t APPLE)
> ELSEIF (UNIX)
>     LIST(APPEND _sip_tags -t UNIX_NOTAPPLE)
> ELSEIF (WIN32)
>     LIST(APPEND _sip_tags -t WIN32)
> ENDIF (APPLE)
> 
> This would bypass the PyQt tags and use a set of
> already-known-to-be-valid platform tags from CMake. This appears for
> work for the Mac issue, but I'm asking if it is a proper use of the
> Platforms directive and tags. ??

That's fine, though confusing as it repeats what is already provided.

> Lastly, if what I have done is OK, do I need to define the other
> platforms (UNIX_NOTAPPLE, WIN32) in the Platforms directive if I am
> only concerned with whether or not APPLE is enabled in the IF
> directives, i.e. can I just do the following and have it work on
> non-APPLE platforms?
> 
> %Platforms {APPLE}
> %If (APPLE)
> typedef unsigned long size_t;
> %End
> %If (!APPLE)
> typedef unsigned int size_t;
> %End

-t tags that don't correspond to a Timeline, Platform or Feature are
ignored (I think).

Phil


More information about the PyQt mailing list