qtcreator.pri 6.41 KB
Newer Older
1 2 3
!isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included")
QTCREATOR_PRI_INCLUDED = 1

Eike Ziller's avatar
Eike Ziller committed
4 5
QTCREATOR_VERSION = 3.1.81
QTCREATOR_COMPAT_VERSION = 3.1.81
6
BINARY_ARTIFACTS_BRANCH = master
7

8 9 10
# enable c++11 on everything but mac/release (breaks 10.6)
!macx|CONFIG(debug, debug|release): CONFIG += c++11

11 12 13 14 15 16 17 18 19 20 21 22
isEqual(QT_MAJOR_VERSION, 5) {

defineReplace(cleanPath) {
    return($$clean_path($$1))
}

defineReplace(targetPath) {
    return($$shell_path($$1))
}

} else { # qt5

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36
defineReplace(cleanPath) {
    win32:1 ~= s|\\\\|/|g
    contains(1, ^/.*):pfx = /
    else:pfx =
    segs = $$split(1, /)
    out =
    for(seg, segs) {
        equals(seg, ..):out = $$member(out, 0, -2)
        else:!equals(seg, .):out += $$seg
    }
    return($$join(out, /, $$pfx))
}

defineReplace(targetPath) {
37
    return($$replace(1, /, $$QMAKE_DIR_SEP))
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
38
}
con's avatar
con committed
39

40 41
} # qt5

42 43 44 45 46 47 48 49 50 51 52 53 54
defineReplace(qtLibraryName) {
   unset(LIBRARY_NAME)
   LIBRARY_NAME = $$1
   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)
}

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
defineTest(minQtVersion) {
    maj = $$1
    min = $$2
    patch = $$3
    isEqual(QT_MAJOR_VERSION, $$maj) {
        isEqual(QT_MINOR_VERSION, $$min) {
            isEqual(QT_PATCH_VERSION, $$patch) {
                return(true)
            }
            greaterThan(QT_PATCH_VERSION, $$patch) {
                return(true)
            }
        }
        greaterThan(QT_MINOR_VERSION, $$min) {
            return(true)
        }
    }
72 73 74
    greaterThan(QT_MAJOR_VERSION, $$maj) {
        return(true)
    }
75 76 77
    return(false)
}

78 79 80 81 82 83 84 85 86
isEqual(QT_MAJOR_VERSION, 5) {

# For use in custom compilers which just copy files
defineReplace(stripSrcDir) {
    return($$relative_path($$absolute_path($$1, $$OUT_PWD), $$_PRO_FILE_PWD_))
}

} else { # qt5

87 88 89 90 91 92 93 94 95
# For use in custom compilers which just copy files
win32:i_flag = i
defineReplace(stripSrcDir) {
    win32 {
        !contains(1, ^.:.*):1 = $$OUT_PWD/$$1
    } else {
        !contains(1, ^/.*):1 = $$OUT_PWD/$$1
    }
    out = $$cleanPath($$1)
96
    out ~= s|^$$re_escape($$_PRO_FILE_PWD_/)||$$i_flag
97 98 99
    return($$out)
}

100 101
} # qt5

102 103
!isEmpty(BUILD_TESTS):TEST = 1

104 105
isEmpty(TEST):CONFIG(debug, debug|release) {
    !debug_and_release|build_pass {
con's avatar
con committed
106 107 108 109
        TEST = 1
    }
}

110
isEmpty(IDE_LIBRARY_BASENAME) {
111 112
    IDE_LIBRARY_BASENAME = lib
}
113

114 115 116
equals(TEST, 1) {
    QT +=testlib
    DEFINES += WITH_TESTS
con's avatar
con committed
117 118
}

119
IDE_SOURCE_TREE = $$PWD
120 121 122 123 124 125
isEmpty(IDE_BUILD_TREE) {
    sub_dir = $$_PRO_FILE_PWD_
    sub_dir ~= s,^$$re_escape($$PWD),,
    IDE_BUILD_TREE = $$cleanPath($$OUT_PWD)
    IDE_BUILD_TREE ~= s,$$re_escape($$sub_dir)$,,
}
126
IDE_APP_PATH = $$IDE_BUILD_TREE/bin
con's avatar
con committed
127
macx {
128
    IDE_APP_TARGET   = "Qt Creator"
129
    IDE_LIBRARY_PATH = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/PlugIns
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
130
    IDE_PLUGIN_PATH  = $$IDE_LIBRARY_PATH
131 132
    IDE_LIBEXEC_PATH = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/Resources
    IDE_DATA_PATH    = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/Resources
133
    IDE_DOC_PATH     = $$IDE_DATA_PATH/doc
134
    IDE_BIN_PATH     = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/MacOS
135
    copydata = 1
136
    !isEqual(QT_MAJOR_VERSION, 5) {
137 138 139 140
        # we use @rpath which is 10.5+
        # Qt5 doesn't support 10.5, and will set the minimum version to 10.6 or 10.7.
        QMAKE_CXXFLAGS *= -mmacosx-version-min=10.5
        QMAKE_LFLAGS *= -mmacosx-version-min=10.5
141
    }
con's avatar
con committed
142
} else {
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
143 144
    contains(TEMPLATE, vc.*):vcproj = 1
    IDE_APP_TARGET   = qtcreator
145
    IDE_LIBRARY_PATH = $$IDE_BUILD_TREE/$$IDE_LIBRARY_BASENAME/qtcreator
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
146
    IDE_PLUGIN_PATH  = $$IDE_LIBRARY_PATH/plugins
147
    IDE_LIBEXEC_PATH = $$IDE_APP_PATH # FIXME
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
148
    IDE_DATA_PATH    = $$IDE_BUILD_TREE/share/qtcreator
149
    IDE_DOC_PATH     = $$IDE_BUILD_TREE/share/doc/qtcreator
150
    IDE_BIN_PATH     = $$IDE_APP_PATH
151
    !isEqual(IDE_SOURCE_TREE, $$IDE_BUILD_TREE):copydata = 1
con's avatar
con committed
152 153 154
}

