qtcreatorplugin.pri 3.05 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 13 14 15 16
plugin_deps = $$QTC_PLUGIN_DEPENDS
plugin_recmds = $$QTC_PLUGIN_RECOMMENDS

include(../qtcreator.pri)

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

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

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

43 44 45
# use gui precompiled header for plugins by default
isEmpty(PRECOMPILED_HEADER):PRECOMPILED_HEADER = $$PWD/shared/qtcreator_gui_pch.h

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

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

71 72 73
PLUGINJSON = $$_PRO_FILE_PWD_/$${TARGET}.json
PLUGINJSON_IN = $${PLUGINJSON}.in
exists($$PLUGINJSON_IN) {
74
    DISTFILES += $$PLUGINJSON_IN
75 76
    QMAKE_SUBSTITUTES += $$PLUGINJSON_IN
    PLUGINJSON = $$OUT_PWD/$${TARGET}.json
77 78
} else {
    # need to support that for external plugins
79
    DISTFILES += $$PLUGINJSON
80
}
81

Eike Ziller's avatar
Eike Ziller committed
82 83
osx: QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/
include(rpath.pri)
con's avatar
con committed
84 85

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

87
TEMPLATE = lib
con's avatar
con committed
88
CONFIG += plugin plugin_with_soname
89
linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
90

91
!macx {
Orgad Shaneh's avatar
Orgad Shaneh committed
92
    target.path = $$QTC_PREFIX/$$IDE_LIBRARY_BASENAME/qtcreator/plugins
93
    INSTALLS += target
94
}
dt's avatar
dt committed
95

Orgad Shaneh's avatar
Orgad Shaneh committed
96
MIMETYPES = $$_PRO_FILE_PWD_/$${TARGET}.mimetypes.xml
97
exists($$MIMETYPES):DISTFILES += $$MIMETYPES
Orgad Shaneh's avatar
Orgad Shaneh committed
98

99
TARGET = $$qtLibraryName($$TARGET)
dt's avatar
dt committed
100