summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-10-16 14:56:08 +0200
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-10-16 14:56:08 +0200
commit1c859aaa0f6d738359962c5f1c21fb64591ebc59 (patch)
tree95ab2a2b43e354229db35877b2b0757b67f664a0 /share
parentba004ce90327186a7f00ce53bb101b00b01c33fd (diff)
parentc200f8faeaa565286e2c3fe3775a6d9d25140792 (diff)
downloadqbs-1c859aaa0f6d738359962c5f1c21fb64591ebc59.tar.gz
Merge remote-tracking branch 'origin/1.1'
Diffstat (limited to 'share')
-rw-r--r--share/qbs/imports/qbs/FileInfo/fileinfo.js7
-rw-r--r--share/qbs/modules/Qt/core/core.qbs88
-rw-r--r--share/qbs/modules/cpp/windows-msvc.qbs2
-rw-r--r--share/qbs/modules/qbs/common.qbs21
4 files changed, 91 insertions, 27 deletions
diff --git a/share/qbs/imports/qbs/FileInfo/fileinfo.js b/share/qbs/imports/qbs/FileInfo/fileinfo.js
index fb241f8ff..f04212f1e 100644
--- a/share/qbs/imports/qbs/FileInfo/fileinfo.js
+++ b/share/qbs/imports/qbs/FileInfo/fileinfo.js
@@ -1,6 +1,11 @@
function path(fp) {
- if (fp[fp.length -1] === '/')
+ if (fp === '/')
return fp;
+
+ // Yes, this will be wrong for "clever" unix users calling their directory 'c:'. Boohoo.
+ if (fp.length === 3 && fp.slice(-2) === ':/')
+ return fp;
+
var last = fp.lastIndexOf('/');
if (last < 0)
return '.';
diff --git a/share/qbs/modules/Qt/core/core.qbs b/share/qbs/modules/Qt/core/core.qbs
index 55f4ca8bb..0c2ba0088 100644
--- a/share/qbs/modules/Qt/core/core.qbs
+++ b/share/qbs/modules/Qt/core/core.qbs
@@ -12,8 +12,8 @@ Module {
property string namespace
property string libInfix: ""
property string repository: versionMajor === 5 ? "qtbase" : undefined
- property stringList config: []
- property stringList qtConfig: []
+ property stringList config
+ property stringList qtConfig
property path binPath
property path incPath
property path libPath
@@ -27,15 +27,18 @@ Module {
property path docPath
property stringList helpGeneratorArgs: versionMajor >= 5 ? ["-platform", "minimal"] : []
property string version
- property var versionParts: version.split('.').map(function(item) { return parseInt(item, 10); })
+ property var versionParts: version ? version.split('.').map(function(item) { return parseInt(item, 10); }) : []
property int versionMajor: versionParts[0]
property int versionMinor: versionParts[1]
property int versionPatch: versionParts[2]
property bool frameworkBuild
property bool staticBuild
property stringList buildVariant
+
+ // These are deliberately not path types
+ // We don't want to resolve them against the source directory
property string generatedFilesDir: "GeneratedFiles/" + product.name
- property path qmFilesDir: product.destinationDirectory
+ property string qmFilesDir: product.destinationDirectory
// private properties
property string libraryInfix: cpp.debugInformation ? 'd' : ''
@@ -113,30 +116,65 @@ Module {
additionalProductFileTags: ["qm"]
- setupBuildEnvironment: {
- // Not really a setup in this case. Just some sanity checks.
- if (!binPath)
- throw "Qt.core.binPath not set. Set Qt.core.binPath in your profile.";
- if (!incPath)
- throw "Qt.core.incPath not set. Set Qt.core.incPath in your profile.";
- if (!libPath)
- throw "Qt.core.libPath not set. Set Qt.core.libPath in your profile.";
- if (!mkspecPath)
- throw "Qt.core.mkspecPath not set. Set Qt.core.mkspecPath in your profile.";
- if (!version)
- throw "Qt.core.version not set. Set Qt.core.version in your profile.";
+ validate: {
+ var requiredProperties = {
+ "binPath": binPath,
+ "incPath": incPath,
+ "libPath": libPath,
+ "mkspecPath": mkspecPath,
+ "version": version,
+ "config": config,
+ "qtConfig": qtConfig,
+ // Validate these in case 'version' is in some non-standard format
+ "versionMajor": versionMajor,
+ "versionMinor": versionMinor,
+ "versionPatch": versionPatch
+ };
+
+ if (!staticBuild) {
+ requiredProperties["pluginPath"] = pluginPath;
+ }
+
+ var missingProperties = [];
+ for (var i in requiredProperties) {
+ if (requiredProperties[i] === undefined) {
+ missingProperties.push("Qt.core." + i);
+ }
+ }
+
+ var invalidProperties = {};
+ if (versionMajor <= 0)
+ invalidProperties["versionMajor"] = "must be > 0";
+ if (versionMinor < 0)
+ invalidProperties["versionMinor"] = "must be >= 0";
+ if (versionPatch < 0)
+ invalidProperties["versionPatch"] = "must be >= 0";
+
+ var errorMessage = "";
+ if (missingProperties.length > 0) {
+ errorMessage += "The following Qt module properties are not set. " +
+ "Set them in your profile:\n" +
+ missingProperties.sort().join("\n");
+ }
+
+ if (Object.keys(invalidProperties).length > 0) {
+ errorMessage += "The following Qt module properties have invalid values:\n" +
+ Object.map(invalidProperties,
+ function(msg, prop) { return prop + ": " + msg; }).join("\n");
+ }
+
+ if (errorMessage.length > 0)
+ throw errorMessage;
}
setupRunEnvironment: {
- var v = getenv('PATH') || ''
- if (v.length > 0 && v.charAt(0) != ';')
- v = ';' + v
- var y = binPath
- if (qbs.targetOS.contains('windows'))
- v = FileInfo.toWindowsSeparators(y) + v
- else
- v = y + v
- putenv('PATH', v)
+ if (qbs.targetOS.contains('windows')) {
+ var v = getenv('PATH') || '';
+ if (v.length > 0 && v.charAt(0) != ';')
+ v = ';' + v;
+ v = FileInfo.toWindowsSeparators(binPath) + v;
+ putenv('PATH', v);
+ }
}
FileTagger {
diff --git a/share/qbs/modules/cpp/windows-msvc.qbs b/share/qbs/modules/cpp/windows-msvc.qbs
index effe15a04..419a6f922 100644
--- a/share/qbs/modules/cpp/windows-msvc.qbs
+++ b/share/qbs/modules/cpp/windows-msvc.qbs
@@ -21,7 +21,7 @@ CppModule {
property bool generateManifestFiles: true
property path toolchainInstallPath
property path windowsSDKPath
- property string architecture: qbs.architecture || "x86"
+ architecture: qbs.architecture || "x86" // ### remove in 1.2
staticLibraryPrefix: ""
dynamicLibraryPrefix: ""
executablePrefix: ""
diff --git a/share/qbs/modules/qbs/common.qbs b/share/qbs/modules/qbs/common.qbs
index 10ffc5181..e866c02e4 100644
--- a/share/qbs/modules/qbs/common.qbs
+++ b/share/qbs/modules/qbs/common.qbs
@@ -37,4 +37,25 @@ Module {
allowedValues: ['none', 'fast', 'small']
description: "optimization level"
}
+
+ validate: {
+ if (!architecture) { // ### don't warn but throw in 1.2
+ print("WARNING: qbs.architecture is not set. "
+ + "You might want to re-run 'qbs detect-toolchains'.");
+ return;
+ }
+
+ var architectureSynonyms = {
+ "x86": ["i386", "i486", "i586", "i686", "ia32", "ia-32", "x86_32", "x86-32", "intel32"],
+ "x86_64": ["x86-64", "x64", "amd64", "ia32e", "em64t", "intel64"],
+ "ia64": ["ia-64", "itanium"]
+ };
+
+ for (var arch in architectureSynonyms) {
+ if (architectureSynonyms[arch].contains(architecture.toLowerCase())) {
+ throw "qbs.architecture '" + architecture + "' is invalid. " +
+ "You must use the canonical name '" + arch + "'";
+ }
+ }
+ }
}