I've written an article about how to build PySide2 earlier. Some partners were asking about how to build QT 5.6.1 This is a guide for building QT 5.6.1 on windows.
Prerequisite:
- Visual Studio 2012 Update 4 or Update 5
- QT 5.6.1
- Ruby 2.1.7(32 bits)
- Perl for OpenSSL
- JOM (recommended)
Build Steps:
1. Download and unzip the tarball from the Autodesk open source distribution page
Depending on how you extracted the tar file, you may need to remove the ending digits (ie. 000644) in the extracted filename. I am using 7zip and it doesn't have this issue. Copy it into your qt folder for later usage.
2. Download the Qt distribution labeled ICU53_1
There are several files available, the one we need is icu_53_1_msvc_2012_64_devel.7z. After downloading, extract it and copy the icu53_1 folder to your QT directory (eg. C:\QT).
3. Download OpenSSL(1.0.1l) and build
You can download it from OpenSSL's website. Extract it into the QT directory, you'll need to build it yourself before using it to build QT. Follow the instruction in the INSTALL.W64.
4. Update the Build Environment
Open and edit BuildQt561-VS2012.cmd and update the path. Notice that for Python, we'd recommend to use a 64 bit Python build with Visual Studio 2012 to avoid any runtime issues. But Official 64 bit Python 2.7 should also be fine to build QT.
5. Configure
There are several configurations in our document (howToBuildQtOnWindows_m2017.txt), I've built both debug and release version of QT. Please execute BuildQt561-VS2012.cmd in a command shell before doing following steps.
cd c:\qt
mkdir qt-build-561
cd qt-build-561
..\qt-adsk-5.6.1\configure -prefix C:\qt\qt-adsk-5.6.1.out -debug-and-release -force-debug-info -opensource -icu -opengl desktop -directwrite -openssl -plugin-sql-sqlite -I c:\qt\openssl\1.0.1l-vc11-nossl3\include -L c:\qt\openssl\1.0.1l-vc11-nossl3 -no-warnings-are-errors -nomake examples -nomake tests
I copied my OpenSSL build into c:\qt\openssl\1.0.1l-vc11-nossl3. The OpenSSL include folder path should point to inc32 folder inside your OpenSSL source package. I made some changes to the path according to the document, you don't have to do it yourself.
The prefix for parameter is for the final step. You need to specify a directory for the final output package.
For more details about the parameters, please refer to the “how-to” inside the QT package.
6. Make
If you want to use all of your cores to build it, it is better to get JOM from QT and put its path in the PATH environment variable. Otherwise you can run nmake directly.
jom > build.log
or
nmake
7. Make install
Just run nmake install, it will create a final output in the prefix directory in Step 5.
Now that you have built QT 5.6.1 for Maya, you could try to build examples in your QT\Examples folder with your customized QT. When finished, you can put the built programs into the Autodesk QT folder\bin and it should be working properly. Enjoy:)
Thank you for these instructions! I'm getting stuck on the OpenSSL compile.
I added PATH variables:
nmake: "/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin/amd64"
platform sdk include: "/cygdrive/c/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Include"
platform sdk lib: "/cygdrive/c/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib"
... into the Cygwin .bash_profile file as "PATH="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin/amd64:/cygdrive/c/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Include:/cygdrive/c/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib:${PATH}" and it does pick up nmake - but not the SDK.
I get error "Cannot open include file: 'windows.h': No such file or directory"
I also tried changing the include statements to since the header file is upper case. Also tried the opposite where the include statements were left to default and changed the SDK file to windows.h. No luck so far.
Can you help me resolve this, please?
Posted by: Martin Karlsson | September 29, 2016 at 01:02 PM
Hi Martin,
Can you try the VS2012 x64 Native Command Tools installed with Visual Studio 2012?
I am using it for setting up the environment.
Yours,
Li
Posted by: Chengxi Li | September 30, 2016 at 12:29 AM
Thank you - that worked. I did get one additional error but that was resolved using this trick: http://wishmesh.com/2013/01/building-openssl-with-visual-studio-2010-for-x64-win64-causes-error/
Posted by: Martin Karlsson | September 30, 2016 at 08:50 AM
For step #7 I had to copy the "...\openssl\inc32\openssl" folder into the "...\qt-adsk-5.6.1\qtbase\include\..." folder so you end up having "...\qt-adsk-5.6.1\qtbase\include\openssl\aes.h" and so on.
Posted by: Martin Karlsson | September 30, 2016 at 09:31 AM
Got it all working with compiling PySide2. Many thanks for this post, Li !!!
Posted by: Martin Karlsson | October 04, 2016 at 11:40 AM