qtcreatorplugin.pri 3.31 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 18
# for substitution in the .json
dependencyList =
19
for(dep, plugin_deps) {
20 21 22 23 24 25 26 27 28 29
    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)
30
    dependencyList += "        { \"Name\" : \"$$QTC_PLUGIN_NAME\", \"Version\" : \"$$QTCREATOR_VERSION\" }"
31
}
32
for(dep, plugin_recmds) {
33 34 35 36 37 38 39 40 41 42
    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)
43
    dependencyList += "        { \"Name\" : \"$$QTC_PLUGIN_NAME\", \"Version\" : \"$$QTCREATOR_VERSION\", \"Type\" : \"optional\" }"
44
}
45 46 47
dependencyList = $$join(dependencyList, ",$$escape_expand(\\n)")

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

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

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

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

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

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

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

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

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

Orgad Shaneh's avatar
Orgad Shaneh committed
102
MIMETYPES = $$_PRO_FILE_PWD_/$${TARGET}.mimetypes.xml
103
exists($$MIMETYPES):DISTFILES += $$MIMETYPES
Orgad Shaneh's avatar
Orgad Shaneh committed
104

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