summaryrefslogtreecommitdiff
path: root/mkspecs/features/qt_plugin.prf
blob: 8a70ce041a8871a557873d4cfce4d1b4fab9d726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#
#  W A R N I N G
#  -------------
#
# This file is not part of the Qt API.  It exists purely as an
# implementation detail.  It may change from version to version
# without notice, or even be removed.
#
# We mean it.
#

load(qt_build_paths)

isEmpty(PLUGIN_TYPE): error("PLUGIN_TYPE (plugins/ subdirectory) needs to be defined.")

TEMPLATE = lib
CONFIG += plugin
DESTDIR = $$MODULE_BASE_OUTDIR/plugins/$$PLUGIN_TYPE

tool_plugin {
    !build_pass:contains(QT_CONFIG, build_all): CONFIG += release
} else:if(win32|mac):!macx-xcode {
    contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release
    contains(QT_CONFIG, build_all):CONFIG += build_all
}

CONFIG(static, static|shared)|prefix_build {
    isEmpty(MODULE): MODULE = $$basename(TARGET)

    mod_work_pfx = $$MODULE_QMAKE_OUTDIR/mkspecs/modules
    force_independent: \
        mod_inst_pfx = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst
    else: \
        mod_inst_pfx = $$mod_work_pfx
    MODULE_PRI = $$mod_inst_pfx/qt_plugin_$${MODULE}.pri
    MODULE_FWD_PRI = $$mod_work_pfx/qt_plugin_$${MODULE}.pri

    !build_pass {
        MODULE_PRI_CONT = \
            "QT_PLUGIN.$${MODULE}.TYPE = $$PLUGIN_TYPE" \
            "QT_PLUGIN.$${MODULE}.EXTENDS =$$join(PLUGIN_EXTENDS, " ", " ")" \
            "QT_PLUGIN.$${MODULE}.CLASS_NAME = $$PLUGIN_CLASS_NAME" \
            "QT_PLUGINS += $$MODULE"
        write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.")
        MODULE_PRI_FILES = $$MODULE_PRI

        force_independent {

            # Create a forwarding module .pri file
            MODULE_FWD_PRI_CONT = \
                "QT_PLUGIN.$${MODULE}.PATH = $$MODULE_BASE_OUTDIR/plugins" \
                "include($$MODULE_PRI)"
            write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.")
            touch($$MODULE_FWD_PRI, $$MODULE_PRI)
            MODULE_PRI_FILES += $$MODULE_FWD_PRI

        }

        # Then, inject the new module into the current cache state
        !contains(QMAKE_INTERNAL_INCLUDED_FILES, $$MODULE_FWD_PRI): \ # before the actual include()!
            cache(QMAKE_INTERNAL_INCLUDED_FILES, add transient, MODULE_PRI_FILES)
        include($$MODULE_FWD_PRI)
        for(var, $$list(TYPE EXTENDS CLASS_NAME PATH)): \
            defined(QT_PLUGIN.$${MODULE}.$$var, var): \
                cache(QT_PLUGIN.$${MODULE}.$$var, transient)
        cache(QT_PLUGINS, transient)
    }

    CONFIG(static, static|shared) {
        pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
        pritarget.files = $$MODULE_PRI
        INSTALLS += pritarget
    }
}

target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE
INSTALLS += target

TARGET = $$qtLibraryTarget($$TARGET)

CONFIG += create_cmake

load(qt_targets)
load(qt_common)

wince*:LIBS += $$QMAKE_LIBS_GUI
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF