blob: 883e34465b96ea69bc7facd74f44de1c2b4dcc50 (
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
|
import qbs.FileInfo
import qbs.TextFile
QtModule {
isPlugin: true
property string className
property stringList extendsModules
enableLinking: {
if (!base)
return false;
if (!isStaticLibrary)
return false;
if (!Qt.plugin_support.linkPlugins)
return false;
if (!(Qt.plugin_support.enabledPlugins || []).contains(qtModuleName))
return false;
if (!extendsModules || extendsModules.length === 0)
return true;
for (var i = 0; i < extendsModules.length; ++i) {
var moduleName = extendsModules[i];
if (product.Qt[moduleName] && product.Qt[moduleName].present)
return true;
}
return false;
}
Rule {
condition: enableLinking
multiplex: true
Artifact {
filePath: product.targetName + "_qt_plugin_import_"
+ product.moduleProperty(product.moduleName, "qtModuleName") + ".cpp"
fileTags: "cpp"
}
prepare: {
var cmd = new JavaScriptCommand();
var pluginName = product.moduleProperty(product.moduleName, "qtModuleName");
cmd.description = "creating static import for plugin '" + pluginName + "'";
cmd.sourceCode = function() {
var f = new TextFile(output.filePath, TextFile.WriteOnly);
var className = product.moduleProperty(product.moduleName, "className");
f.writeLine("#include <QtPlugin>\n\nQ_IMPORT_PLUGIN(" + className + ")");
f.close();
};
return cmd;
}
}
}
|