[Development] Building a module on Mac with Qt4

Laszlo Papp lpapp at kde.org
Mon May 14 22:58:31 CEST 2012


Hi,

I have been trying to build a module on Mac with Qt4 in mind, but I am
facing certain issues. There are essentially two qmake functions I use
in the build system from the mkspecs/features/qt_functions.prf file.

1) qtLibraryTarget: this generates the TARGET, as in: mac:RET =
$$member(LIBRARY_NAME, 0)_debug. OK, cool.

2) The foobar.prf file tries to invoke this: qtAddLibrary(myModule).
Now this is not so cool in the current construction. This enters the
"CONFIG(qt_framework, qt_framework|qt_no_framework) { #forced" branch
for some reasons in the current situation returning
"-framework$${LIB_NAME}" which I am unsure is something I would like
to.

I would like to get the examples, tests and so forth built on Mac
which reside inside the same repository, so this is an "in-project"
build. Taking further looks at the internal of the qtAddLibrary
method, I can understand why this works fine for Windows, but not
really for Mac.

What is the supposed way of building the "in-project" examples, tests
and so forth on Mac ? Shall I get a $projectroot/src/libFoo.framework
generated or just $projectroot/src/libFoo_debug.dylib and so forth as
this seems to be the case now ? I think perhaps framework generation
might not be strictly needed for an in-project build, but I am
essentially just speculating.

There is a branch in that method which is entered in case Windows, but
not in case Mac:

    isEmpty(LINKAGE) {
       if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
           win32:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}d
           mac:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}_debug
       }
       isEmpty(LINKAGE):LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}
    }

Could someone please help me out with this who has Qt4 and Mac
building experience ? Thanks a lot in advance!

Best Regards,
Laszlo Papp



More information about the Development mailing list