qtcreatorplugin.pri 3.91 KB
Newer Older
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
1
include(../qtcreator.pri)
con's avatar
con committed
2

3 4
include($$replace(_PRO_FILE_PWD_, ([^/]+$), \\1/\\1_dependencies.pri))

5 6 7
# use gui precompiled header for plugins by default
isEmpty(PRECOMPILED_HEADER):PRECOMPILED_HEADER = $$PWD/shared/qtcreator_gui_pch.h

con's avatar
con committed
8
isEmpty(PROVIDER) {
9
    PROVIDER = QtProject
10
} else {
11
    LIBS += -L$$IDE_PLUGIN_PATH/QtProject
con's avatar
con committed
12 13
}

14 15 16
isEmpty(USE_USER_DESTDIR) {
    DESTDIR = $$IDE_PLUGIN_PATH/$$PROVIDER
} else {
17 18 19 20 21 22 23 24 25
    win32 {
        DESTDIRAPPNAME = "qtcreator"
        DESTDIRBASE = "$$(LOCALAPPDATA)"
        isEmpty(DESTDIRBASE):DESTDIRBASE="$$(USERPROFILE)\Local Settings\Application Data"
    } else:macx {
        DESTDIRAPPNAME = "Qt Creator"
        DESTDIRBASE = "$$(HOME)/Library/Application Support"
    } else:unix {
        DESTDIRAPPNAME = "qtcreator"
26
        DESTDIRBASE = "$$(XDG_DATA_HOME)"
27
        isEmpty(DESTDIRBASE):DESTDIRBASE = "$$(HOME)/.local/share/data"
28
        else:DESTDIRBASE = "$$DESTDIRBASE/data"
29
    }
30
    DESTDIR = "$$DESTDIRBASE/QtProject/$$DESTDIRAPPNAME/plugins/$$QTCREATOR_VERSION/$$PROVIDER"
31
}
con's avatar
con committed
32 33 34 35
LIBS += -L$$DESTDIR

# copy the plugin spec
isEmpty(TARGET) {
36
    error("qtcreatorplugin.pri: You must provide a TARGET")
con's avatar
con committed
37 38
}

39 40 41 42 43 44 45 46
isEqual(QT_MAJOR_VERSION, 5) {

defineReplace(stripOutDir) {
    return($$relative_path($$1, $$OUT_PWD))
}

} else { # qt5

47 48 49 50 51
defineReplace(stripOutDir) {
    1 ~= s|^$$re_escape($$OUT_PWD/)||$$i_flag
    return($$1)
}

52 53
} # qt5

54 55 56 57
PLUGINSPEC = $$_PRO_FILE_PWD_/$${TARGET}.pluginspec
PLUGINSPEC_IN = $${PLUGINSPEC}.in
exists($$PLUGINSPEC_IN) {
    OTHER_FILES += $$PLUGINSPEC_IN
58
    QMAKE_SUBSTITUTES += $$PLUGINSPEC_IN
59 60 61 62 63 64 65 66
    PLUGINSPEC = $$OUT_PWD/$${TARGET}.pluginspec
    copy2build.output = $$DESTDIR/${QMAKE_FUNC_FILE_IN_stripOutDir}
} else {
    # need to support that for external plugins
    OTHER_FILES += $$PLUGINSPEC
    copy2build.output = $$DESTDIR/${QMAKE_FUNC_FILE_IN_stripSrcDir}
}
copy2build.input = PLUGINSPEC
67
isEmpty(vcproj):copy2build.variable_out = PRE_TARGETDEPS
68
copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
69 70 71
copy2build.name = COPY ${QMAKE_FILE_IN}
copy2build.CONFIG += no_link
QMAKE_EXTRA_COMPILERS += copy2build
con's avatar
con committed
72

73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
greaterThan(QT_MAJOR_VERSION, 4) {
#   Create a Json file containing the plugin information required by
#   Qt 5's plugin system by running a XSLT sheet on the
#   pluginspec file before moc runs.
    XMLPATTERNS = $$targetPath($$[QT_INSTALL_BINS]/xmlpatterns)

    pluginspec2json.name = Create Qt 5 plugin json file
    pluginspec2json.input = PLUGINSPEC
    pluginspec2json.variable_out = GENERATED_FILES
    pluginspec2json.output = $${TARGET}.json
    pluginspec2json.commands = $$XMLPATTERNS -no-format -output $$pluginspec2json.output $$PWD/pluginjsonmetadata.xsl $$PLUGINSPEC
    pluginspec2json.CONFIG += no_link
    moc_header.depends += $$pluginspec2json.output
    QMAKE_EXTRA_COMPILERS += pluginspec2json
}

con's avatar
con committed
89
macx {
90
    !isEmpty(TIGER_COMPAT_MODE) {
con's avatar
con committed
91
        QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../PlugIns/$${PROVIDER}/
92 93
    } else {
        QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/$${PROVIDER}/
94
        QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../../,-rpath,@executable_path/../
95
    }
con's avatar
con committed
96 97
} else:linux-* {
    #do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR
Daniel Molkentin's avatar
Daniel Molkentin committed
98
    QMAKE_RPATHDIR += \$\$ORIGIN
con's avatar
con committed
99
    QMAKE_RPATHDIR += \$\$ORIGIN/..
Daniel Molkentin's avatar
Daniel Molkentin committed
100
    QMAKE_RPATHDIR += \$\$ORIGIN/../..
con's avatar
con committed
101 102 103 104 105
    IDE_PLUGIN_RPATH = $$join(QMAKE_RPATHDIR, ":")
    QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,$${IDE_PLUGIN_RPATH}\'
    QMAKE_RPATHDIR =
}

106 107
# put .pro file directory in INCLUDEPATH
CONFIG += include_source_dir
con's avatar
con committed
108 109

contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
110

con's avatar
con committed
111
CONFIG += plugin plugin_with_soname
112
linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
113

114
!macx {
Daniel Molkentin's avatar
Daniel Molkentin committed
115
    target.path = $$QTC_PREFIX/$$IDE_LIBRARY_BASENAME/qtcreator/plugins/$$PROVIDER
Daniel Molkentin's avatar
Daniel Molkentin committed
116
    pluginspec.files += $${TARGET}.pluginspec
Daniel Molkentin's avatar
Daniel Molkentin committed
117
    pluginspec.path = $$QTC_PREFIX/$$IDE_LIBRARY_BASENAME/qtcreator/plugins/$$PROVIDER
Daniel Molkentin's avatar
Daniel Molkentin committed
118
    INSTALLS += target pluginspec
119
}
dt's avatar
dt committed
120

121
TARGET = $$qtLibraryName($$TARGET)
dt's avatar
dt committed
122