aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/reference/modules/wix-module.qdoc68
-rw-r--r--share/qbs/modules/wix/WiXModule.qbs55
2 files changed, 100 insertions, 23 deletions
diff --git a/doc/reference/modules/wix-module.qdoc b/doc/reference/modules/wix-module.qdoc
index 58612b784..6184bc6eb 100644
--- a/doc/reference/modules/wix-module.qdoc
+++ b/doc/reference/modules/wix-module.qdoc
@@ -179,6 +179,61 @@
List of extension assemblies to link into the output.
+ \section2 version
+
+ \table
+ \row \li \b{Type:} \li \c{string}
+ \row \li \b{Default:} \li \c{undefined}
+ \endtable
+
+ The WiX version. Consists of four numbers separated by dots, for instance "3.7.1224.0".
+
+ \section2 versionMajor
+
+ \table
+ \row \li \b{Type:} \li \c{int}
+ \row \li \b{Default:} \li \c{versionParts[0]}
+ \endtable
+
+ The WiX major version.
+
+ \section2 versionMinor
+
+ \table
+ \row \li \b{Type:} \li \c{int}
+ \row \li \b{Default:} \li \c{versionParts[1]}
+ \endtable
+
+ The WiX minor version.
+
+ \section2 versionParts
+
+ \table
+ \row \li \b{Type:} \li \c{list}
+ \row \li \b{Default:} \li \c{empty}
+ \endtable
+
+ The WiX version as a list. For instance, WiX version 3.7.1224.0 would correspond to a value of
+ \c[3, 7, 1224, 0].
+
+ \section2 versionPatch
+
+ \table
+ \row \li \b{Type:} \li \c{int}
+ \row \li \b{Default:} \li \c{versionParts[2]}
+ \endtable
+
+ The WiX patch level.
+
+ \section2 versionBuild
+
+ \table
+ \row \li \b{Type:} \li \c{int}
+ \row \li \b{Default:} \li \c{versionParts[3]}
+ \endtable
+
+ The fourth WiX version number component.
+
\section2 toolchainInstallPath
\table
@@ -186,8 +241,17 @@
\row \li \b{Default:} \li determined automatically
\endtable
- WiX installation directory. Determined by searching the \c{WIX} environment variable,
- known registry keys, and known installation paths until a match is found.
+ WiX installation directory. Determined by searching the registry for the latest version.
+ This should not normally need to be changed.
+
+ \section2 toolchainInstallRoot
+
+ \table
+ \row \li \b{Type:} \li \c{path}
+ \row \li \b{Default:} \li determined automatically
+ \endtable
+
+ WiX binaries directory. Determined by searching the registry for the latest version.
This should not normally need to be changed.
\section2 compilerName
diff --git a/share/qbs/modules/wix/WiXModule.qbs b/share/qbs/modules/wix/WiXModule.qbs
index 97a6796dd..55bff0018 100644
--- a/share/qbs/modules/wix/WiXModule.qbs
+++ b/share/qbs/modules/wix/WiXModule.qbs
@@ -6,26 +6,14 @@ import "../utils.js" as ModUtils
Module {
condition: qbs.hostOS.contains("windows") && qbs.targetOS.contains("windows")
- property path toolchainInstallPath: {
- // First try the WIX environment variable
- var wixEnv = qbs.getenv("WIX");
- if (wixEnv)
- return wixEnv;
-
- // Couldn't find in environment, now attempt to locate the latest version by checking all known versions
- var versions = [ "4.0", "3.8", "3.7", "3.6", "3.5", "3.0", "2.0" ];
- for (var i in versions) {
- // First try the registry...
- //var regInstallPath = registryValue("HKLM/SOFTWARE/Wow6432Node/Microsoft/Windows Installer XML/" + versions[i] + "/InstallFolder");
- //if (regInstallPath)
- // return regInstallPath;
-
- // Then try the known filesystem path
- var path = FileInfo.joinPaths(qbs.getenv("PROGRAMFILES(X86)"), "WiX Toolset v" + versions[i]);
- if (File.exists(path))
- return path;
- }
- }
+ property path toolchainInstallPath: getNativeSetting(registryKey, "InstallFolder")
+ property path toolchainInstallRoot: getNativeSetting(registryKey, "InstallRoot")
+ property string version: getNativeSetting(registryKey, "ProductVersion")
+ 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 int versionBuild: versionParts[3]
property string compilerName: "candle.exe"
property string compilerPath: compilerName
@@ -103,14 +91,39 @@ Module {
property string executableSuffix: ".exe"
property string windowsInstallerSuffix: ".msi"
+ property string registryKey: {
+ var knownVersions = [ "4.0", "3.8", "3.7", "3.6", "3.5", "3.0", "2.0" ];
+ var keyNative = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Installer XML\\";
+ var keyWoW64 = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows Installer XML\\";
+
+ for (i in knownVersions) {
+ if (getNativeSetting(keyNative + knownVersions[i], "ProductVersion"))
+ return keyNative + knownVersions[i];
+ if (getNativeSetting(keyWoW64 + knownVersions[i], "ProductVersion"))
+ return keyWoW64 + knownVersions[i];
+ }
+ }
+
validate: {
if (!toolchainInstallPath)
throw "wix.toolchainInstallPath is not defined. Set wix.toolchainInstallPath in your profile.";
+
+ if (!toolchainInstallRoot)
+ throw "wix.toolchainInstallRoot is not defined. Set wix.toolchainInstallRoot in your profile."
+
+ if (!version)
+ throw "wix.version is not defined. Set wix.version in your profile.";
+
+ if (!/^[0-9]+(\.[0-9]+){1,3}$/.test(version)) {
+ throw "wix.version is in an invalid format; it must be of the form x.y.z.w " +
+ "where x, y, z and w are positive integers.";
+ }
}
setupBuildEnvironment: {
var v = new ModUtils.EnvironmentVariable("PATH", ";", true);
- v.prepend(toolchainInstallPath + "/bin");
+ v.prepend(toolchainInstallPath);
+ v.prepend(toolchainInstallRoot);
v.set();
}