Guides/Compiling Jqt

From J Wiki
Jump to: navigation, search

Compiling Jqt on Windows using free tools

These instructions are updated to J805.

You can compile your own verson of Jqt on Windows using the free Microsoft Visual Studio Community 2013. You may want to do so if you are adding new functions to Jqt or wish to restrict the set of Qt libraries required for a standalone application (see Standalone, cross-platform applications in J8).

Slim versions of Jqt are available from http://www.jsoftware.com/download/j805/qtide . These binaries remove the functionality for websockets, webengine, qml, multimedia, and opengl, and eliminate the need for the corresponding Qt libraries. On a 64-bit Windows system, the full installation of Jqt has 101MB in ~bin, while the slim installation requires only 27MB. By compiling your own Jqt, you can selectively remove one or more of the above functions by editing lib.pro in the Jqt source.

Brief instructions for compiling Jqt on Windows 10 (or Windows 7 or 8) are provided below.

1. Install Visual Studio Community 2013 for Windows Desktop

Instructions for downloading the free version of the Microsoft compiler can be found at http://www.visualstudio.com/en-us/news/releasenotes/vs2013-community-vs. You will need to sign up for the free Dev Essentials subscription if you don't already have a paid Visual Studio subscription. Download the compiler and install it to the default location. None of the optional components presented by the installer are required to compile jqt.

2. Install the Qt SDK

The installers are available at http://download.qt.io/official_releases/qt/5.6/5.6.2/ .

If you want to compile both 64-bit and 32-bit versions of Jqt, you will need to download and install both versions of the Qt SDK.

  • for 32-bit, download qt-opensource-windows-x86-msvc2013-5.6.2.exe and install it to C:\Qtx86\Qt5.6.2
  • for 64-bit, download qt-opensource-windows-x86-msvc2013_64-5.6.2.exe and install it to the default location (C:\Qt\Qt5.6.2).

3. Set up the source directory

First set up the source directory (e.g., c:\src). To compile the 64-bit version, create an environment script (env64.cmd) in the source folder with the following contents:

REM Set up Windows SDK for 64bit
CALL "c:\program files (x86)\microsoft visual studio 12.0\vc\bin\amd64\vcvars64.bat"
set PATH=c:\qt\qt5.6.2\5.6\msvc2013_64\bin;%PATH%
set QMAKESPEC=win32-msvc2013

To compile a slim version of jqt (no webengine, multimedia...), copy env64.cmd to env64slim.cmd and add the line:

set JQTSLIM=JQTSLIM

To compile the 32-bit version, create an environment script (env32.cmd) with the following contents:

REM Set up Windows SDK for 32bit xp compatible
CALL "c:\program files (x86)\microsoft visual studio 12.0\vc\bin\vcvars32.bat"
set INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%
set PATH=c:\qtx86\qt5.6.2\5.6\msvc2013\bin;%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%
set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
set CL=/D_USING_V110_SDK71_;%CL%
set LINK=/SUBSYSTEM:CONSOLE,5.01 %LINK%
set QMAKESPEC=win32-msvc2013

This environment will use the Windows 7.1 SDK (rather than that for Windows 8) and will allow the executables to run on 32-bit versions of Windows XP. Again, copy env32.cmd to env32slim.cmd and add set JQTSLIM=JQTSLIM to allow compiling a slim version. Note that the above allows compilation of jqt that will run on Windows XP (32-bit) through Windows 10.

4. Download latest qtide source

Obtain the latest Jqt source from the Git repository. Place a copy of the source folder (e.g., qtide) in the src folder. You can modify the contents of the file qtide\lib\lib.pro to selectively remove Jqt functions as needed (how to do so will become obvious from reading the file).

5. Compile Jqt

To compile the 64-bit version, open a command prompt in the src directory and execute the following (waiting for each to complete before going to the next):

Note: the final copy command in the first qmake may fail with a message 'error copying file to itself'. This error message can be ignored.

env64.cmd
cd qtide\lib
qmake
nmake
cd ..\main
qmake
nmake
cd ..\

The binaries will be in the folder qtide\bin\win-x86_64\release. Copy the exe, and dll files to your ~bin directory and you are good to go. If you want to compile binaries that remove all of the non-core functionality, substitute env64slim.cmd for env64.cmd above.

To compile the 32-bit version of Jqt, open a new command prompt in the src directory and proceed as above, executing env32.cmd or env32slim.cmd as the first command.

6. After you make changes

If you change the source code, you need to re-make the binaries with your changes. You don't need to rerun qmake; just run nmake in each directory.

If you Pull files from the repository, the filedates may confuse nmake, and you may end up with downlevel modules. In this case run nmake -all to get a clean start.


Contributed by Norman Drinkwater, 7/2017