aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/modules/qt
diff options
context:
space:
mode:
Diffstat (limited to 'share/qbs/modules/qt')
-rw-r--r--share/qbs/modules/qt/QtModule.qbs19
-rw-r--r--share/qbs/modules/qt/core/moc.js15
-rw-r--r--share/qbs/modules/qt/core/qtcore.qbs130
-rw-r--r--share/qbs/modules/qt/declarative/module.qbs9
-rw-r--r--share/qbs/modules/qt/designer/module.qbs8
-rw-r--r--share/qbs/modules/qt/designercomponents/module.qbs8
-rw-r--r--share/qbs/modules/qt/gui/qtgui.qbs33
-rw-r--r--share/qbs/modules/qt/help/module.qbs8
-rw-r--r--share/qbs/modules/qt/network/module.qbs8
-rw-r--r--share/qbs/modules/qt/opengl/module.qbs8
-rw-r--r--share/qbs/modules/qt/qtfunctions.js12
-rw-r--r--share/qbs/modules/qt/script/module.qbs8
-rw-r--r--share/qbs/modules/qt/sql/module.qbs8
-rw-r--r--share/qbs/modules/qt/svg/module.qbs8
-rw-r--r--share/qbs/modules/qt/webkit/module.qbs8
-rw-r--r--share/qbs/modules/qt/xml/module.qbs8
16 files changed, 298 insertions, 0 deletions
diff --git a/share/qbs/modules/qt/QtModule.qbs b/share/qbs/modules/qt/QtModule.qbs
new file mode 100644
index 000000000..b1a03d4c2
--- /dev/null
+++ b/share/qbs/modules/qt/QtModule.qbs
@@ -0,0 +1,19 @@
+import qbs.base 1.0
+import qbs.fileinfo 1.0 as FileInfo
+import 'qtfunctions.js' as QtFunctions
+
+Module {
+ condition: false
+
+ Depends { name: "cpp" }
+ Depends { id: qtcore; name: "Qt.core" }
+
+ property string binPath: qtcore.binPath
+ property string incPath: qtcore.incPath
+ property string libPath: qtcore.libPath
+ property string qtModuleName: ''
+ property string internalQtModuleName: 'Qt' + qtModuleName
+ cpp.includePaths: [incPath + '/' + internalQtModuleName]
+ cpp.dynamicLibraries: [QtFunctions.getLibraryName(internalQtModuleName, qbs.targetOS, cpp.debugInformation)]
+ cpp.frameworks: [QtFunctions.getLibraryName(internalQtModuleName, qbs.targetOS, cpp.debugInformation)]
+}
diff --git a/share/qbs/modules/qt/core/moc.js b/share/qbs/modules/qt/core/moc.js
new file mode 100644
index 000000000..c0845220c
--- /dev/null
+++ b/share/qbs/modules/qt/core/moc.js
@@ -0,0 +1,15 @@
+function args(input, output, config) {
+ var args = [];
+
+ // ### fixme
+ var defines = ModUtils.appendAll_internal(config.modules, 'cpp', 'defines') //config.modules.cpp.compiler.defines
+ var includePaths = ModUtils.appendAll_internal(config.modules, 'cpp', 'includePaths') //config.modules.cpp.compiler.includePaths
+ for (var i in defines)
+ args.push('-D' + defines[i]);
+ for (var i in includePaths)
+ args.push('-I' + includePaths[i]);
+ args.push('-o', output);
+ args.push(input);
+ return args;
+}
+
diff --git a/share/qbs/modules/qt/core/qtcore.qbs b/share/qbs/modules/qt/core/qtcore.qbs
new file mode 100644
index 000000000..075b462b6
--- /dev/null
+++ b/share/qbs/modules/qt/core/qtcore.qbs
@@ -0,0 +1,130 @@
+import qbs.base 1.0
+import qbs.fileinfo 1.0 as FileInfo
+import '../../utils.js' as ModUtils
+import "moc.js" 1.0 as Moc
+import '../qtfunctions.js' as QtFunctions
+
+Module {
+ Depends { name: "cpp" }
+
+ property string qtVersionName: "default"
+ property string configKey: "qt/" + qtVersionName + "/"
+ property string qtNamespace: qbs.configurationValue(configKey + "namespace", undefined)
+ property string qtPath: qbs.configurationValue(configKey + "path", undefined)
+ property string binPath: qtPath ? qtPath + "/bin" : qbs.configurationValue(configKey + "binPath", undefined)
+ property string incPath: qtPath ? qtPath + "/include" : qbs.configurationValue(configKey + "incPath", undefined)
+ property string libPath: qtPath ? qtPath + "/lib" : qbs.configurationValue(configKey + "libPath", undefined)
+ property string mkspecsPath: qtPath ? qtPath + "/mkspecs" : qbs.configurationValue(configKey + "mkspecsPath", undefined)
+ property string generatedFilesDir: 'GeneratedFiles/' + product.name // ### TODO: changing this property does not change the path in the rule ATM.
+ property string libraryInfix: cpp.debugInformation ? 'd' : ''
+ cpp.defines: {
+ if (!qtNamespace)
+ return undefined;
+ return ["QT_NAMESPACE=" + qtNamespace]
+ }
+ cpp.includePaths: [
+ mkspecsPath + '/default',
+ incPath + '/QtCore',
+ incPath,
+ product.buildDirectory + '/' + generatedFilesDir
+ ]
+ cpp.libraryPaths: [libPath]
+ cpp.dynamicLibraries: qbs.targetOS != 'mac' ? [QtFunctions.getLibraryName('QtCore', qbs.targetOS, cpp.debugInformation)] : []
+ cpp.frameworkPaths: [libPath]
+ cpp.frameworks: [QtFunctions.getLibraryName('QtCore', qbs.targetOS, cpp.debugInformation)]
+ cpp.rpaths: [libPath]
+
+ setupBuildEnvironment: {
+ // Not really a setup in this case. Just some sanity checks.
+ if (!binPath)
+ throw "qt/core.binPath not set. Set the configuration values qt/default/binPath or qt/default/path.";
+ if (!incPath)
+ throw "qt/core.incPath not set. Set the configuration values qt/default/incPath or qt/default/path.";
+ if (!libPath)
+ throw "qt/core.libPath not set. Set the configuration values qt/default/libPath or qt/default/path.";
+ if (!mkspecsPath)
+ throw "qt/core.mkspecsPath not set. Set the configuration values qt/default/mkspecsPath or qt/default/path.";
+ }
+
+ setupRunEnvironment: {
+ var v = getenv('PATH') || ''
+ if (v.length > 0 && v.charAt(0) != ';')
+ v = ';' + v
+ var y = binPath
+ if (qbs.targetOS === 'windows')
+ v = FileInfo.toWindowsSeparators(y) + v
+ else
+ v = y + v
+ putenv('PATH', v)
+ }
+
+ FileTagger {
+ pattern: "*.qrc"
+ fileTags: ["qrc"]
+ }
+
+ Rule {
+ inputs: ["moc_cpp"]
+
+ Artifact {
+ fileName: 'GeneratedFiles/' + product.name + '/' + input.baseName + '.moc'
+// fileName: input.baseDir + '/' + input.baseName + '.moc'
+ fileTags: ["hpp"]
+ }
+
+ prepare: {
+ var cmd = new Command(product.module.binPath + '/moc', Moc.args(input.fileName, output.fileName, input));
+ cmd.description = 'moc ' + FileInfo.fileName(input.fileName);
+ cmd.highlight = 'codegen';
+ return cmd;
+ }
+ }
+
+ Rule {
+ inputs: ["moc_hpp"]
+
+ Artifact {
+ fileName: 'GeneratedFiles/' + product.name + '/moc_' + input.baseName + '.cpp'
+ fileTags: [ "cpp" ]
+ }
+
+ prepare: {
+ var cmd = new Command(product.module.binPath + '/moc', Moc.args(input.fileName, output.fileName, input));
+ cmd.description = 'moc ' + FileInfo.fileName(input.fileName);
+ cmd.highlight = 'codegen';
+ return cmd;
+ }
+ }
+
+ Rule {
+ inputs: ["moc_hpp_inc"]
+
+ Artifact {
+ fileName: 'GeneratedFiles/' + product.name + '/moc_' + input.baseName + '.cpp'
+ fileTags: [ "hpp" ]
+ }
+
+ prepare: {
+ var cmd = new Command(product.module.binPath + '/moc', Moc.args(input.fileName, output.fileName, input));
+ cmd.description = 'moc ' + FileInfo.fileName(input.fileName);
+ cmd.highlight = 'codegen';
+ return cmd;
+ }
+ }
+
+ Rule {
+ inputs: ["qrc"]
+
+ Artifact {
+// ### TODO we want to access the module's property "generatedFilesDir" here. But without evaluating all available properties a priori.
+ fileName: 'GeneratedFiles/' + product.name + '/qrc_' + input.baseName + '.cpp'
+ fileTags: ["cpp"]
+ }
+ prepare: {
+ var cmd = new Command(product.module.binPath + '/rcc', [input.fileName, '-name', FileInfo.baseName(input.fileName), '-o', output.fileName]);
+ cmd.description = 'rcc ' + FileInfo.fileName(input.fileName);
+ cmd.highlight = 'codegen';
+ return cmd;
+ }
+ }
+}
diff --git a/share/qbs/modules/qt/declarative/module.qbs b/share/qbs/modules/qt/declarative/module.qbs
new file mode 100644
index 000000000..3f4bf5b0f
--- /dev/null
+++ b/share/qbs/modules/qt/declarative/module.qbs
@@ -0,0 +1,9 @@
+import qbs.base 1.0
+import '../QtModule.qbs' as QtModule
+
+QtModule {
+ condition: true
+ qtModuleName: "Declarative"
+ Depends { name: "Qt.gui" }
+}
+
diff --git a/share/qbs/modules/qt/designer/module.qbs b/share/qbs/modules/qt/designer/module.qbs
new file mode 100644
index 000000000..c2e319d88
--- /dev/null
+++ b/share/qbs/modules/qt/designer/module.qbs
@@ -0,0 +1,8 @@
+import qbs.base 1.0
+import '../QtModule.qbs' as QtModule
+
+QtModule {
+ condition: true
+ qtModuleName: 'Designer'
+}
+
diff --git a/share/qbs/modules/qt/designercomponents/module.qbs b/share/qbs/modules/qt/designercomponents/module.qbs
new file mode 100644
index 000000000..eb700eb7f
--- /dev/null
+++ b/share/qbs/modules/qt/designercomponents/module.qbs
@@ -0,0 +1,8 @@
+import qbs.base 1.0
+import '../QtModule.qbs' as QtModule
+
+QtModule {
+ condition: true
+ qtModuleName: 'DesignerComponents'
+}
+
diff --git a/share/qbs/modules/qt/gui/qtgui.qbs b/share/qbs/modules/qt/gui/qtgui.qbs
new file mode 100644
index 000000000..2a300a00c
--- /dev/null
+++ b/share/qbs/modules/qt/gui/qtgui.qbs
@@ -0,0 +1,33 @@
+import qbs.base 1.0
+import qbs.fileinfo 1.0 as FileInfo
+import '../QtModule.qbs' as QtModule
+
+QtModule {
+ qtModuleName: "Gui"
+
+ Depends { id: qtcore; name: "Qt.core" }
+
+ FileTagger {
+ pattern: "*.ui"
+ fileTags: ["ui"]
+ }
+
+ Rule {
+ inputs: ["ui"]
+
+ Artifact {
+// ### TODO we want to access the module's property "qtcore.generatedFilesDir" here. But without evaluating all available properties a priori.
+// fileName: input.baseDir + '/qrc_' + input.baseName + '.cpp'
+ fileName: 'GeneratedFiles/' + product.name + '/ui_' + input.baseName + '.h'
+ fileTags: ["hpp"]
+ }
+
+ prepare: {
+ var cmd = new Command(product.module.binPath + '/uic', [input.fileName, '-o', output.fileName])
+ cmd.description = 'uic ' + FileInfo.fileName(input.fileName);
+ cmd.highlight = 'codegen';
+ return cmd;
+ }
+ }
+}
+
diff --git a/share/qbs/modules/qt/help/module.qbs b/share/qbs/modules/qt/help/module.qbs
new file mode 100644
index 000000000..6bf5616f9
--- /dev/null
+++ b/share/qbs/modules/qt/help/module.qbs
@@ -0,0 +1,8 @@
+import qbs.base 1.0
+import '../QtModule.qbs' as QtModule
+
+QtModule {
+ condition: true
+ qtModuleName: 'Help'
+}
+
diff --git a/share/qbs/modules/qt/network/module.qbs b/share/qbs/modules/qt/network/module.qbs
new file mode 100644
index 000000000..00aa5386a
--- /dev/null
+++ b/share/qbs/modules/qt/network/module.qbs
@@ -0,0 +1,8 @@
+import qbs.base 1.0
+import '../QtModule.qbs' as QtModule
+
+QtModule {
+ condition: true
+ qtModuleName: 'Network'
+}
+
diff --git a/share/qbs/modules/qt/opengl/module.qbs b/share/qbs/modules/qt/opengl/module.qbs
new file mode 100644
index 000000000..fed343603
--- /dev/null
+++ b/share/qbs/modules/qt/opengl/module.qbs
@@ -0,0 +1,8 @@
+import qbs.base 1.0
+import '../QtModule.qbs' as QtModule
+
+QtModule {
+ condition: true
+ qtModuleName: 'OpenGL'
+}
+
diff --git a/share/qbs/modules/qt/qtfunctions.js b/share/qbs/modules/qt/qtfunctions.js
new file mode 100644
index 000000000..c6dbf4de5
--- /dev/null
+++ b/share/qbs/modules/qt/qtfunctions.js
@@ -0,0 +1,12 @@
+// helper functions for the Qt modules
+
+function getLibraryName(qtModule, targetOS, debugInfo)
+{
+ var isUnix = (targetOS == 'linux' || targetOS == 'mac')
+ var libName
+ if (isUnix)
+ libName = qtModule
+ else if (targetOS == 'windows')
+ libName = qtModule + (debugInfo ? 'd' : '') + '4.lib'
+ return libName
+}
diff --git a/share/qbs/modules/qt/script/module.qbs b/share/qbs/modules/qt/script/module.qbs
new file mode 100644
index 000000000..96e292bb4
--- /dev/null
+++ b/share/qbs/modules/qt/script/module.qbs
@@ -0,0 +1,8 @@
+import qbs.base 1.0
+import '../QtModule.qbs' as QtModule
+
+QtModule {
+ condition: true
+ qtModuleName: 'Script'
+}
+
diff --git a/share/qbs/modules/qt/sql/module.qbs b/share/qbs/modules/qt/sql/module.qbs
new file mode 100644
index 000000000..23892e162
--- /dev/null
+++ b/share/qbs/modules/qt/sql/module.qbs
@@ -0,0 +1,8 @@
+import qbs.base 1.0
+import '../QtModule.qbs' as QtModule
+
+QtModule {
+ condition: true
+ qtModuleName: 'Sql'
+}
+
diff --git a/share/qbs/modules/qt/svg/module.qbs b/share/qbs/modules/qt/svg/module.qbs
new file mode 100644
index 000000000..e06e9277a
--- /dev/null
+++ b/share/qbs/modules/qt/svg/module.qbs
@@ -0,0 +1,8 @@
+import qbs.base 1.0
+import '../QtModule.qbs' as QtModule
+
+QtModule {
+ condition: true
+ qtModuleName: 'Svg'
+}
+
diff --git a/share/qbs/modules/qt/webkit/module.qbs b/share/qbs/modules/qt/webkit/module.qbs
new file mode 100644
index 000000000..ea598d61f
--- /dev/null
+++ b/share/qbs/modules/qt/webkit/module.qbs
@@ -0,0 +1,8 @@
+import qbs.base 1.0
+import '../QtModule.qbs' as QtModule
+
+QtModule {
+ condition: true
+ qtModuleName: 'WebKit'
+}
+
diff --git a/share/qbs/modules/qt/xml/module.qbs b/share/qbs/modules/qt/xml/module.qbs
new file mode 100644
index 000000000..5b4a462a7
--- /dev/null
+++ b/share/qbs/modules/qt/xml/module.qbs
@@ -0,0 +1,8 @@
+import qbs.base 1.0
+import '../QtModule.qbs' as QtModule
+
+QtModule {
+ condition: true
+ qtModuleName: 'Xml'
+}
+