QtNX on Mac OS X - nearly there

Posted by George Wright Tue, 08 Jan 2008 07:41:00 GMT

I must say that I’m very impressed with Trolltech’s attention to detail for their cross platform work; qtnx compiled (almost) without a hitch on OS X. After hacking around a few build system problems and linking issues, I managed to get qtnx to compile and link (it took ~5 minutes!), producing this particularly nice result:


QtNX on 10.4.11 (Intel)

I’m having a bit of trouble with working out how to create a sensible buildsystem for the Mac. If anyone’s got any experience with qmake on OS X then please drop me a line; in particular, I’m looking out for ways in which qmake can define what platform I’m on so I can have #ifdef’d sections of code for each platform, as well as using things like pkg-config on platforms where it exists and whatever equivalent there is on OS X. In fact, hooking qmake into Xcode for this could be ideal.

I haven’t tested if this actually connects yet; I haven’t got round to compiling the open source NoMachine dependencies (nxproxy, nxssh, nxcompsh) but it shouldn’t be too hard to get it all working nicely (I hope!).

Posted in  | 8 comments

Comments

  1. Johan Thelin said about 1 hour later:

    You can always use the name of the current mkspec (for QMake) as a conditioner for your build, e.g:

    mac-g++ { something; } !mac-g++ { something else; }

    Note! The mkspec is probably not called mac-g++, you have to check for the real name in the $QTDIR/mkspecs directory.

  2. Kevin Krammer said about 5 hours later:

    See QMake’s scope feature

    http://doc.trolltech.com/4.3/qmake-advanced-usage.html#scopes

  3. Max Howell said about 6 hours later:

    Us here at Last.fm must be the kings of cross platform qmake usage. Feel free to send me a mail.

  4. Tanner Lovelace said about 9 hours later:

    Pardon me for asking, but are you determined to use QMake? I just ask because everything you list (#ifdefed sections for different platforms, pkg-config, and XCode integration) all work with CMake (including the KDE build). I can understand, and totally respect, if you want to stay with QMake and not make CMake a requirement, but I just wanted to mention it because it could easily do all of that.

  5. Kevin Kofler said about 11 hours later:

    The correct target names are macx-* (there’s macx-g++, macx-icc, macx-pbuilder, macx-xcode and macx-xlc, you can use macx-* to match them all). There’s also darwin-* for X11 on OS X, this is not officially supported by Trolltech (but projects like Fink have patches to support that target).

    But to #ifdef code in your source code, the best is probably to use the compiler predefines (i.e. APPLE) or the macros Qt defines for you (e.g. QWS_MAC, QOSMAC). Using QWS_MAC is probably the best solution if you want the code to be used only with native Qt/Mac, not Qt/X11.

  6. Kevin Kofler said about 11 hours later:

    Arrgh, my underscores got mangled. That’ll teach me not to preview and not to read the markup help. ;-)

    But to #ifdef code in your source code, the best is probably to use the compiler predefines (i.e. __APPLE__) or the macros Qt defines for you (e.g. Q_WS_MAC, Q_OS_MAC). Using Q_WS_MAC is probably the best solution if you want the code to be used only with native Qt/Mac, not Qt/X11.

  7. Benjamin Sergeant said about 12 hours later:

    You can also do that:

    UNAME = $$system(uname)
    contains( UNAME, (Darwin) ): QMAKE_CXXFLAGS_DEBUG += whatever you like
    
  8. Repre Hendor said about 17 hours later:

    Do you know about EPM?

    With EPM you maintain one source file to control the building of native packages for Linux (.deb, .rpm, .tgz) as well as Mac OS X (.dmg), IRIX, *BSD, AIX, and what have you.

    See also EPM docu.

(leave url/email »)

   Comment Markup Help Preview comment