qtcreatorplugin.pri 3.28 KB
Newer Older
1 2 3 4 5 6 7 8 9
depfile = $$replace(_PRO_FILE_PWD_, ([^/]+$), \\1/\\1_dependencies.pri)
exists($$depfile) {
    include($$depfile)
    isEmpty(QTC_PLUGIN_NAME): \
        error("$$basename(depfile) does not define QTC_PLUGIN_NAME.")
} else {
    isEmpty(QTC_PLUGIN_NAME): \
        error("QTC_PLUGIN_NAME is empty. Maybe you meant to create $$basename(depfile)?")
}
10
TARGET = $$QTC_PLUGIN_NAME
11

12
plugin_deps = $$QTC_PLUGIN_DEPENDS
13
plugin_test_deps = $$QTC_TEST_DEPENDS
14 15 16 17
plugin_recmds = $$QTC_PLUGIN_RECOMMENDS

include(../qtcreator.pri)

18
defineReplace(dependencyName) {
19 20
    dependencies_file =
    for(dir, QTC_PLUGIN_DIRS) {
21 22
        exists($$dir/$$1/$${1}_dependencies.pri) {
            dependencies_file = $$dir/$$1/$${1}_dependencies.pri
23 24 25 26 27 28
            break()
        }
    }
    isEmpty(dependencies_file): \
        error("Plugin dependency $$dep not found")
    include($$dependencies_file)
29 30 31 32 33 34 35
    return($$QTC_PLUGIN_NAME)
}

# for substitution in the .json
dependencyList =
for(dep, plugin_deps) {
    dependencyList += "        { \"Name\" : \"$$dependencyName($$dep)\", \"Version\" : \"$$QTCREATOR_VERSION\" }"
36
}
37
for(dep, plugin_recmds) {
38
    dependencyList += "        { \"Name\" : \"$$dependencyName($$dep)\", \"Version\" : \"$$QTCREATOR_VERSION\", \"Type\" : \"optional\" }"
39
}
40 41 42
for(dep, plugin_test_deps) {
    dependencyList += "        { \"Name\" : \"$$dependencyName($$dep)\", \"Version\" : \"$$QTCREATOR_VERSION\", \"Type\" : \"test\" }"
}
43 44 45
dependencyList = $$join(dependencyList, ",$$escape_expand(\\n)")

dependencyList = "\"Dependencies\" : [$$escape_expand(\\n)$$dependencyList$$escape_expand(\\n)    ]"
46

47 48 49
# use gui precompiled header for plugins by default
isEmpty(PRECOMPILED_HEADER):PRECOMPILED_HEADER = $$PWD/shared/qtcreator_gui_pch.h

50
isEmpty(USE_USER_DESTDIR) {
51
    DESTDIR = $$IDE_PLUGIN_PATH
52
} else {
53 54 55 56 57 58 59 60 61
    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"
62
        DESTDIRBASE = "$$(XDG_DATA_HOME)"
63
        isEmpty(DESTDIRBASE):DESTDIRBASE = "$$(HOME)/.local/share/data"
64
        else:DESTDIRBASE = "$$DESTDIRBASE/data"
65
    }
66
    DESTDIR = "$$DESTDIRBASE/QtProject/$$DESTDIRAPPNAME/plugins/$$QTCREATOR_VERSION"
67
}
con's avatar
con committed
68
LIBS += -L$$DESTDIR
69
INCLUDEPATH += $$OUT_PWD
con's avatar
con committed
70 71 72

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

76 77 78
PLUGINJSON = $$_PRO_FILE_PWD_/$${TARGET}.json
PLUGINJSON_IN = $${PLUGINJSON}.in
exists($$PLUGINJSON_IN) {
79
    DISTFILES += $$PLUGINJSON_IN
80 81
    QMAKE_SUBSTITUTES += $$PLUGINJSON_IN
    PLUGINJSON = $$OUT_PWD/$${TARGET}.json
82 83
} else {
    # need to support that for external plugins
84
    DISTFILES += $$PLUGINJSON
85
}
86

Eike Ziller's avatar
Eike Ziller committed
87 88
osx: QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/
include(rpath.pri)
con's avatar
con committed
89 90

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

92
TEMPLATE = lib
con's avatar
con committed
93
CONFIG += plugin plugin_with_soname
94
linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
95

96
!macx {
97
    target.path = $$QTC_PREFIX/$$IDE_LIBRARY_BASENAME/qtcreator/plugins
98
    INSTALLS += target
99
}
dt's avatar
dt committed
100

101
MIMETYPES = $$_PRO_FILE_PWD_/$${TARGET}.mimetypes.xml
102
exists($$MIMETYPES):DISTFILES += $$MIMETYPES
103

104
TARGET = $$qtLibraryName($$TARGET)
dt's avatar
dt committed
105