From c57ffc95daa7e9fef8663979d01b08a122447ba4 Mon Sep 17 00:00:00 2001 From: Thanos Doukoudakis Date: Thu, 7 Sep 2017 17:44:42 +0100 Subject: Enable per user installations on Windows This patch will allow the installer to perform per-user installations that doesn't require elevated rights. If the Visual Studio prerequisites are missing, the installer will ask the user if he wants to install them. If the user chooses not to, the installer will deploy the necessary files in the installation folder. Installations for all users (per machine) are still available. Upon upgrading in per-user installs from previous versions, the user can still access the settings that were stored in the registry, but not the settings stored in system-settings.xml. Test-Information: Build and tested with Wix3.11, Qt 5.8 and Visual Studio 2015 on Windows 10 and Windows 7. Tested fresh install and upgrade, for per-machine and per-user installations. Tested the vcredist install and the dll deployment when the installation is not present. Verified that the installer uses the registry settings in per-user installations. Change-Id: I1879e2fb7ee347dab58852eb73d4ddddec15b35d diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot index fc943f7..c4728ff 100644 --- a/BuildTools/SCons/SConscript.boot +++ b/BuildTools/SCons/SConscript.boot @@ -37,7 +37,8 @@ if os.name == "mac" or (os.name == "posix" and os.uname()[0] == "Darwin"): vars.Add(BoolVariable("mac105", "Link against the 10.5 frameworks", "no")) vars.Add(BoolVariable("mac106", "Link against the 10.6 frameworks", "no")) if os.name == "nt" : - vars.Add(PathVariable("vcredist", "MSVC redistributable dir", None, PathVariable.PathAccept)) + vars.Add(PathVariable("vcredist", "MSVC redistributable path", None, PathVariable.PathAccept)) + vars.Add(PathVariable("vcredistdir", "MSVC redistributable dir", None, PathVariable.PathAccept)) if os.name == "nt" : vars.Add(PathVariable("wix_bindir", "Path to WiX binaries", "", PathVariable.PathAccept)) if os.name == "nt" : diff --git a/BuildTools/SCons/Tools/wix.py b/BuildTools/SCons/Tools/wix.py index 907b6d9..889afe4 100644 --- a/BuildTools/SCons/Tools/wix.py +++ b/BuildTools/SCons/Tools/wix.py @@ -38,7 +38,7 @@ def generate(env) : light_builder = SCons.Builder.Builder( - action = '"$WIX_LIGHT" $WIX_LIGHT_OPTIONS -b "$WIX_SOURCE_OBJECT_DIR" ${SOURCES} -o ${TARGET}', + action = '"$WIX_LIGHT" $WIX_LIGHT_OPTIONS -b "$WIX_SOURCE_OBJECT_DIR" ${SOURCES} -loc Swift\\Packaging\\WiX\\Swift_en-us.wxl -o ${TARGET}', src_suffix = '.wixobj', src_builder = candle_builder) @@ -48,4 +48,3 @@ def generate(env) : def exists(env) : return True - diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 3e48510..5873300 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -46,10 +46,11 @@ The Windows package consist of a Widnows Installer (.msi) file. This is generate For packaging use: - Microsoft VS 2013 Express - WiX -- Download the C++ redistributable package from Microsoft and put it at `C:\Program Files (x86)\Common Files\Merge Modules\` +- Swift has a dependency on C++ redistributable package from Microsoft that needs to be deployed during install. If the common tools for Visual C++ is installed, then the installation file should be located under `C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\1033\` (for Visual Studio 2013). If not download from Microsoft and put it at `C:\Program Files (x86)\Common Files\Merge Modules\` - `config.py` should contain: qt = "c:\\qt\\5.4.2" - vcredist = "C:\\Program Files (x86)\\Common Files\\Merge Modules\\vcredist_x86.exe" + vcredist = "C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\redist\\vcredist_x86.exe" + vcredistdir = "C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\redist\\x86\Microsoft.VC120.CRT\\" debug = 1 optimize = 1 wix_bindir = "c:\\program files\\Windows Installer XML v3.5\\bin" diff --git a/Swift/Packaging/WiX/Swift.wxs b/Swift/Packaging/WiX/Swift.wxs index 1e8d129..a2e8dd6 100644 --- a/Swift/Packaging/WiX/Swift.wxs +++ b/Swift/Packaging/WiX/Swift.wxs @@ -3,18 +3,29 @@ - - + + + + + + + + + @@ -25,6 +36,9 @@ --> + + + @@ -42,8 +56,11 @@ + + + @@ -53,23 +70,133 @@ - + + + - - + + + + - + (NOT VCREDISTINSTALLED AND ALLUSERS = 1) OR WIXUIVCREDISTINSTALL = 1 + + + + (NOT (VCREDISTINSTALLED OR ALLUSERS = 1)) AND WIXUIVCREDISTINSTALL = 0 + + + + (NOT (VCREDISTINSTALLED OR ALLUSERS = 1)) AND WIXUIVCREDISTINSTALL = 0 + "120"?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + NOT Installed AND NOT PATCH + Installed AND PATCH + + 1 + LicenseAccepted = "1" + + 1 + + !(wix.WixUISupportPerUser) AND NOT Privileged + WixAppFolder = "WixPerUserFolder" + WixAppFolder = "WixPerMachineFolder" + WixAppFolder = "WixPerUserFolder" + WixAppFolder = "WixPerMachineFolder" + 1 + + 1 + + 1 + NOT VCREDISTINSTALLED AND NOT ALLUSERS + NOT VCREDISTINSTALLED AND NOT ALLUSERS + NOT VCREDISTINSTALLED AND NOT ALLUSERS + VCREDISTINSTALLED OR ALLUSERS = 1 + VCREDISTINSTALLED OR ALLUSERS = 1 + VCREDISTINSTALLED OR ALLUSERS = 1 + + + + 1 + 1 + + + 1 + 1 + + + + + + WixUI_InstallMode = "Change" + WixUI_InstallMode = "InstallCustom" + NOT VCREDISTINSTALLED AND NOT ALLUSERS + VCREDISTINSTALLED OR ALLUSERS = 1 + + WixUI_InstallMode = "InstallCustom" + WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete" + WixUI_InstallMode = "Change" + WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove" + WixUI_InstallMode = "Update" + + 1 + + 1 + 1 + 1 + 1 + + + diff --git a/Swift/Packaging/WiX/Swift_en-us.wxl b/Swift/Packaging/WiX/Swift_en-us.wxl new file mode 100644 index 0000000..780b290 --- /dev/null +++ b/Swift/Packaging/WiX/Swift_en-us.wxl @@ -0,0 +1,4 @@ + + + [ProductName] will be installed in a user folder and auto-updates will be enabled. The application be installed only for your user and you do not need to be an Administrator. + diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index ff97b42..77731df 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -57,7 +57,7 @@ myenv.Tool("textfile", toolpath = ["#/BuildTools/SCons/Tools"]) qt4modules = ['QtCore', 'QtWebKit', 'QtGui'] if myenv["qt5"] : qt_version = '5' - # QtSvg is required so the image format plugin for SVG images is installed + # QtSvg is required so the image format plugin for SVG images is installed # correctly by Qt's deployment tools. qt4modules += ['QtWidgets', 'QtWebKitWidgets', 'QtMultimedia', 'QtSvg'] if env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" : @@ -478,9 +478,16 @@ if env["PLATFORM"] == "win32" : outfile.close() infile.close() copying = env.Command(["Swift/COPYING.rtf"], ["COPYING"], convertToRTF) + if env.get("vcredistdir", "") : + vcredistdir = os.path.dirname(env["vcredistdir"]) + else: + vcredistdir = os.path.dirname(env["vcredist"])+"\\..\\" + ("x86" if env["win_target_arch"] == "x86" else "x64") + "\\Microsoft.VC"+env.get("MSVC_VERSION", "").replace(".","")[:3]+".CRT\\" wixvariables = { 'VCCRTFile': env["vcredist"], - 'Version': str(myenv["SWIFT_VERSION_MAJOR"]) + "." + str(myenv["SWIFT_VERSION_MINOR"]) + "." + str(myenv["SWIFT_VERSION_PATCH"]) + 'VCCRTPath': vcredistdir, + 'Version': str(myenv["SWIFT_VERSION_MAJOR"]) + "." + str(myenv["SWIFT_VERSION_MINOR"]) + "." + str(myenv["SWIFT_VERSION_PATCH"]), + 'MsvcVersion': str(env.get("MSVC_VERSION", "").replace(".","")[:3]), + 'MsvcDotVersion': str(env.get("MSVC_VERSION", "")[:4]) } wixincludecontent = "" for key in wixvariables: -- cgit v0.10.2-6-g49f6