INCLUDEPATH += \
155
    $$IDE_BUILD_TREE/src \ # for <app/app_version.h>
con's avatar
con committed
156
    $$IDE_SOURCE_TREE/src/libs \
157 158
    $$IDE_SOURCE_TREE/tools

159
QTC_PLUGIN_DIRS = $$(QTC_PLUGIN_DIRS)
160
QTC_PLUGIN_DIRS += $$IDE_SOURCE_TREE/src/plugins
Eike Ziller's avatar
Eike Ziller committed
161
for(dir, QTC_PLUGIN_DIRS) {
162 163
    INCLUDEPATH += $$dir
}
con's avatar
con committed
164

165
CONFIG += depend_includepath
con's avatar
con committed
166 167

LIBS += -L$$IDE_LIBRARY_PATH
168

169 170 171 172 173 174
!isEmpty(vcproj) {
    DEFINES += IDE_LIBRARY_BASENAME=\"$$IDE_LIBRARY_BASENAME\"
} else {
    DEFINES += IDE_LIBRARY_BASENAME=\\\"$$IDE_LIBRARY_BASENAME\\\"
}

175
DEFINES += QT_CREATOR QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
176
!macx:DEFINES += QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_CONCATENATION
177

178
unix {
dt's avatar
dt committed
179 180
    CONFIG(debug, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/debug-shared
    CONFIG(release, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/release-shared
181

dt's avatar
dt committed
182 183
    CONFIG(debug, debug|release):MOC_DIR = $${OUT_PWD}/.moc/debug-shared
    CONFIG(release, debug|release):MOC_DIR = $${OUT_PWD}/.moc/release-shared
184

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
185 186
    RCC_DIR = $${OUT_PWD}/.rcc
    UI_DIR = $${OUT_PWD}/.uic
187
}
188

189 190 191
win32-msvc* { 
    #Don't warn about sprintf, fopen etc being 'unsafe'
    DEFINES += _CRT_SECURE_NO_WARNINGS
192 193
    # Speed up startup time when debugging with cdb
    QMAKE_LFLAGS_DEBUG += /INCREMENTAL:NO
194
}
195 196

qt:greaterThan(QT_MAJOR_VERSION, 4) {
197
    contains(QT, core): QT += concurrent
198
    contains(QT, gui): QT += widgets
199
    DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x040900
200
}
201

202 203
QBSFILE = $$replace(_PRO_FILE_, \\.pro$, .qbs)
exists($$QBSFILE):OTHER_FILES += $$QBSFILE
204 205 206 207 208 209 210 211

# recursively resolve plugin deps
done_plugins =
for(ever) {
    isEmpty(QTC_PLUGIN_DEPENDS): \
        break()
    done_plugins += $$QTC_PLUGIN_DEPENDS
    for(dep, QTC_PLUGIN_DEPENDS) {
212 213 214 215 216 217 218 219 220 221
        dependencies_file =
        for(dir, QTC_PLUGIN_DIRS) {
            exists($$dir/$$dep/$${dep}_dependencies.pri) {
                dependencies_file = $$dir/$$dep/$${dep}_dependencies.pri
                break()
            }
        }
        isEmpty(dependencies_file): \
            error("Plugin dependency $$dep not found")
        include($$dependencies_file)
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
        LIBS += -l$$qtLibraryName($$QTC_PLUGIN_NAME)
    }
    QTC_PLUGIN_DEPENDS = $$unique(QTC_PLUGIN_DEPENDS)
    QTC_PLUGIN_DEPENDS -= $$unique(done_plugins)
}

# recursively resolve library deps
done_libs =
for(ever) {
    isEmpty(QTC_LIB_DEPENDS): \
        break()
    done_libs += $$QTC_LIB_DEPENDS
    for(dep, QTC_LIB_DEPENDS) {
        include($$PWD/src/libs/$$dep/$${dep}_dependencies.pri)
        LIBS += -l$$qtLibraryName($$QTC_LIB_NAME)
    }
    QTC_LIB_DEPENDS = $$unique(QTC_LIB_DEPENDS)
    QTC_LIB_DEPENDS -= $$unique(done_libs)
}