Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing VC++ Redistributables in a Qt Installer Framework (QtIFW) installer?

I am building installers for my app with the Qt Installer Framework (v2.0.1). I'm building my app for both x86 and x64 on Windows, so I'm building an installer for each architecture, with different VC++ Redistributables packaged in each (vcredist_x86.exe and vcredist_x64.exe from MSVC++2013). The QtIFW documentation is frustratingly short on details, but I found that I can add an operation in installscript.qs to run the vcredist installer silently after my files are extracted:

component.addOperation("Execute", "@TargetDir@/vcredist_x64.exe", "/quiet", "/norestart");

But then I have the problem of determining whether my installer is the x86 or x64 version. Is there a way to determine this from the installscript? Perhaps a way to look through the list of files to be extracted? Or is there an easier way to accomplish this seemingly common task of installing the VCRedists?

The documentation just states this:

To install the runtime libraries on the end-user's system, you need to include the appropriate Visual C++ Redistributable Package (VCRedist) executable with your application and ensure that it is executed when the user installs your application.

But it doesn't offer any details on how to "ensure that it is executed".

like image 781
Brian O'Neill Avatar asked May 01 '16 21:05

Brian O'Neill


1 Answers

I had a similar problem. You can get the systems architecture using the systeminfo.currentCpuArchitecture . To find out, whether the given architecture is x64, what I did was:

if(systemInfo.currentCpuArchitecture.search("64") < 0) {
    //x86
} else {
    //x64
}

Note: This will return the OS architecture, so a x86 OS on a x64 CPU will be seen as x86.

Edit: Have a look at: https://github.com/Skycoder42/QtIFW-Advanced-Setup . It's a sample project I created that does a lot of additional stuff to improve working with QtIFW, like for example reparing the install path or properly handling offline/online installers.

like image 185
Felix Avatar answered Oct 27 '22 21:10

Felix