summaryrefslogtreecommitdiff
path: root/qbs/imports/QtcPlugin.qbs
blob: 8d68c234fe2d94382f715089582bef8cf910e376 (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
import qbs 1.0
import qbs.FileInfo
import QtcFunctions

QtcProduct {
    type: ["dynamiclibrary", "pluginSpec", "qtc.dev-module"]
    installDir: qtc.ide_plugin_path
    installTags: ["dynamiclibrary"]
    useGuiPchFile: true

    property var pluginJsonReplacements
    property var pluginRecommends: []
    property var pluginTestDepends: []

    property string minimumQtVersion: "5.5.0"
    condition: QtcFunctions.versionIsAtLeast(Qt.core.version, minimumQtVersion)

    targetName: QtcFunctions.qtLibraryName(qbs, name)
    destinationDirectory: qtc.ide_plugin_path

    Depends { name: "ExtensionSystem" }
    Depends { name: "pluginjson" }
    Depends {
        condition: qtc.testsEnabled
        name: "Qt.test"
    }

    cpp.internalVersion: ""
    cpp.defines: base.concat([name.toUpperCase() + "_LIBRARY"])
    cpp.sonamePrefix: qbs.targetOS.contains("macos")
        ? "@rpath"
        : undefined
    cpp.rpaths: qbs.targetOS.contains("macos")
        ? ["@loader_path/../Frameworks", "@loader_path/../PlugIns"]
        : ["$ORIGIN", "$ORIGIN/.."]
    cpp.linkerFlags: {
        var flags = base;
        if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc"))
            flags.push("/INCREMENTAL:NO"); // Speed up startup time when debugging with cdb
        if (qbs.targetOS.contains("macos"))
            flags.push("-compatibility_version", qtc.qtcreator_compat_version);
        return flags;
    }

    property string pluginIncludeBase: ".." // #include <plugin/header.h>
    cpp.includePaths: [pluginIncludeBase]

    Group {
        name: "PluginMetaData"
        files: [ product.name + ".json.in" ]
        fileTags: ["pluginJsonIn"]
    }

    Group {
        name: "MimeTypes"
        files: [ "*.mimetypes.xml" ]
    }

    Export {
        Depends { name: "ExtensionSystem" }
        Depends { name: "cpp" }
        cpp.includePaths: [product.pluginIncludeBase]
    }
}