qtcreator.pri 7 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

Eike Ziller's avatar
Eike Ziller committed
8 9 10 11 12
# enable c++11
isEqual(QT_MAJOR_VERSION, 5) {
    CONFIG += c++11
} else {
    macx {
13 14 15 16 17
        !macx-clang*: error("You need to use the macx-clang or macx-clang-libc++ mkspec to compile Qt Creator (call qmake with '-spec unsupported/macx-clang')")
        QMAKE_CFLAGS += -mmacosx-version-min=10.7
        QMAKE_CXXFLAGS += -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7
        QMAKE_OBJECTIVE_CXXFLAGS += -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7
        QMAKE_LFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7
Eike Ziller's avatar
Eike Ziller committed
18 19 20 21 22 23 24 25 26 27 28 29
    } else:linux-g++* {
        QMAKE_CXXFLAGS += -std=c++0x
    } else:linux-icc* {
        QMAKE_CXXFLAGS += -std=c++11
    } else:linux-clang* {
        QMAKE_CXXFLAGS += -std=c++11
        QMAKE_LFLAGS += -stdlib=libc++ -lc++abi
    } else:win32-g++* {
        QMAKE_CXXFLAGS += -std=c++0x
    }
    # nothing to do for MSVC10+
}
30

31 32 33 34 35 36 37 38 39 40 41 42
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
43 44 45 46 47 48 49 50 51 52 53 54 55 56
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) {
57
    return($$replace(1, /, $$QMAKE_DIR_SEP))
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
58
}
con's avatar
con committed
59

60 61
} # qt5

62 63 64 65 66 67 68 69 70 71 72 73 74
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)
}

75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
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)
        }
    }
92 93 94
    greaterThan(QT_MAJOR_VERSION, $$maj) {
        return(true)
    }
95 96 97
    return(false)
}

98 99 100 101 102 103 104 105 106
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

107 108 109 110 111 112 113 114 115
# 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)
116
    out ~= s|^$$re_escape($$_PRO_FILE_PWD_/)||$$i_flag
117 118 119
    return($$out)
}

120 121
} # qt5

122 123
!isEmpty(BUILD_TESTS):TEST = 1

124 125
isEmpty(TEST):CONFIG(debug, debug|release) {
    !debug_and_release|build_pass {
con's avatar
con committed
126 127 128 129
        TEST = 1
    }
}

130
isEmpty(IDE_LIBRARY_BASENAME) {
131 132
    IDE_LIBRARY_BASENAME = lib
}
133

134 135 136
equals(TEST, 1) {
    QT +=testlib
    DEFINES += WITH_TESTS
con's avatar
con committed
137 138
}

139
IDE_SOURCE_TREE = $$PWD
140 141 142 143 144 145
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)$,,
}
146
IDE_APP_PATH = $$IDE_BUILD_TREE/bin
con's avatar
con committed
147
macx {
148
    IDE_APP_TARGET   = "Qt Creator"
149
    IDE_LIBRARY_PATH = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/PlugIns
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
150
    IDE_PLUGIN_PATH  = $$IDE_LIBRARY_PATH
151 152
    IDE_LIBEXEC_PATH = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/Resources
    IDE_DATA_PATH    = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/Resources
153
    IDE_DOC_PATH     = $$IDE_DATA_PATH/doc
154
    IDE_BIN_PATH     = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/MacOS
155
    copydata = 1
con's avatar
con committed
156
} else {
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
157 158
    contains(TEMPLATE, vc.*):vcproj = 1
    IDE_APP_TARGET   = qtcreator
159
    IDE_LIBRARY_PATH = $$IDE_BUILD_TREE/$$IDE_LIBRARY_BASENAME/qtcreator
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
160
    IDE_PLUGIN_PATH  = $$IDE_LIBRARY_PATH/plugins
161
    IDE_LIBEXEC_PATH = $$IDE_APP_PATH # FIXME
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
162
    IDE_DATA_PATH    = $$IDE_BUILD_TREE/share/qtcreator
163
    IDE_DOC_PATH     = $$IDE_BUILD_TREE/share/doc/qtcreator
164
    IDE_BIN_PATH     = $$IDE_APP_PATH
165
    !isEqual(IDE_SOURCE_TREE, $$IDE_BUILD_TREE):copydata = 1
con's avatar
con committed
166 167 168
}

INCLUDEPATH += \
169
    $$IDE_BUILD_TREE/src \ # for <app/app_version.h>
con's avatar
con committed
170
    $$IDE_SOURCE_TREE/src/libs \
171 172
    $$IDE_SOURCE_TREE/tools

173
QTC_PLUGIN_DIRS = $$(QTC_PLUGIN_DIRS)
174
QTC_PLUGIN_DIRS = $$split(QTC_PLUGIN_DIRS, $$QMAKE_DIRLIST_SEP)
175
QTC_PLUGIN_DIRS += $$IDE_SOURCE_TREE/src/plugins
Eike Ziller's avatar
Eike Ziller committed
176
for(dir, QTC_PLUGIN_DIRS) {
177 178
    INCLUDEPATH += $$dir
}
con's avatar
con committed
179

180
CONFIG += depend_includepath
con's avatar
con committed
181 182

LIBS += -L$$IDE_LIBRARY_PATH
183

184 185 186 187 188 189
!isEmpty(vcproj) {
    DEFINES += IDE_LIBRARY_BASENAME=\"$$IDE_LIBRARY_BASENAME\"
} else {
    DEFINES += IDE_LIBRARY_BASENAME=\\\"$$IDE_LIBRARY_BASENAME\\\"
}

190
DEFINES += QT_CREATOR QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
191
!macx:DEFINES += QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_CONCATENATION
192

193
unix {
dt's avatar
dt committed
194 195
    CONFIG(debug, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/debug-shared
    CONFIG(release, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/release-shared
196

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

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
200 201
    RCC_DIR = $${OUT_PWD}/.rcc
    UI_DIR = $${OUT_PWD}/.uic
202
}
203

Orgad Shaneh's avatar
Orgad Shaneh committed
204
win32-msvc* {
205 206
    #Don't warn about sprintf, fopen etc being 'unsafe'
    DEFINES += _CRT_SECURE_NO_WARNINGS
207 208
    # Speed up startup time when debugging with cdb
    QMAKE_LFLAGS_DEBUG += /INCREMENTAL:NO
209
}
210 211

qt:greaterThan(QT_MAJOR_VERSION, 4) {
212
    contains(QT, core): QT += concurrent
213
    contains(QT, gui): QT += widgets
214
    DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x040900
215
}
216

217 218
QBSFILE = $$replace(_PRO_FILE_, \\.pro$, .qbs)
exists($$QBSFILE):OTHER_FILES += $$QBSFILE
219

220
!isEmpty(QTC_PLUGIN_DEPENDS):LIBS *= -L$$IDE_PLUGIN_PATH
221 222 223 224 225 226 227
# recursively resolve plugin deps
done_plugins =
for(ever) {
    isEmpty(QTC_PLUGIN_DEPENDS): \
        break()
    done_plugins += $$QTC_PLUGIN_DEPENDS
    for(dep, QTC_PLUGIN_DEPENDS) {
228 229 230 231 232 233 234 235 236 237
        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)
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
        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)
}