summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/qt_functions.prf
blob: 3f84f42c5fa33f3e2fa982871fdd81167188bddc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
defineReplace(qtLibraryTarget) {
   unset(LIBRARY_NAME)
   LIBRARY_NAME = $$1
   mac:!static:contains(QT_CONFIG, qt_framework) {
      QMAKE_FRAMEWORK_BUNDLE_NAME = $$LIBRARY_NAME
      export(QMAKE_FRAMEWORK_BUNDLE_NAME)
   }
   contains(TEMPLATE, .*lib):CONFIG(debug, debug|release) {
      !debug_and_release|build_pass {
          mac:RET = $$member(LIBRARY_NAME, 0)_debug
   	      else:win32:RET = $$member(LIBRARY_NAME, 0)d
      }
   }
   isEmpty(RET):RET = $$LIBRARY_NAME
   return($$RET)
}

defineTest(qtAddLibrary) {
    INCLUDEPATH -= $$QMAKE_INCDIR_QT/$$1
    INCLUDEPATH = $$QMAKE_INCDIR_QT/$$1 $$INCLUDEPATH

    LIB_NAME = $$1
    unset(LINKAGE)
    mac {
       CONFIG(qt_framework, qt_framework|qt_no_framework) { #forced
          QMAKE_FRAMEWORKPATH *= $${QMAKE_LIBDIR_QT}
          FRAMEWORK_INCLUDE = $$QMAKE_LIBDIR_QT/$${LIB_NAME}.framework/Headers
          !qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) {
             INCLUDEPATH -= $$FRAMEWORK_INCLUDE
             INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
           }
           LINKAGE = -framework $${LIB_NAME}$${QT_LIBINFIX}
        } else:!qt_no_framework { #detection
           for(frmwrk_dir, $$list($$QMAKE_LIBDIR_QT $$QMAKE_LIBDIR $$(DYLD_FRAMEWORK_PATH) /Library/Frameworks)) {
       	      exists($${frmwrk_dir}/$${LIB_NAME}.framework) {
                QMAKE_FRAMEWORKPATH *= $${frmwrk_dir}
    	        FRAMEWORK_INCLUDE = $$frmwrk_dir/$${LIB_NAME}.framework/Headers
    	        !qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) {
    	          INCLUDEPATH -= $$FRAMEWORK_INCLUDE
    	          INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
                }
    	        LINKAGE = -framework $${LIB_NAME}
       	        break()
              }
           }
       }
    }
    symbian {
        isEqual(LIB_NAME, QtGui) {
            # Needed for #include <QtGui> because qs60mainapplication.h includes aknapp.h
            INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE
        }
        isEqual(LIB_NAME, QtWebKit) {
            # Needed for #include <QtXmlPatterns/QtXmlPatterns> because relative inclusion problem in toolchain
            INCLUDEPATH *= $$QMAKE_INCDIR_QT/QtXmlPatterns
        }
    }
    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}
    }
    !isEmpty(QMAKE_LSB) {
        QMAKE_LFLAGS *= --lsb-libpath=$$$$QMAKE_LIBDIR_QT
        QMAKE_LFLAGS *= -L/opt/lsb/lib
        QMAKE_LFLAGS *= --lsb-shared-libs=$${LIB_NAME}$${QT_LIBINFIX}
    }
    LIBS += $$LINKAGE
    export(LIBS)
    export(INCLUDEPATH)
    export(QMAKE_FRAMEWORKPATH)
    export(QMAKE_LFLAGS)
    return(true)
}